<?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.ycl.mapper.unlawful.UnlawfulMapper">
|
<select id="getDataByType" resultType="com.ycl.dto.statistics.CategoryDto">
|
SELECT
|
t4.id id,
|
t4.NAME name
|
FROM
|
`ums_base_case` AS ubc
|
JOIN ums_violations AS uv ON ubc.id = uv.id
|
LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
|
LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
|
LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
|
WHERE
|
ubc.category =1
|
and t4.`name` is NOT NULL
|
<if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null">
|
and ubc.create_time between #{startTime} and #{endTime}
|
</if>
|
group by
|
t4.id
|
limit #{currentPage}, #{pageSize}
|
</select>
|
<select id="getStatusDataByType" resultType="com.ycl.dto.statistics.StatusDto">
|
SELECT
|
count(1) total,
|
sum(case when ubc.state=5 then 1 else 0 end) register,
|
sum(case when ubc.state=4 then 1 else 0 end ) notRegister,
|
sum(case when ubc.state=9 then 1 else 0 end ) closing,
|
sum(case when ubc.state=3 then 1 else 0 end ) relearn,
|
sum(case when ubc.state=8 then 1 else 0 end ) checked
|
FROM
|
`ums_base_case` AS ubc
|
JOIN ums_violations AS uv ON ubc.id = uv.id
|
LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
|
LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
|
LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
|
WHERE
|
ubc.category =1
|
and t4.`id` = #{dictionaryId}
|
<if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null">
|
and ubc.create_time between #{startTime} and #{endTime}
|
</if>
|
</select>
|
<select id="getTotal" resultType="java.lang.Integer">
|
SELECT
|
count(*)
|
FROM
|
`ums_base_case` AS ubc
|
JOIN ums_violations AS uv ON ubc.id = uv.id
|
LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
|
LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
|
LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
|
WHERE
|
ubc.category = 1
|
AND t4.`name` IS NOT NULL
|
|
</select>
|
<select id="getDataByTypeExp" resultType="com.ycl.dto.statistics.CategoryDto">
|
SELECT
|
t4.id id,
|
t4.NAME name
|
FROM
|
`ums_base_case` AS ubc
|
JOIN ums_violations AS uv ON ubc.id = uv.id
|
LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
|
LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
|
LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
|
WHERE
|
ubc.category =1
|
and t4.`name` is NOT NULL
|
group by
|
t4.id
|
</select>
|
</mapper>
|