<?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.business.BizBusinessIdentifyInfoMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.casic.missiles.model.business.BizBusinessIdentifyInfo"> <id column="id" property="id" /> <result column="record_no" property="recordNo" /> <result column="identify_type" property="identifyType" /> <result column="device_id" property="deviceId" /> <result column="device_type" property="deviceType" /> <result column="device_no" property="deviceNo" /> <result column="device_name" property="deviceName" /> <result column="measure_person_id" property="measurePersonId" /> <result column="measure_person" property="measurePerson" /> <result column="create_time" property="createTime" /> <result column="update_time" property="updateTime" /> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, record_no, identify_type, device_id, device_type, device_name, measure_person_id, measure_person, create_time, update_time </sql> <select id="selectMaxNo" resultType="java.lang.Long"> SELECT IFNULL(max(RIGHT(record_no, 12)), 0) from biz_business_identify_info </select> <select id="selectDeviceList" resultMap="BaseResultMap"> SELECT bbii.*, eei.model, eei.manufacture_no, eei.manufacturer, eei.limit_instruction, eei.check_date, eei.dept_id FROM biz_business_identify_info bbii JOIN eqpt_equipment_info eei ON bbii.device_id = eei.id WHERE 1=1 <if test="request != null and request.identifyType != null and request.identifyType !=''"> and bbii.identify_type = #{request.identifyType} </if> <if test="request != null and request.deviceNo != null and request.deviceNo !=''"> and bbii.device_no like concat('%',#{request.deviceNo},'%') </if> <if test="request != null and request.deviceName != null and request.deviceName !=''"> and bbii.device_name like concat('%',#{request.deviceName},'%') </if> <if test="request != null and request.model != null and request.model !=''"> and eei.model like concat('%',#{request.model},'%') </if> <if test="request != null and request.manufactureNo != null and request.manufactureNo !=''"> and eei.manufacture_no like concat('%',#{request.manufactureNo},'%') </if> <if test="request != null and request.manufacturer != null and request.manufacturer !=''"> and eei.manufacturer like concat('%',#{request.manufacturer},'%') </if> <!-- <if test="request != null and request.traceCompany != null and request.traceCompany !=''">--> <!-- and eei. = #{request.traceCompany}--> <!-- </if>--> <if test="request != null and request.limitInstruction != null and request.limitInstruction !=''"> and eei.limit_instruction like concat('%',#{request.limitInstruction},'%') </if> <!-- <if test="request != null and request.measureValidDateStart != null and request.measureValidDateStart !=''">--> <!-- and eei. >= #{request.measureValidDateStart}--> <!-- </if>--> <!-- <if test="request != null and request.measureValidDateEnd != null and request.measureValidDateEnd !=''">--> <!-- and eei. <= #{request.measureValidDateEnd}--> <!-- </if>--> <!-- <if test="request != null and request.measurePerson != null and request.measurePerson !=''">--> <!-- and eei. = #{request.measurePerson}--> <!-- </if>--> <if test="request != null and request.checkDateStart != null and request.checkDateStart !=''"> and eei.check_date >= #{request.checkDateStart} </if> <if test="request != null and request.checkDateEnd != null and request.checkDateEnd !=''"> and eei.check_date <= #{request.checkDateEnd} </if> <if test="request != null and request.updateTimeStart != null and request.updateTimeStart !=''"> and bbii.update_time >= #{request.updateTimeStart} </if> <if test="request != null and request.updateTimeEnd != null and request.updateTimeEnd !=''"> and bbii.update_time <= #{request.updateTimeEnd} </if> <if test="request != null and request.deptIds != null and request.deptIds.size() > 0"> and eei.dept_id in <foreach collection="request.deptIds" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </if> </select> <select id="selectEquipmentList" resultMap="BaseResultMap"> SELECT bbii.*, bei.model, bei.manufacture_no, bei.manufacturer, bei.trace_company, bei.measure_valid_date, bei.trace_date AS checkDate FROM biz_business_identify_info bbii JOIN biz_equipment_info bei ON bbii.device_id = bei.id WHERE 1=1 <if test="request != null and request.identifyType != null and request.identifyType !=''"> and bbii.identify_type = #{request.identifyType} </if> <if test="request != null and request.deviceNo != null and request.deviceNo !=''"> and bbii.device_no like concat('%',#{request.deviceNo},'%') </if> <if test="request != null and request.deviceName != null and request.deviceName !=''"> and bbii.device_name like concat('%',#{request.deviceName},'%') </if> <if test="request != null and request.model != null and request.model !=''"> and bei.model like concat('%',#{request.model},'%') </if> <if test="request != null and request.manufactureNo != null and request.manufactureNo !=''"> and bei.manufacture_no like concat('%',#{request.manufactureNo},'%') </if> <if test="request != null and request.manufacturer != null and request.manufacturer !=''"> and bei.manufacturer like concat('%',#{request.manufacturer},'%') </if> <if test="request != null and request.traceCompany != null and request.traceCompany !=''"> and bei.trace_company like concat('%',#{request.traceCompany},'%') </if> <if test="request != null and request.deptName != null and request.deptName !=''"> and bei.dept_name like concat('%',#{request.deptName},'%') </if> <!-- <if test="request != null and request.limitInstruction != null and request.limitInstruction !=''">--> <!-- and bei. like concat('%',#{request.limitInstruction},'%')--> <!-- </if>--> <if test="request != null and request.measureValidDateStart != null and request.measureValidDateStart !=''"> and bei.measure_valid_date >= #{request.measureValidDateStart} </if> <if test="request != null and request.measureValidDateEnd != null and request.measureValidDateEnd !=''"> and bei.measure_valid_date <= #{request.measureValidDateEnd} </if> <!-- <if test="request != null and request.measurePerson != null and request.measurePerson !=''">--> <!-- and bei. = #{request.measurePerson}--> <!-- </if>--> <if test="request != null and request.checkDateStart != null and request.checkDateStart !=''"> and bei.trace_date >= #{request.checkDateStart} </if> <if test="request != null and request.checkDateEnd != null and request.checkDateEnd !=''"> and bei.trace_date <= #{request.checkDateEnd} </if> <if test="request != null and request.updateTimeStart != null and request.updateTimeStart !=''"> and bbii.update_time >= #{request.updateTimeStart} </if> <if test="request != null and request.updateTimeEnd != null and request.updateTimeEnd !=''"> and bbii.update_time <= #{request.updateTimeEnd} </if> </select> </mapper>