<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.casic.missiles.mapper.system.SystemRfidMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.casic.missiles.model.system.SystemRfid"> <id column="id" property="id" /> <result column="rfid" property="rfid" /> <result column="create_time" property="createTime" /> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, rfid, create_time </sql> <select id="listScopePage" resultType="com.casic.missiles.dto.system.RfidListDTO"> select * from( WITH r AS ( SELECT DISTINCT rfid, create_user_dept as deptId FROM eqpt_system_rfid UNION SELECT DISTINCT rfid, dept_id as deptId FROM eqpt_equipment_info ) SELECT r.rfid as rfid, r.deptId as deptId, if(e.id is null,"0","1") as usageStatus, e.equipment_no as equipmentNo, e.equipment_name as equipmentName, e.use_position as usePosition, e.director_name as directorName FROM r left join eqpt_equipment_info e on r.rfid = e.rfid <where> <if test="ew != null"> ${ew.sqlSegment} </if> </where>) A </select> <select id="listScope" resultType="com.casic.missiles.dto.system.RfidListDTO"> WITH r AS ( SELECT DISTINCT rfid, create_user_dept as deptId FROM eqpt_system_rfid UNION SELECT DISTINCT rfid, dept_id as deptId FROM eqpt_equipment_info ) SELECT r.rfid as rfid, r.deptId as deptId, if(e.id is null,"0","1") as usageStatus, e.equipment_no as equipmentNo, e.equipment_name as equipmentName, e.use_position as usePosition, e.director_name as directorName FROM r left join eqpt_equipment_info e on r.rfid = e.rfid <where> <if test="ew != null"> ${ew.sqlSegment} </if> </where> </select> </mapper>