From 764d883b5ea3bdc06abbec548b6df0511e567978 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Tue, 03 Sep 2024 09:46:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/binlog' into binlog

---
 src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml |  201 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 201 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
new file mode 100644
index 0000000..5a71a03
--- /dev/null
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
@@ -0,0 +1,201 @@
+<?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.TaskResidencePermitApplyMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="taskResidencePermitApplyResultMap"
+               type="org.springblade.modules.task.vo.TaskResidencePermitApplyVO">
+    </resultMap>
+
+
+    <select id="selectTaskResidencePermitApplyPage" resultMap="taskResidencePermitApplyResultMap">
+        select
+        jtrpa.*,
+        br.town_name streetName,
+        case
+        when TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) &lt; 18 then 2
+        when TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) &gt;= 18 then 1
+        end as minors,
+        jg.grid_name,
+        jda.aoi_name,
+        br.village_name communityName,
+        jda.address_name as addressName
+        from jczz_task_residence_permit_apply jtrpa
+        left join jczz_doorplate_address jda on jda.address_code = jtrpa.house_code
+        LEFT JOIN jczz_house jh on jh.house_code=jtrpa.house_code
+        left join jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
+        left join blade_region br on br.code = jg.community_code
+        <where>
+            and jtrpa.is_deleted = 0
+            <if test="residen.minors!=null and residen.minors ==2">
+                and TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) &lt; 18
+            </if>
+            <if test="residen.minors!=null and residen.minors ==1">
+                and TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) &gt;= 18
+            </if>
+            <if test="residen.communityCode != null  and residen.communityCode != ''"> and jg.community_code = #{residen.communityCode}</if>
+
+            <if test="residen.id != null ">and jtrpa.id = #{residen.id}</if>
+            <if test="residen.name != null  and residen.name != ''">and jtrpa.name like CONCAT('%',#{residen.name},'%')</if>
+            <if test="residen.phone != null  and residen.phone != ''">and jtrpa.phone like CONCAT('%',#{residen.phone},'%')</if>
+            <if test="residen.idCard != null  and residen.idCard != ''">and jtrpa.id_card like CONCAT('%',#{residen.idCard},'%')</if>
+            <if test="residen.address != null  and residen.address != ''">and jtrpa.address like CONCAT('%',#{residen.address},'%')</if>
+            <if test="residen.houseCode != null  and residen.houseCode != ''">and jtrpa.house_code = #{residen.houseCode}</if>
+            <if test="residen.taskId != null ">and jtrpa.task_id = #{residen.taskId}</if>
+
+            <if test="residen.startTime != null and residen.startTime != '' and residen.endTime != null and residen.endTime != '' ">
+                AND jtrpa.create_time BETWEEN #{residen.startTime} and #{residen.endTime}
+            </if>
+            <if test="residen.updateTime != null ">and jtrpa.update_time = #{residen.updateTime}</if>
+            <if test="residen.createUser != null ">and jtrpa.create_user = #{residen.createUser}</if>
+            <if test="residen.houseRentalId != null ">and jtrpa.house_rental_id = #{residen.houseRentalId}</if>
+            <if test="residen.isDeleted != null ">and jtrpa.is_deleted = #{residen.isDeleted}</if>
+            <if test="residen.remak != null  and residen.remak != ''">and jtrpa.remak = #{residen.remak}</if>
+            <if test="residen.gridCode != null  and residen.gridCode != ''"> and jtrpa.grid_code = #{residen.gridCode}</if>
+            <if test="residen.updateUser != null "> and jtrpa.update_user = #{residen.updateUser}</if>
+            <if test="residen.confirmUserId != null "> and jtrpa.confirm_user_id = #{residen.confirmUserId}</if>
+            <if test="residen.confirmTime != null "> and jtrpa.confirm_time = #{residen.confirmTime}</if>
+            <if test="residen.confirmFlag != null "> and jtrpa.confirm_flag = #{residen.confirmFlag}</if>
+            <if test="residen.confirmNotion != null  and residen.confirmNotion != ''"> and jtrpa.confirm_notion = #{residen.confirmNotion}</if>
+            <if test="residen.jwGridCode != null  and residen.jwGridCode != ''"> and jtrpa.jw_grid_code = #{residen.jwGridCode}</if>
+
+            <if test="isAdministrator==2">
+                <!-- 网格员及其他 -->
+                <if test="residen.roleType ==null and residen.roleName !='inhabitant'">
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and (
+                            jg.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            or
+                            jtrpa.jw_grid_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="residen.confirmUserId != null ">
+                        or jtrfr.confirm_user_id = #{residen.confirmUserId}
+                    </if>
+
+                </if>
+            </if>
+        </where>
+        order by jtrpa.create_time desc
+    </select>
+
+
+    <select id="getCount" resultType="java.lang.Integer">
+        SELECT count(1)
+        from jczz_task_residence_permit_apply jtrpa
+        left join jczz_doorplate_address jda on jda.address_code = jtrpa.house_code
+        LEFT JOIN jczz_house jh on jh.house_code=jtrpa.house_code
+        left join jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
+        left join blade_region br on br.code = jg.community_code
+        <where>
+            and jtrpa.is_deleted = 0
+            <if test="neiCode != null  and neiCode != ''"> and jg.community_code = #{neiCode}</if>
+            <if test="status != null  and status != ''"> and jtrpa.confirm_flag = #{status}</if>
+
+           <if test="isAdministrator==2">
+<!--                <if test="residen.roleType ==null ">-->
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and (
+                            jg.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            or
+                            jtrpa.jw_grid_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>-->
+            </if>
+        </where>
+
+    </select>
+
+    <resultMap type="org.springblade.modules.task.dto.TaskResidencePermitApplyDTO"
+               id="TaskResidencePermitApplyDTOResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="phone" column="phone"/>
+        <result property="idCard" column="id_card"/>
+        <result property="address" column="address"/>
+        <result property="houseCode" column="house_code"/>
+        <result property="taskId" column="task_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createUser" column="create_user"/>
+        <result property="houseRentalId" column="house_rental_id"/>
+        <result property="isDeleted" column="is_deleted"/>
+        <result property="remak" column="remak"/>
+        <result property="gridCode" column="grid_code"/>
+        <result property="updateUser" column="update_user"/>
+        <result property="confirmUserId" column="confirm_user_id"/>
+        <result property="confirmTime" column="confirm_time"/>
+        <result property="confirmFlag" column="confirm_flag"/>
+        <result property="confirmNotion" column="confirm_notion"/>
+        <result property="jwGridCode" column="jw_grid_code"/>
+    </resultMap>
+
+    <sql id="selectTaskResidencePermitApply">
+        select
+            id,
+            name,
+            phone,
+            id_card,
+            address,
+            house_code,
+            task_id,
+            create_time,
+            update_time,
+            create_user,
+            house_rental_id,
+            is_deleted,
+            remak,
+            grid_code,
+            update_user,
+            confirm_user_id,
+            confirm_time,
+            confirm_flag,
+            confirm_notion,
+            jw_grid_code
+        from
+            jczz_task_residence_permit_apply
+    </sql>
+
+
+
+</mapper>

--
Gitblit v1.9.3