linwei
2024-01-19 494aeb58eb885b40ab2fdb083aaa79007bb79ae2
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -46,8 +46,18 @@
        <if test="gridman.townName!=null and gridman.townName!=''">
            and br.town_name like concat('%',#{gridman.townName},'%')
        </if>
        <if test="gridman.regionCode != null and gridman.regionCode !='' ">
            and jg.community_code like concat('%',#{gridman.regionCode},'%')
        <if test="isAdministrator==2">
            <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>
                <otherwise>
                    and jg.community_code in ('')
                </otherwise>
            </choose>
        </if>
    </select>
@@ -68,11 +78,11 @@
    <select id="getGridStatistics" resultType="java.lang.Integer">
        SELECT count(1) number
        FROM jczz_gridman jgm
        LEFT JOIN jczz_grid jg  ON jg.id = jgm.grid_id
        LEFT JOIN jczz_grid jg ON jg.id = jgm.grid_id
        WHERE jg.community_code = #{code}
        AND jg.is_deleted = 0
        <if test="userId!=null and roleType == '1'">
          and jgm.user_id= #{userId}
            and jgm.user_id= #{userId}
        </if>
    </select>
@@ -147,4 +157,16 @@
        and jgm.user_id = #{userId}
        limit 1
    </select>
    <select id="getGridManByCode" resultType="org.springblade.modules.system.entity.User">
SELECT
   *
FROM
   blade_user bu
   LEFT JOIN jczz_gridman jgm ON bu.id = jgm.user_id
   LEFT JOIN jczz_grid jg ON jgm.grid_id = jg.id
WHERE
   jg.community_code IN ( SELECT jg.community_code FROM jczz_grid jg LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id WHERE jgr.house_code = #{houseCode} )
   AND bu.is_deleted = 0
    </select>
</mapper>