| | |
| | | FROM |
| | | jczz_household jh |
| | | LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code |
| | | WHERE |
| | | jda.nei_code = #{code} |
| | | AND jh.is_deleted = 0 |
| | | and jda.doorplate_type = '户室牌' |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | ) a |
| | | GROUP BY |
| | | a.gender |
| | | <where> |
| | | jda.nei_code in |
| | | <foreach collection="communityCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | AND jh.is_deleted = 0 |
| | | and jda.doorplate_type = '户室牌' |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | ) a |
| | | GROUP BY |
| | | a.gender |
| | | </where> |
| | | |
| | | </select> |
| | | <select id="getHouseHoldStatisticsAge" resultType="java.util.Map"> |
| | | |
| | |
| | | count(1) as number FROM |
| | | jczz_household jh |
| | | LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code |
| | | WHERE |
| | | jda.nei_code = #{code} |
| | | and jda.doorplate_type = '户室牌' |
| | | AND jh.is_deleted = 0 |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | distinct jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <where> |
| | | jda.nei_code in |
| | | <foreach collection="communityCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | and jda.doorplate_type = '户室牌' |
| | | AND jh.is_deleted = 0 |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | distinct jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | </where> |
| | | |
| | | GROUP BY age |
| | | </select> |
| | | |