|
|
|
<?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.df.mapper.BsSgcDfAqrwMapper">
|
|
|
|
|
|
|
|
<sql id="info">
|
|
|
|
SELECT sx.`NAME`,
|
|
|
|
COUNT(1) num
|
|
|
|
FROM bs_sgc_df_dfrw ss
|
|
|
|
LEFT JOIN att_dike_base sj ON sj.dike_code = ss.dike_code
|
|
|
|
LEFT JOIN sys_xzqh sx ON sj.adcd = LEFT(sx.XZQHDM,6)
|
|
|
|
</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'
|
|
|
|
<if test="layer==1">
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</if>
|
|
|
|
<if test="layer==2">
|
|
|
|
GROUP BY sj.adcd
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getOneNum" resultMap="NumDto">
|
|
|
|
<include refid="info"></include>
|
|
|
|
where task_id =#{taskId} and ss.`status`='1'
|
|
|
|
<if test="layer==1">
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</if>
|
|
|
|
<if test="layer==2">
|
|
|
|
GROUP BY sj.adcd
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getTwoNum" resultMap="NumDto">
|
|
|
|
<include refid="info"></include>
|
|
|
|
where task_id =#{taskId} and ss.`status`='2'
|
|
|
|
<if test="layer==1">
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</if>
|
|
|
|
<if test="layer==2">
|
|
|
|
GROUP BY sj.adcd
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getThreeNum" resultMap="NumDto">
|
|
|
|
<include refid="info"></include>
|
|
|
|
where task_id =#{taskId} and ss.`status`='2'
|
|
|
|
<if test="layer==1">
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</if>
|
|
|
|
<if test="layer==2">
|
|
|
|
GROUP BY sj.adcd
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getNum" resultMap="NumDto">
|
|
|
|
<include refid="info"></include>
|
|
|
|
where task_id =#{taskId}
|
|
|
|
<if test="layer==1">
|
|
|
|
GROUP BY LEFT(sj.adcd,4)
|
|
|
|
</if>
|
|
|
|
<if test="layer==2">
|
|
|
|
GROUP BY sj.adcd
|
|
|
|
</if>
|
|
|
|
</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_df_dfrw ss
|
|
|
|
LEFT JOIN att_dike_base sj ON sj.dike_CODE = ss.dike_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>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|