<?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="com.panzhihua.service_community.dao.ComActVillageDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComMngVillageDO">
|
<id column="village_id" property="villageId" />
|
<result column="street_id" property="streetId" />
|
<result column="community_id" property="communityId" />
|
<result column="alley" property="alley" />
|
<result column="house_num" property="houseNum" />
|
<result column="group_at" property="groupAt" />
|
<result column="type" property="type" />
|
<result column="name" property="name" />
|
<result column="build_sum" property="buildSum" />
|
<result column="build_year" property="buildYear" />
|
<result column="build_type" property="buildType" />
|
<result column="property" property="property" />
|
<result column="developers" property="developers" />
|
<result column="user_sum" property="userSum" />
|
<result column="village_images" property="villageImages" />
|
<result column="address" property="address" />
|
<result column="path" property="path" />
|
<result column="lng" property="lng" />
|
<result column="lat" property="lat" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
village_id, street_id, community_id, alley, house_num, group_at, type, name, build_sum, build_year, build_type, property, developers, user_sum, village_images, address, path, lng, lat, create_at, update_at
|
</sql>
|
|
<select id="getGridVillageListApp" resultType="com.panzhihua.common.model.vos.grid.PageComMngVillageVO">
|
SELECT cmv.village_id, cmv.`name` AS userName, IFNULL((select count(id) from com_mng_building where village_id = cmv.village_id),0) as buildSum, address,
|
cmv.create_at as createAt, cmv.lng, cmv.lat,
|
( SELECT count( id ) FROM com_mng_population WHERE village_id = cmv.village_id ) AS userSum,
|
( SELECT count( id ) FROM com_mng_population_house WHERE village_id = cmv.village_id ) AS houseNum,
|
( SELECT count( id ) FROM com_mng_population WHERE village_id = cmv.village_id AND out_or_local = 1 ) AS registerNum,
|
( SELECT count( id ) FROM com_mng_population WHERE village_id = cmv.village_id AND is_rent = 2 ) AS rentNum
|
FROM com_mng_village AS cmv
|
LEFT JOIN event_grid_data as egd on egd.grid_community_id = cmv.community_id
|
where 1=1
|
<if test='villageListAppDTO.gridId != null'>
|
and egd.id = #{villageListAppDTO.gridId}
|
</if>
|
<if test='villageListAppDTO.address != null and villageListAppDTO.address != ""'>
|
and cmv.address like concat(#{villageListAppDTO.address},'%')
|
</if>
|
<if test='villageListAppDTO.alley != null and villageListAppDTO.alley != ""'>
|
and cmv.alley like concat(#{villageListAppDTO.alley},'%')
|
</if>
|
<if test='villageListAppDTO.houseNum != null and villageListAppDTO.houseNum != ""'>
|
and cmv.house_num like concat(#{villageListAppDTO.houseNum},'%')
|
</if>
|
<if test='villageListAppDTO.groupAt != null and villageListAppDTO.groupAt != ""'>
|
and cmv.group_at like concat(#{villageListAppDTO.groupAt},'%')
|
</if>
|
<if test='villageListAppDTO.name != null and villageListAppDTO.name != ""'>
|
and cmv.name like concat(#{villageListAppDTO.name},'%')
|
</if>
|
<if test='villageListAppDTO.sortColumns!=null'>
|
ORDER BY ${villageListAppDTO.sortColumns} ${villageListAppDTO.sortType}
|
</if>
|
</select>
|
|
</mapper>
|