<?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="org.springblade.modules.police.mapper.PoliceAffairsGridMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="policeAffairsGridResultMap" type="org.springblade.modules.police.vo.PoliceAffairsGridVO">
|
<result column="id" property="id"/>
|
<result column="object_id" property="objectId"/>
|
<result column="jws_code" property="jwsCode"/>
|
<result column="user_id" property="userId"/>
|
<result column="policeman" property="policeman"/>
|
<result column="policeman_phone" property="policemanPhone"/>
|
<result column="community_code" property="communityCode"/>
|
<result column="community_name" property="communityName"/>
|
<result column="police_station_code" property="policeStationCode"/>
|
<result column="police_station_name" property="policeStationName"/>
|
<result column="geom" property="geom"/>
|
<result column="sort" property="sort"/>
|
<result column="create_time" property="createTime"/>
|
<result column="create_user" property="createUser"/>
|
<result column="update_time" property="updateTime"/>
|
<result column="update_user" property="updateUser"/>
|
<result column="remark" property="remark"/>
|
<result column="is_deleted" property="isDeleted"/>
|
</resultMap>
|
|
<!--自定义分页查询-->
|
<select id="selectPoliceAffairsGridPage" resultMap="policeAffairsGridResultMap">
|
select * from jczz_police_affairs_grid where is_deleted = 0
|
<if test="policeAffairsGrid.communityName!=null and policeAffairsGrid.communityName!=''">
|
and community_name like concat('%',#{policeAffairsGrid.communityName},'%')
|
</if>
|
<if test="policeAffairsGrid.jwGridCode!=null and policeAffairsGrid.jwGridCode!=''">
|
and jw_grid_code like concat('%',#{policeAffairsGrid.jwGridCode},'%')
|
</if>
|
<if test="policeAffairsGrid.pcsCode!=null and policeAffairsGrid.pcsCode!=''">
|
and pcs_code like concat('%',#{policeAffairsGrid.pcsCode},'%')
|
</if>
|
<if test="policeAffairsGrid.pcsName!=null and policeAffairsGrid.pcsName!=''">
|
and pcs_name like concat('%',#{policeAffairsGrid.pcsName},'%')
|
</if>
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="policeAffairsGrid.roleName != null and policeAffairsGrid.roleName != ''">
|
<if test="policeAffairsGrid.roleName=='mj'">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and community_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
</when>
|
<otherwise>
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and community_code in ('')
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
order by id desc,pcs_code desc
|
</select>
|
|
<!--判断该点在哪个警务网格-->
|
<select id="spatialAnalysis" resultType="org.springblade.modules.police.entity.PoliceAffairsGridEntity">
|
SELECT * FROM jczz_police_affairs_grid
|
WHERE is_deleted = 0
|
and ST_Intersects(geom, ST_GeomFromText(${point},0))
|
</select>
|
|
<!--查询对应的社区编号-->
|
<select id="getCommunityCodeListByUserId" resultType="java.lang.String">
|
SELECT community_code FROM jczz_police_affairs_grid
|
WHERE is_deleted = 0
|
and police_user_id like concat('%',#{userId},'%')
|
</select>
|
|
</mapper>
|