|
@@ -39,13 +39,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectTechnicianPage" resultMap="technicianResultMap" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">
|
|
<select id="selectTechnicianPage" resultMap="technicianResultMap" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">
|
|
|
-
|
|
|
|
|
- select *
|
|
|
|
|
- from kd_technician a
|
|
|
|
|
|
|
+ select t1.*
|
|
|
|
|
+ from kd_technician t1
|
|
|
<if test="technician.yearAndMonth.length()==4">
|
|
<if test="technician.yearAndMonth.length()==4">
|
|
|
- INNER JOIN (
|
|
|
|
|
- SELECT MAX(id) AS max_id FROM kd_technician GROUP BY name,number,identity_card
|
|
|
|
|
- ) b ON a.id = b.max_id
|
|
|
|
|
|
|
+ INNER JOIN
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT number, identity_card, MAX( year_and_month ) AS max_month
|
|
|
|
|
+ FROM kd_technician
|
|
|
|
|
+ WHERE LEFT ( year_and_month, 4 ) = #{technician.yearAndMonth} AND is_deleted = 0
|
|
|
|
|
+ GROUP BY number, identity_card
|
|
|
|
|
+ ) t2
|
|
|
|
|
+ ON t1.number = t2.number AND t1.identity_card = t2.identity_card AND t1.year_and_month = t2.max_month
|
|
|
</if>
|
|
</if>
|
|
|
where is_deleted = 0
|
|
where is_deleted = 0
|
|
|
<if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>
|
|
<if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>
|
|
@@ -65,23 +69,27 @@
|
|
|
<if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>
|
|
<if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="technician.yearAndMonth.length()==4">
|
|
<when test="technician.yearAndMonth.length()==4">
|
|
|
- and date_format(year_and_month,'%Y') = #{technician.yearAndMonth}
|
|
|
|
|
|
|
+ and LEFT ( t1.year_and_month, 4 ) = #{technician.yearAndMonth}
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
- and date_format(year_and_month,'%Y-%m') = #{technician.yearAndMonth}
|
|
|
|
|
|
|
+ and LEFT ( t1.year_and_month, 7 ) = #{technician.yearAndMonth}
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
- order by year_and_month
|
|
|
|
|
|
|
+ order by year_and_month asc, id asc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="exportTechnicianList" resultType="org.sky.scientific.excel.TechnicianExcel" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">
|
|
<select id="exportTechnicianList" resultType="org.sky.scientific.excel.TechnicianExcel" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">
|
|
|
-
|
|
|
|
|
- select *
|
|
|
|
|
- from kd_technician a
|
|
|
|
|
|
|
+ select t1.*
|
|
|
|
|
+ from kd_technician t1
|
|
|
<if test="technician.yearAndMonth.length()==4">
|
|
<if test="technician.yearAndMonth.length()==4">
|
|
|
- INNER JOIN (
|
|
|
|
|
- SELECT MAX(id) AS max_id FROM kd_technician GROUP BY name,number,identity_card
|
|
|
|
|
- ) b ON a.id = b.max_id
|
|
|
|
|
|
|
+ INNER JOIN
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT number, identity_card, MAX( year_and_month ) AS max_month
|
|
|
|
|
+ FROM kd_technician
|
|
|
|
|
+ WHERE LEFT ( year_and_month, 4 ) = #{technician.yearAndMonth} AND is_deleted = 0
|
|
|
|
|
+ GROUP BY number, identity_card
|
|
|
|
|
+ ) t2
|
|
|
|
|
+ ON t1.number = t2.number AND t1.identity_card = t2.identity_card AND t1.year_and_month = t2.max_month
|
|
|
</if>
|
|
</if>
|
|
|
where is_deleted = 0
|
|
where is_deleted = 0
|
|
|
<if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>
|
|
<if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>
|
|
@@ -101,13 +109,13 @@
|
|
|
<if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>
|
|
<if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="technician.yearAndMonth.length()==4">
|
|
<when test="technician.yearAndMonth.length()==4">
|
|
|
- and date_format(year_and_month,'%Y') = #{technician.yearAndMonth}
|
|
|
|
|
|
|
+ and LEFT ( t1.year_and_month, 4 ) = #{technician.yearAndMonth}
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
- and date_format(year_and_month,'%Y-%m') = #{technician.yearAndMonth}
|
|
|
|
|
|
|
+ and LEFT ( t1.year_and_month, 7 ) = #{technician.yearAndMonth}
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
- order by year_and_month
|
|
|
|
|
|
|
+ order by year_and_month asc, id asc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectByYearAndMonth">
|
|
<select id="selectByYearAndMonth">
|