| | |
| | | LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.is_deleted = 0 |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | <where> |
| | | <if test="household.userId!=null"> |
| | | AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id = |
| | |
| | | </if> |
| | | <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 test="household.roleName != null and household.roleName != ''"> |
| | | <if test="household.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jhs.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jhs.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="household.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> |
| | | </when> |
| | | <otherwise> |
| | | and jg.community_code in ('') |
| | | <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 |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <!-- <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>--> |
| | | <if test="household.building!=null and household.building!=''"> |
| | | and jhs.building like concat(#{household.building},'%') |
| | | </if> |
| | |
| | | |
| | | <select id="statistics" resultType="java.lang.Integer"> |
| | | SELECT |
| | | count( 1 ) |
| | | count(1) |
| | | FROM |
| | | jczz_household jh |
| | | LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code |
| | | LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.is_deleted = 0 |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | <where> |
| | | <if test="neiCode != null and neiCode != ''"> |
| | | and jda.nei_code = #{neiCode} |
| | | <if test="household.neiCode != null and household.neiCode != ''"> |
| | | and jda.nei_code = #{household.neiCode} |
| | | </if> |
| | | <if test="userId != null"> |
| | | AND jh.house_code IN ( |
| | | SELECT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid_range jgr |
| | | LEFT JOIN jczz_grid jg ON jg.id = jgr.grid_id |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | WHERE |
| | | jg.is_deleted = 0 |
| | | AND jgm.user_id = #{userId} ) |
| | | <if test="household.confirmFlag != null and household.confirmFlag != ''"> |
| | | and jh.confirm_flag = #{household.confirmFlag} |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="household.roleName != null and household.roleName != ''"> |
| | | <if test="household.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jhs.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jhs.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="household.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> |
| | | </when> |
| | | <otherwise> |
| | | <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 |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | and jh.is_deleted = 0 |
| | | and jh.confirm_flag = 0 |
| | | </where> |
| | | </select> |
| | | |