huanghongfa
2021-07-02 ffcd3e31c9938eb256d616c80edbe1821e9fb2bf
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/SysUserInputDAO.java
@@ -3,6 +3,7 @@
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.community.ExportSpecialUserDTO;
import com.panzhihua.common.model.dtos.community.ExportUserDTO;
import com.panzhihua.common.model.dtos.user.EexcelUserDTO;
import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
@@ -63,6 +64,7 @@
    @Select("<script> " +
            "SELECT " +
            " t.id, " +
            " t.`name`, " +
            "CASE " +
            " IF " +
@@ -119,21 +121,10 @@
    @Select("select a.id,a.community_id,a.area_name,address_detail from com_mng_struct_area a where a.community_id=#{communityId}")
    List<ComMngStructAreaVO> selectComMngStructArea(@Param("communityId") Long communityId);
    @Select("" +
            "SELECT " +
            " t1.house_code houseCode, " +
            " t1.house_name houseName, " +
            " t1.square, " +
            " t1.state " +
            "FROM " +
            " sys_user_input t  " +
            " LEFT JOIN com_mng_struct_house t1 ON t.house_code = t1.house_code " +
            " WHERE" +
            " t.id_card = #{idCard}")
    List<ComMngStructHouseVO> selectUserHouseList(@Param("idCard") String idCard);
    @Select("<script> " +
            "SELECT " +
            "SELECT * FROM ( "+
            " SELECT " +
            " t.id, " +
            " t.`name`, " +
            "CASE " +
            " IF " +
@@ -166,12 +157,15 @@
            " IF " +
            "  ( t.old_people = 1, '特服家庭,', '' ), " +
            " IF " +
            "  ( t.key_personnel = 1, '重点人员,', '' )  " +
            "  ( t.key_personnel = 1, '重点人员,', '' ),  " +
            "  IFNULL(t.tags,'')  " +
            " ) tags,  " +
            " t2.house_name  as address, " +
            " t.create_at  as createAt " +
            "FROM " +
            " sys_user_input t " +
            " LEFT JOIN com_mng_struct_area t1 ON t.area_id = t1.id  " +
            " LEFT JOIN com_mng_struct_house t2 ON t.house_code = t2.house_code " +
            "WHERE " +
            " t.community_id = #{pageInputUserDTO.communityId}"+
            " AND " +
@@ -185,16 +179,31 @@
            "<if test='pageInputUserDTO.areaName != null and pageInputUserDTO.areaName.trim() != &quot;&quot;'>" +
            "AND t1.`area_name` like concat(#{pageInputUserDTO.areaName},'%')   " +
            " </if> " +
            "<if test='pageInputUserDTO.tags != null and pageInputUserDTO.tags.trim() != &quot;&quot;'>" +
            " and t.tags like concat('%',#{pageInputUserDTO.tags},'%')  " +
            " </if> " +
            " group by t.id_card "+
            " ) tt  WHERE 1=1 "+
            "<if test='pageInputUserDTO.tags != null and pageInputUserDTO.tags.trim() != &quot;&quot;'>" +
            " and tt.tags like concat('%',#{pageInputUserDTO.tags},'%')  " +
            " </if> " +
            "</script>")
    IPage<InputUserInfoVO> specialInputUser(Page page, @Param("pageInputUserDTO") PageInputUserDTO pageInputUserDTO);
    @Select("" +
            "SELECT " +
            " t1.house_code houseCode, " +
            " t1.house_name houseName, " +
            " t1.square, " +
            " t1.state " +
            "FROM " +
            " sys_user_input t  " +
            " LEFT JOIN com_mng_struct_house t1 ON t.house_code = t1.house_code " +
            " WHERE" +
            " t.id_card = #{idCard}")
    List<ComMngStructHouseVO> selectUserHouseList(@Param("idCard") String idCard);
    @Select("<script> " +
            "SELECT  " +
            "u.id 'order', " +
            "c.`area_name` areaName, "+
            "u.door_number doorNumber, " +
            "if(u.is_rent=1,'租住','自主')isRent, " +
            "u.name, " +
@@ -216,10 +225,11 @@
            "if(u.lowIncome_people=1,'是','否') lowIncomePeople, " +
            "if(u.old_people=1,'是','否') oldPeople, " +
            "if(u.special_service_family=1,'是','否') specialServiceFamily, " +
            "if(u.key_personnel=1,'是','否') keyPersonnel " +
            "if(u.key_personnel=1,'是','否') keyPersonnel, " +
            "u.tags " +
            "FROM " +
            " sys_user_input u " +
            " LEFT JOIN sys_user su on su.id_card=u.id_card"+
            " where u.community_id=#{exportUserDTO.communityId} " +
            "<if test='exportUserDTO.areaName != null and exportUserDTO.areaName.trim() != &quot;&quot;'>" +
            " JOIN com_mng_struct_area c ON u.area_id = c.id  " +
            " </if> " +
@@ -229,7 +239,6 @@
            "<if test='exportUserDTO.areaName != null and exportUserDTO.areaName.trim() != &quot;&quot;'>" +
            "AND c.`area_name` like concat(#{exportUserDTO.areaName},'%')   " +
            " </if> " +
            " where u.community_id=#{exportUserDTO.communityId} " +
            "<if test='exportUserDTO.phone != null and exportUserDTO.phone.trim() != &quot;&quot;'>" +
            "AND u.phone like concat(#{exportUserDTO.phone},'%') " +
            " </if> " +
@@ -238,4 +247,62 @@
            " </if> " +
            "</script>")
    List<EexcelUserDTO> selectExport(@Param("exportUserDTO") ExportUserDTO exportUserDTO);
    @Select("<script> " +
            "SELECT  " +
            "u.id 'order', " +
            "c.`area_name` areaName, "+
            "u.door_number doorNumber, " +
            "if(u.is_rent=1,'租住','自主')isRent, " +
            "u.name, " +
            "u.nation, " +
            "case u.political_outlook when 1 then '党员'  when 2 then '团员' else '群众' end politicalOutlook, " +
            "if(u.marital_status=1,'已婚','未婚')maritalStatus, " +
            "u.phone, " +
            "u.education, " +
            "u.id_card, " +
            "u.company, " +
            "u.residence, " +
            "if(u.is_panzhiHua=1,'是','否') isPanZhiHua, " +
            "u.situation, " +
            "if(is_contact=1,'是','否') isContact, " +
            "if(u.major=1,'是','否') major, " +
            "if(u.soldier=1,'是','否') soldier, " +
            "if(u.disability=1,'是','否') disability, " +
            "if(u.lowIncome_households=1,'是','否') lowIncomeHouseholds, " +
            "if(u.lowIncome_people=1,'是','否') lowIncomePeople, " +
            "if(u.old_people=1,'是','否') oldPeople, " +
            "if(u.special_service_family=1,'是','否') specialServiceFamily, " +
            "if(u.key_personnel=1,'是','否') keyPersonnel, " +
            "u.tags " +
            "FROM " +
            " sys_user_input u " +
            " JOIN com_mng_struct_area c ON u.area_id = c.id  " +
            " where u.community_id=#{exportSpecialUserDTO.communityId} " +
            "<if test='exportSpecialUserDTO.areaName != null and exportSpecialUserDTO.areaName.trim() != &quot;&quot;'>" +
            "AND c.`area_name` like concat(#{exportUserDTO.areaName},'%')   " +
            " </if> " +
            "<if test='exportSpecialUserDTO.name != null and exportSpecialUserDTO.name.trim() != &quot;&quot;'>" +
            " and u.`name` like concat(#{exportSpecialUserDTO.name},'%')   " +
            " </if> " +
            "<if test='exportSpecialUserDTO.name != null and exportSpecialUserDTO.name.trim() != &quot;&quot;'>" +
            " and u.`name` like concat(#{exportSpecialUserDTO.name},'%')   " +
            " </if> " +
            "<if test='exportSpecialUserDTO.tags != null and exportSpecialUserDTO.tags.trim() != &quot;&quot;'>" +
            " CONCAT( " +
            " IF " +
            "  ( t.soldier = 1, '军人,', '' ), " +
            " IF " +
            "  ( t.lowIncome_households = 1, '低保户,', '' ), " +
            " IF " +
            "  ( t.lowIncome_people = 1, '低收入,', '' ), " +
            " IF " +
            "  ( t.old_people = 1, '特服家庭,', '' ), " +
            " IF " +
            "  ( t.key_personnel = 1, '重点人员,', '' ),  " +
            "  IFNULL(t.tags,'')  " +
            " ) like concat(#{exportSpecialUserDTO.tags},'%')"+
            " </if> " +
            "</script>")
    List<EexcelUserDTO> specialUserExport(@Param("exportSpecialUserDTO") ExportSpecialUserDTO exportSpecialUserDTO);
}