You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
4.8 KiB
163 lines
4.8 KiB
<?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.kms.yg.sz.mapper.BsSgcSzAqrwMapper">
|
|
|
|
<sql id="info">
|
|
SELECT sx.`NAME`,
|
|
COUNT(1) num
|
|
FROM bs_sgc_sz_szrw ss
|
|
LEFT JOIN att_waga_base sj ON sj.waga_code = ss.waga_code
|
|
LEFT JOIN sys_xzqh sx ON LEFT(sj.adcd,6) = LEFT(sx.XZQHDM,6)
|
|
AND RIGHT(sx.xzqhdm, 6) = '000000'
|
|
</sql>
|
|
|
|
|
|
|
|
<resultMap id="NumDto" type="NumDto">
|
|
<result property="name" column="name"/>
|
|
<result property="num" column="num"/>
|
|
</resultMap>
|
|
|
|
<select id="getZeroNum" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and ss.`status`="0"
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
|
|
</select>
|
|
<select id="getOneNum" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and ss.`status`="1"
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
|
|
</select>
|
|
<select id="getTwoNum" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and ss.`status`="2"
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
|
|
</select>
|
|
<select id="getThreeNum" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and ss.`status`="3"
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</select>
|
|
<select id="getNum" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId}
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getOne" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and sj.`security_category`="0"
|
|
<if test="layer==1">
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==2">
|
|
GROUP BY sj.adcd
|
|
</if>
|
|
</select>
|
|
<select id="getTwo" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and sj.`security_category`="1"
|
|
<if test="layer==1">
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==2">
|
|
GROUP BY sj.adcd
|
|
</if>
|
|
</select>
|
|
<select id="getThree" resultMap="NumDto">
|
|
<include refid="info"></include>
|
|
where task_id =#{taskId} and sj.`security_category`="2"
|
|
<if test="layer==1">
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==2">
|
|
GROUP BY sj.adcd
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getStatistics" resultType="Map">
|
|
SELECT COUNT(1) num,
|
|
COUNT(CASE WHEN ss.status = '3' THEN 1 END) completedNum,
|
|
COUNT(CASE WHEN ss.status != '3' THEN 1 END) uncompletedNum,
|
|
ROUND(COUNT(CASE WHEN ss.PLAN_TIME > ss.COMPLETION_TIME THEN 1 END )/COUNT(1),2) as overTimeNumPercent,
|
|
ROUND(COUNT(CASE WHEN ss.status = '3' THEN 1 END)/COUNT(1),2)*100 as completedPercent,
|
|
ROUND(COUNT(CASE WHEN ss.status != '3' THEN 1 END)/COUNT(1),2)*100 as underWayPercent
|
|
|
|
FROM bs_sgc_sz_szrw ss
|
|
LEFT JOIN att_waga_base sj ON sj.waga_code = ss.waga_code
|
|
<if test="adcd != null and adcd != ''and adcd != null and adcd != ''">
|
|
<if test="layer==5">
|
|
and sj.adcd like concat(LEFT(#{adcd},2),'%')
|
|
</if>
|
|
<if test="layer==4">
|
|
and sj.adcd like concat(LEFT(#{adcd},4),'%')
|
|
</if>
|
|
<if test="layer==3">
|
|
and sj.adcd like concat(LEFT(#{adcd},6),'%')
|
|
</if>
|
|
</if>
|
|
<if test="startDate != null">
|
|
AND sj.create_time >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null">
|
|
AND sj.create_time < #{endDate}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<resultMap id="BsSgcSzAqrw" type="BsSgcSzAqrw">
|
|
<result property="taskName" column="task_name"/>
|
|
<result property="planCompletionTime" column="plan_completion_time"/>
|
|
<result property="createTime" column="time"/>
|
|
</resultMap>
|
|
|
|
<select id="getList" resultMap="BsSgcSzAqrw">
|
|
SELECT
|
|
ss.task_name,
|
|
plan_completion_time,
|
|
CURRENT_TIMESTAMP() as time
|
|
FROM bs_sgc_sz_aqrw ss
|
|
where 1=1
|
|
<if test="adcd != null and adcd != ''and adcd != null and adcd != ''">
|
|
<if test="layer==5">
|
|
and ss.adcd like concat(LEFT(#{adcd},2),'%')
|
|
</if>
|
|
<if test="layer==4">
|
|
and ss.adcd like concat(LEFT(#{adcd},4),'%')
|
|
</if>
|
|
<if test="layer==3">
|
|
and ss.adcd like concat(LEFT(#{adcd},6),'%')
|
|
</if>
|
|
</if>
|
|
and ss.incompletion_number>0
|
|
AND CURDATE() BETWEEN ss.plan_completion_time - INTERVAL 5 DAY AND ss.plan_completion_time
|
|
group by id;
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|