<?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.MeterStaffMapper"> <select id="selectStaffList" resultType="com.casic.missiles.model.MeterStaff" parameterType="com.casic.missiles.dto.meter.MeterStaffRequest"> select t2.* from (SELECT t.id, t.`NAME`, t.staff_no, t.sex, t.education, t.technology_job, t.administration_job, t.dept_id, (select `certificate_no` from meter_certificate where staff_id = t.id ORDER BY create_time limit 1) as verifier_certificate_no, (select `valid_date` from meter_certificate where staff_id = t.id ORDER BY create_time limit 1) as certificate_date, t.major, t.technology_exam FROM meter_staff t where t.is_del = 0) t2 <where> <if test="request.staffNo != null and request.staffNo != ''"> and t2.staff_no like CONCAT('%',#{request.staffNo},'%') </if> <if test="request.name != null and request.name != ''"> and t2.`NAME` like concat('%', #{request.name}, '%') </if> <if test="request.deptId != null and request.deptId != ''"> and t2.dept_id = #{request.deptId} </if> <if test="request.major != null and request.major != ''"> and t2.major like concat('%', #{request.major}, '%') </if> <if test="request.verifierCertificateNo != null and request.verifierCertificateNo != ''"> and t2.verifier_certificate_no like concat('%', #{request.verifierCertificateNo}, '%') </if> </where> </select> <select id="selectStaffInfo" resultType="com.casic.missiles.model.MeterStaff" parameterType="String"> SELECT t.id, t.id_card, t.account, t.`NAME`, t.staff_no, t.sex, t.birthday, t.certificate_company, t.verifier_certificate_no, t.certificate_date, t.work_date, t.main_examiner, t.special_operator, t.education, t.technology_job, t.administration_job, t.dept_id, (select `certificate_no` from meter_certificate where staff_id = t.id ORDER BY create_time limit 1) as verifier_certificate_no, (select `valid_date` from meter_certificate where staff_id = t.id ORDER BY create_time limit 1) as certificate_date, t.major, t.technology_exam, t.remark FROM meter_staff t where t.id =#{id} </select> <select id="getMaxNo" resultType="long"> SELECT IFNULL(max(RIGHT(LENGTH(staff_no), 12)), 0) from meter_staff </select> </mapper>