<?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.task.mapper.TaskSchoolEvenMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="taskSchoolEvenResultMap" type="org.springblade.modules.task.vo.TaskSchoolEvenVO">
|
</resultMap>
|
|
|
<select id="selectTaskSchoolEvenPage" resultMap="taskSchoolEvenResultMap">
|
select
|
jtse.*,
|
br.town_name streetName,
|
jg.grid_name,
|
jda.aoi_name,
|
br.village_name communityName,
|
bu.name,
|
bu.phone,
|
jp.location,
|
jp.place_name,
|
jda.address_name as addressName
|
from jczz_task_school_even jtse
|
left join jczz_doorplate_address jda on jda.address_code = jtse.house_code
|
LEFT JOIN blade_user bu ON bu.id = jtse.create_user
|
LEFT JOIN jczz_place jp on jp.house_code= jtse.house_code
|
left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
left join blade_region br on br.code = jg.community_code
|
LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
<where>
|
<if test="taskSchoolEven.id != null "> and jtse.id = #{taskSchoolEven.id}</if>
|
<if test="taskSchoolEven.createUser != null "> and jtse.create_user = #{taskSchoolEven.createUser}</if>
|
<if test="taskSchoolEven.images != null and taskSchoolEven.images != ''"> and jtse.images = #{taskSchoolEven.images}</if>
|
<if test="taskSchoolEven.placeName != null and taskSchoolEven.placeName != ''"> and jp.place_name like concat('%',#{taskSchoolEven.placeName},'%')</if>
|
<if test="taskSchoolEven.name != null and taskSchoolEven.name != ''"> and bu.name like concat('%',#{taskSchoolEven.name},'%')</if>
|
<if test="taskSchoolEven.phone != null and taskSchoolEven.phone != ''"> and bu.phone like concat('%',#{taskSchoolEven.phone},'%')</if>
|
<if test="taskSchoolEven.remark != null and taskSchoolEven.remark != ''"> and jtse.remark like concat('%',#{taskSchoolEven.remark},'%')</if>
|
<if test="taskSchoolEven.hiddenDangerType != null and taskSchoolEven.hiddenDangerType != ''"> and jtse.hidden_danger_type = #{taskSchoolEven.hiddenDangerType}</if>
|
<if test="taskSchoolEven.type != null and taskSchoolEven.type != ''"> and jtse.type = #{taskSchoolEven.type}</if>
|
<if test="taskSchoolEven.isProblem != null and taskSchoolEven.isProblem != ''"> and jtse.is_problem = #{taskSchoolEven.isProblem}</if>
|
<if test="taskSchoolEven.isHandle != null and taskSchoolEven.isHandle != ''"> and jtse.is_handle = #{taskSchoolEven.isHandle}</if>
|
<if test="taskSchoolEven.isReporting != null and taskSchoolEven.isReporting != ''"> and jtse.is_reporting = #{taskSchoolEven.isReporting}</if>
|
<if test="taskSchoolEven.workImage != null and taskSchoolEven.workImage != ''"> and jtse.work_image = #{taskSchoolEven.workImage}</if>
|
<if test="taskSchoolEven.confirmFlag != null and taskSchoolEven.confirmFlag != ''"> and jtse.confirm_flag = #{taskSchoolEven.confirmFlag}</if>
|
<if test="taskSchoolEven.confirmTime != null "> and jtse.confirm_time = #{taskSchoolEven.confirmTime}</if>
|
<if test="taskSchoolEven.confirmUserId != null "> and jtse.confirm_user_id = #{taskSchoolEven.confirmUserId}</if>
|
<if test="taskSchoolEven.confirmUserName != null and taskSchoolEven.confirmUserName != ''"> and jtse.confirm_user_name = #{taskSchoolEven.confirmUserName}</if>
|
<if test="taskSchoolEven.confirmNotion != null and taskSchoolEven.confirmNotion != ''"> and jtse.confirm_notion = #{taskSchoolEven.confirmNotion}</if>
|
<if test="taskSchoolEven.houseCode != null and taskSchoolEven.houseCode != ''"> and jtse.house_code = #{taskSchoolEven.houseCode}</if>
|
<if test="taskSchoolEven.createTime != null "> and jtse.create_time = #{taskSchoolEven.createTime}</if>
|
<if test="taskSchoolEven.updateTime != null "> and jtse.update_time = #{taskSchoolEven.updateTime}</if>
|
<if test="taskSchoolEven.startTime != null and taskSchoolEven.startTime != ''">
|
and date_format(jtse.create_time,'%Y-%m-%d') >= #{taskSchoolEven.startTime}
|
</if>
|
<if test="taskSchoolEven.endTime != null and taskSchoolEven.endTime != ''">
|
and date_format(jtse.create_time,'%Y-%m-%d') <= #{taskSchoolEven.endTime}
|
</if>
|
|
|
<if test="isAdministrator==2">
|
<if test="taskSchoolEven.roleName=='mj'">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jpag.community_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
</if>
|
</where>
|
order by jtse.create_time desc
|
</select>
|
|
<resultMap type="org.springblade.modules.task.dto.TaskSchoolEvenDTO" id="TaskSchoolEvenDTOResult">
|
<result property="id" column="id" />
|
<result property="createUser" column="create_user" />
|
<result property="images" column="images" />
|
<result property="remark" column="remark" />
|
<result property="hiddenDangerType" column="hidden_danger_type" />
|
<result property="type" column="type" />
|
<result property="isProblem" column="is_problem" />
|
<result property="isHandle" column="is_handle" />
|
<result property="isReporting" column="is_reporting" />
|
<result property="workImage" column="work_image" />
|
<result property="confirmFlag" column="confirm_flag" />
|
<result property="confirmTime" column="confirm_time" />
|
<result property="confirmUserId" column="confirm_user_id" />
|
<result property="confirmUserName" column="confirm_user_name" />
|
<result property="confirmNotion" column="confirm_notion" />
|
<result property="createTime" column="create_time" />
|
<result property="updateTime" column="update_time" />
|
</resultMap>
|
|
<sql id="selectTaskSchoolEven">
|
select
|
id,
|
create_user,
|
images,
|
remark,
|
hidden_danger_type,
|
type,
|
is_problem,
|
is_handle,
|
is_reporting,
|
work_image,
|
confirm_flag,
|
confirm_time,
|
confirm_user_id,
|
confirm_user_name,
|
confirm_notion,
|
create_time,
|
update_time
|
from
|
jczz_task_school_even
|
</sql>
|
|
<select id="schoolEvenCount" resultType="java.lang.Integer">
|
select
|
count(1)
|
from jczz_task_school_even jtse
|
left join jczz_doorplate_address jda on jda.address_code = jtse.house_code
|
LEFT JOIN blade_user bu ON bu.id = jtse.create_user
|
LEFT JOIN jczz_place jp on jp.house_code= jtse.house_code
|
left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
left join blade_region br on br.code = jg.community_code
|
<where>
|
<if test="taskSchoolEven.id != null "> and jtse.id = #{taskSchoolEven.id}</if>
|
<if test="taskSchoolEven.createUser != null "> and jtse.create_user = #{taskSchoolEven.createUser}</if>
|
<if test="taskSchoolEven.images != null and taskSchoolEven.images != ''"> and jtse.images = #{taskSchoolEven.images}</if>
|
<if test="taskSchoolEven.name != null and taskSchoolEven.name != ''"> and bu.name like concat('%',#{taskSchoolEven.name},'%')</if>
|
<if test="taskSchoolEven.phone != null and taskSchoolEven.phone != ''"> and bu.phone like concat('%',#{taskSchoolEven.phone},'%')</if>
|
<if test="taskSchoolEven.remark != null and taskSchoolEven.remark != ''"> and jtse.remark like concat('%',#{taskSchoolEven.remark},'%')</if>
|
<if test="taskSchoolEven.hiddenDangerType != null and taskSchoolEven.hiddenDangerType != ''"> and jtse.hidden_danger_type = #{taskSchoolEven.hiddenDangerType}</if>
|
<if test="taskSchoolEven.type != null and taskSchoolEven.type != ''"> and jtse.type = #{taskSchoolEven.type}</if>
|
<if test="taskSchoolEven.isProblem != null and taskSchoolEven.isProblem != ''"> and jtse.is_problem = #{taskSchoolEven.isProblem}</if>
|
<if test="taskSchoolEven.isHandle != null and taskSchoolEven.isHandle != ''"> and jtse.is_handle = #{taskSchoolEven.isHandle}</if>
|
<if test="taskSchoolEven.isReporting != null and taskSchoolEven.isReporting != ''"> and jtse.is_reporting = #{taskSchoolEven.isReporting}</if>
|
<if test="taskSchoolEven.workImage != null and taskSchoolEven.workImage != ''"> and jtse.work_image = #{taskSchoolEven.workImage}</if>
|
<if test="taskSchoolEven.confirmFlag != null and taskSchoolEven.confirmFlag != ''"> and jtse.confirm_flag = #{taskSchoolEven.confirmFlag}</if>
|
<if test="taskSchoolEven.confirmTime != null "> and jtse.confirm_time = #{taskSchoolEven.confirmTime}</if>
|
<if test="taskSchoolEven.confirmUserId != null "> and jtse.confirm_user_id = #{taskSchoolEven.confirmUserId}</if>
|
<if test="taskSchoolEven.confirmUserName != null and taskSchoolEven.confirmUserName != ''"> and jtse.confirm_user_name = #{taskSchoolEven.confirmUserName}</if>
|
<if test="taskSchoolEven.confirmNotion != null and taskSchoolEven.confirmNotion != ''"> and jtse.confirm_notion = #{taskSchoolEven.confirmNotion}</if>
|
<if test="taskSchoolEven.houseCode != null and taskSchoolEven.houseCode != ''"> and jtse.house_code = #{taskSchoolEven.houseCode}</if>
|
<if test="taskSchoolEven.createTime != null "> and jtse.create_time = #{taskSchoolEven.createTime}</if>
|
<if test="taskSchoolEven.updateTime != null "> and jtse.update_time = #{taskSchoolEven.updateTime}</if>
|
|
<if test="isAdministrator==2">
|
<!-- 网格员及其他 -->
|
<if test="taskSchoolEven.roleType ==null and taskSchoolEven.roleName !='inhabitant' and taskSchoolEven.houseCode == null ">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and (
|
jg.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
</choose>
|
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and (
|
jg.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
</choose>
|
|
<if test="taskSchoolEven.confirmUserId != null ">
|
or jtse.confirm_user_id = #{taskSchoolEven.confirmUserId}
|
</if>
|
|
</if>
|
</if>
|
</where>
|
order by jtse.create_time desc
|
</select>
|
|
<select id="selectTaskSchoolEvenDetail" resultMap="taskSchoolEvenResultMap">
|
select
|
jtse.*,
|
br.town_name streetName,
|
jg.grid_name,
|
jda.aoi_name,
|
br.village_name communityName,
|
bu.name,
|
bu.phone,
|
jp.location,
|
jp.place_name,
|
jda.address_name as addressName
|
from jczz_task_school_even jtse
|
left join jczz_doorplate_address jda on jda.address_code = jtse.house_code
|
LEFT JOIN blade_user bu ON bu.id = jtse.create_user
|
LEFT JOIN jczz_place jp on jp.house_code= jtse.house_code
|
left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
left join blade_region br on br.code = jg.community_code
|
LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
<where>
|
<if test="taskSchoolEven.id != null "> and jtse.id = #{taskSchoolEven.id}</if>
|
<if test="taskSchoolEven.createUser != null "> and jtse.create_user = #{taskSchoolEven.createUser}</if>
|
<if test="taskSchoolEven.images != null and taskSchoolEven.images != ''"> and jtse.images = #{taskSchoolEven.images}</if>
|
<if test="taskSchoolEven.name != null and taskSchoolEven.name != ''"> and bu.name like concat('%',#{taskSchoolEven.name},'%')</if>
|
<if test="taskSchoolEven.phone != null and taskSchoolEven.phone != ''"> and bu.phone like concat('%',#{taskSchoolEven.phone},'%')</if>
|
<if test="taskSchoolEven.remark != null and taskSchoolEven.remark != ''"> and jtse.remark like concat('%',#{taskSchoolEven.remark},'%')</if>
|
<if test="taskSchoolEven.hiddenDangerType != null and taskSchoolEven.hiddenDangerType != ''"> and jtse.hidden_danger_type = #{taskSchoolEven.hiddenDangerType}</if>
|
<if test="taskSchoolEven.type != null and taskSchoolEven.type != ''"> and jtse.type = #{taskSchoolEven.type}</if>
|
<if test="taskSchoolEven.isProblem != null and taskSchoolEven.isProblem != ''"> and jtse.is_problem = #{taskSchoolEven.isProblem}</if>
|
<if test="taskSchoolEven.isHandle != null and taskSchoolEven.isHandle != ''"> and jtse.is_handle = #{taskSchoolEven.isHandle}</if>
|
<if test="taskSchoolEven.isReporting != null and taskSchoolEven.isReporting != ''"> and jtse.is_reporting = #{taskSchoolEven.isReporting}</if>
|
<if test="taskSchoolEven.workImage != null and taskSchoolEven.workImage != ''"> and jtse.work_image = #{taskSchoolEven.workImage}</if>
|
<if test="taskSchoolEven.confirmFlag != null and taskSchoolEven.confirmFlag != ''"> and jtse.confirm_flag = #{taskSchoolEven.confirmFlag}</if>
|
<if test="taskSchoolEven.confirmTime != null "> and jtse.confirm_time = #{taskSchoolEven.confirmTime}</if>
|
<if test="taskSchoolEven.confirmUserId != null "> and jtse.confirm_user_id = #{taskSchoolEven.confirmUserId}</if>
|
<if test="taskSchoolEven.confirmUserName != null and taskSchoolEven.confirmUserName != ''"> and jtse.confirm_user_name = #{taskSchoolEven.confirmUserName}</if>
|
<if test="taskSchoolEven.confirmNotion != null and taskSchoolEven.confirmNotion != ''"> and jtse.confirm_notion = #{taskSchoolEven.confirmNotion}</if>
|
<if test="taskSchoolEven.houseCode != null and taskSchoolEven.houseCode != ''"> and jtse.house_code = #{taskSchoolEven.houseCode}</if>
|
<if test="taskSchoolEven.createTime != null "> and jtse.create_time = #{taskSchoolEven.createTime}</if>
|
<if test="taskSchoolEven.updateTime != null "> and jtse.update_time = #{taskSchoolEven.updateTime}</if>
|
</where>
|
order by jtse.create_time desc
|
</select>
|
|
</mapper>
|