罗元桥
2021-06-30 2ca2e51f3a838252ed9cd8989f4f5d6fe35d468c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.grid.ComMngVillageListAppDTO;
import com.panzhihua.common.model.dtos.grid.PageComMngVillageBuildHouseAppDTO;
import com.panzhihua.common.model.dtos.grid.admin.ComMngPopulationListDTO;
import com.panzhihua.common.model.vos.community.ComMngVillageTotalVO;
import com.panzhihua.common.model.vos.community.ComMngVillageVO;
import com.panzhihua.common.model.vos.grid.ComMngVillageBuildingHouseVO;
import com.panzhihua.common.model.vos.grid.ComMngVillageBuildingVO;
import com.panzhihua.common.model.vos.grid.PageComMngVillageVO;
import com.panzhihua.common.model.vos.grid.PopulationDetailVO;
import com.panzhihua.service_community.model.dos.ComMngVillageDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
 
/**
 * @author: llming
 * @description: 街道
 **/
@Mapper
public interface ComActVillageDAO extends BaseMapper<ComMngVillageDO> {
 
    @Select("select count(id) as houseTotal" +
            ",(select count(DISTINCT floor) from com_mng_population_house where village_id = #{villageId}) as floorTotal" +
            ",(select count(id) from com_mng_population where village_id = #{villageId}) as populationTotal" +
            ",(select count(id) from com_mng_car where area_id = #{villageId}) as carTotal" +
            " from com_mng_population_house where village_id = #{villageId}")
    ComMngVillageVO getStatisticsCount(@Param("villageId") Long villageId);
 
    @Select("select count(village_id) as villageTotal" +
            ",(select count(village_id) from com_mng_village where community_id = #{communityId} and type = 1) as townTotal" +
            ",(select count(village_id) from com_mng_village where community_id = #{communityId} and type = 2) as countrysideTotal" +
            " from com_mng_village where community_id = #{communityId}" )
    ComMngVillageTotalVO getVillageStatisticsCount(@Param("communityId") Long communityId);
 
    @Select("select village_id,alley,house_num,group_at,type,address,update_at from com_mng_village where village_id = #{villageId}")
    ComMngVillageVO getVillageById(@Param("villageId") Long villageId);
 
    @Select("<script> " +
            "SELECT " +
            " village_id, " +
            " `name` AS userName, " +
            " build_sum, " +
            " address, " +
            " create_at as createAt, " +
            " lng, " +
            " 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 where cmv.community_id = #{villageListAppDTO.communityId} " +
            "<if test='villageListAppDTO.name != null and villageListAppDTO.name != &quot;&quot;'>" +
            " and cmv.name like concat(#{villageListAppDTO.name},'%')"+
            " </if> " +
            "<if test='villageListAppDTO.sortColumns!=null'>" +
            " ORDER BY ${villageListAppDTO.sortColumns} ${villageListAppDTO.sortType} " +
            " </if>" +
            " </script>")
    IPage<PageComMngVillageVO> getGridVillageList(Page page, @Param("villageListAppDTO") ComMngVillageListAppDTO villageListAppDTO);
 
    @Select("SELECT DISTINCT " +
            " village_id," +
            " floor, " +
            " unit_no  " +
            "FROM " +
            " com_mng_population_house AS cmph  " +
            "WHERE " +
            " village_id = #{villageId}")
    List<ComMngVillageBuildingVO> getGridVillageBuildingList(@Param("villageId") Long villageId);
}