btxtgxq-system-city/src/main/resources/mybatis/mapper/datarelease/datarelease-mapper.xml

189 lines
6.1 KiB
XML
Raw Normal View History

<?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.cm.systemcity.dao.datarelease.IDataReleaseDao">
2022-09-06 11:01:29 +08:00
<select id="getAreaInfoFromCityDict" parameterType="map" resultType="map">
SELECT * FROM
city_dict
WHERE
is_delete = '0'
AND dict_parent_id = #{dictParentId}
</select>
<select id="getCommunityInfo" parameterType="map" resultType="map">
SELECT * FROM
city_community
WHERE
is_delete = '0'
AND area_id = #{areaId}
ORDER BY community_order ASC
</select>
<!-- 查询上报案件 -->
<select id="listReportCase" parameterType="map" resultType="map">
SELECT
*
FROM
city_report_case
WHERE
is_delete = '0'
2022-10-11 18:26:30 +08:00
<if test="caseFlowType != null and caseFlowType != ''">
AND FIND_IN_SET(case_flow_type, #{caseFlowType})
</if>
<if test="caseStatus != null and caseStatus != ''">
2022-10-11 18:26:30 +08:00
AND FIND_IN_SET(case_status, #{caseStatus})
</if>
<if test="dataCatalog != null and dataCatalog == 'dept'">
AND case_flow_type = '1'
</if>
<if test="dataCatalog != null and dataCatalog == 'street'">
AND case_flow_type = '2'
AND case_reporter NOT LIKE CONCAT('%',CONCAT('微信', '%'))
</if>
<if test="dataCatalog != null and dataCatalog == 'person'">
AND case_flow_type = '2'
AND case_reporter LIKE CONCAT('%',CONCAT('微信', '%'))
</if>
<if test="gmtCreateLike != null and gmtCreateLike != ''">
AND gmt_create LIKE CONCAT('%',CONCAT(#{gmtCreateLike}, '%'))
</if>
<if test="gmtModified != null and gmtModified != ''">
AND gmt_modified LIKE CONCAT('%',CONCAT(#{gmtModified}, '%'))
</if>
<if test="areaId != null and areaId !=''">
AND area_id = #{areaId}
</if>
<if test="caseStatusCompareUp != null and caseStatusCompareUp !=''">
AND case_status <![CDATA[>=]]> #{caseStatusCompareUp}
</if>
2022-10-11 18:26:30 +08:00
<if test="startTime != null and startTime !=''">
AND gmt_create <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null and endTime !=''">
AND gmt_create <![CDATA[<=]]> #{endTime}
</if>
<if test="modifiedStr != null and modifiedStr !=''">
AND gmt_modified <![CDATA[>=]]> #{modifiedStr}
</if>
<if test="modifiedEnd != null and modifiedEnd !=''">
AND gmt_modified <![CDATA[<=]]> #{modifiedEnd}
</if>
2022-10-11 18:26:30 +08:00
ORDER BY gmt_create DESC
</select>
<select id="listSpecialReportCase" parameterType="map" resultType="map">
SELECT
*
FROM
city_special_report_case
WHERE
is_delete = '0'
<if test="caseStatus != null and caseStatus != ''">
AND case_status = #{caseStatus}
</if>
<if test="gmtModified != null and gmtModified != ''">
AND gmt_modified LIKE CONCAT('%',CONCAT(#{gmtModified}, '%'))
</if>
<if test="areaId != null and areaId !=''">
AND area_id = #{areaId}
</if>
</select>
<select id="getCaseTypeTop10" parameterType="map" resultType="map">
SELECT
t1.case_type_id caseTypeId,
t2.dict_name dictName,
COUNT(t1.case_type_id) caseTypeCount
FROM
city_report_case t1
LEFT JOIN city_dict t2 ON t1.case_type_id = t2.dict_id
WHERE
t1.is_delete = '0'
AND t1.case_status = '6'
GROUP BY
t1.case_type_id,
t2.dict_name
ORDER BY
caseTypeCount DESC
LIMIT 0,10
</select>
<select id="listReportCaseLog" parameterType="map" resultType="map">
SELECT
t1.option_type optionType,
t1.user_name userName,
t1.gmt_create gmtCreate,
t2.case_content caseContent
FROM
city_report_case_log t1
LEFT JOIN city_report_case t2 ON t1.case_id = t2.report_case_id
ORDER BY
t1.gmt_create DESC
LIMIT 0,10
</select>
<select id="listUserDynamicPosition" parameterType="map" resultType="map">
SELECT
creator,
user_name
FROM
city_user_location
WHERE
gmt_create <![CDATA[ >= ]]> #{timeStr}
AND gmt_create <![CDATA[ <= ]]> #{timeEnd}
GROUP BY
creator,user_name
</select>
2022-09-06 11:01:29 +08:00
<select id="listCaseInMap" parameterType="map" resultType="map">
SELECT
2022-10-11 18:26:30 +08:00
report_case_id,
case_reporter,
2022-09-06 11:01:29 +08:00
case_content,
case_longitude,
case_latitude,
gmt_create
FROM
city_report_case
WHERE
2022-10-11 18:26:30 +08:00
case_status = '2'
2022-09-06 11:01:29 +08:00
<if test="startTime != null and startTime != ''">
AND LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY
gmt_create DESC
</select>
2022-09-25 13:49:22 +08:00
<select id="listUserLocation" parameterType="map" resultType="map">
SELECT
t1.user_name,
t1.creator
FROM
city_user_location t1
WHERE
t1.gmt_create <![CDATA[ >= ]]> #{startTime}
AND t1.gmt_create <![CDATA[ <= ]]> #{endTime}
<if test="userName != null and userName != ''">
AND t1.user_name = #{userName}
</if>
GROUP BY t1.user_name, t1.creator
</select>
<select id="getLastUserLocationInfo" parameterType="map" resultType="map">
SELECT
t1.*,
t2.user_avatar,
2022-10-11 18:26:30 +08:00
t2.user_phone,
t2.user_username
2022-09-25 13:49:22 +08:00
FROM
city_user_location t1
INNER JOIN sys_user t2 ON t1.creator = t2.user_id
WHERE
t1.creator = #{userId}
ORDER BY t1.gmt_create desc
limit 1
</select>
</mapper>