hhhyyq
2021-03-17 45e45ff70ba7cd7889f76cbf489d6bf012a4f84d
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
package com.panzhihua.service_community.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.common.model.dtos.community.ExcelHouseDTO;
import com.panzhihua.service_community.model.dos.ComMngStructHouseDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;
 
import java.util.List;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 房屋
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-12-14 17:09
 **/
@Mapper
public interface ComMngStructHouseDAO extends BaseMapper<ComMngStructHouseDO> {
    @Select("{call smart_life.removeByParentCode(#{areaCode,jdbcType=VARCHAR,mode=IN})}")
    @Options(statementType = StatementType.CALLABLE)
    int batchDeleteHouse(String areaCode);
 
    @Select("<script> " +
            " SELECT REPLACE " +
            " ( h3.house_name, h4.house_name, '' ) build, " +
            " REPLACE ( h2.house_name, h3.house_name, '' ) unit, " +
            " REPLACE ( h1.house_name, h2.house_name, '' ) floor, " +
            " REPLACE ( h.house_name, h1.house_name, '' ) room, " +
            " h.square, " +
            "CASE " +
            "  h.state  " +
            "  WHEN 1 THEN " +
            "  '自住'  " +
            "  WHEN 2 THEN " +
            "  '租住'  " +
            "  WHEN 3 THEN " +
            "  '商用' ELSE '未知'  " +
            " END AS state, " +
            " su.NAME username, " +
            " su.phone  " +
            "FROM " +
            " com_mng_struct_house h " +
            " LEFT JOIN com_mng_struct_house h1 ON h.parent_code = h1.house_code " +
            " LEFT JOIN com_mng_struct_house h2 ON h1.parent_code = h2.house_code " +
            " LEFT JOIN com_mng_struct_house h3 ON h2.parent_code = h3.house_code " +
            " LEFT JOIN com_mng_struct_house h4 ON h3.parent_code = h4.house_code " +
            " LEFT JOIN com_mng_struct_house_user hu ON h.house_code = hu.house_code " +
            " LEFT JOIN sys_user su ON hu.user_id = su.user_id  " +
            "WHERE " +
            " h.house_code LIKE concat(#{houseCode},'%')  " +
            " AND h.type = 5" +
            " ORDER BY h.house_code ASC " +
            "</script> ")
    List<ExcelHouseDTO> houseExport(String houseCode);
}