forked from rongchao/epmet-cloud-rizhao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
6.6 KiB
174 lines
6.6 KiB
<?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.epmet.dao.IcResiCollectDao">
|
|
|
|
<select id="selectByAddress" parameterType="java.lang.String" resultType="com.epmet.entity.IcResiCollectEntity">
|
|
select c.id,c.CUSTOMER_ID from ic_resi_collect c
|
|
where c.address=#{address}
|
|
and c.DEL_FLAG='0'
|
|
</select>
|
|
|
|
<!-- 查询采集居民信息 -->
|
|
<resultMap id="getCollectListMap" type="com.epmet.dto.result.CollectListResultDTO">
|
|
<result property="houseHolderName" column="houseHolderName"/>
|
|
<result property="id" column="id"/>
|
|
<result property="address" column="address"/>
|
|
<result property="houseType" column="houseType"/>
|
|
<result property="totalResi" column="totalResi"/>
|
|
<result property="homeId" column="homeId"/>
|
|
<result property="checkState" column="checkState"/>
|
|
<result property="agencyId" column="agencyId"/>
|
|
<result property="gridId" column="gridId"/>
|
|
<result property="domicilePlace" column="domicilePlace"></result>
|
|
<collection property="list" ofType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO" column="{id=id,domicilePlace=domicile_place}" select="selectMemberList"/>
|
|
</resultMap>
|
|
<select id="getCollectList" resultMap="getCollectListMap">
|
|
SELECT
|
|
distinct c.id as id,
|
|
c.HOUSE_HOLDER_NAME AS houseHolderName,
|
|
c.ADDRESS AS address,
|
|
c.HOUSE_TYPE AS houseType,
|
|
c.TOTAL_RESI AS totalResi,
|
|
c.HOME_ID as homeId,
|
|
c.CHECK_STATE as checkState,
|
|
c.AGENCY_ID as agencyId,
|
|
c.GRID_ID as gridId,
|
|
#{domicilePlace} as domicile_place
|
|
FROM ic_resi_collect c
|
|
left join ic_resi_member m on(c.id=m.IC_RESI_COLLECT_ID and m.del_flag='0')
|
|
WHERE c.DEL_FLAG = 0
|
|
<if test='orgId != null and orgId != "" '>
|
|
AND CONCAT(c.PIDS,':',c.AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
|
|
</if>
|
|
<if test='address != null and address != "" '>
|
|
AND c.ADDRESS LIKE CONCAT('%',#{address},'%')
|
|
</if>
|
|
<if test='startDate != null and startDate != "" '>
|
|
AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') >= #{startDate}
|
|
</if>
|
|
<if test='endDate != null and endDate != "" '>
|
|
AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate}
|
|
</if>
|
|
<if test='id != null and id != "" '>
|
|
AND c.id=#{id}
|
|
</if>
|
|
<if test='domicilePlace != null and domicilePlace != "" '>
|
|
AND m.DOMICILE_PLACE LIKE CONCAT('%',#{domicilePlace},'%')
|
|
</if>
|
|
<if test='checkState != null and checkState != "" '>
|
|
AND c.CHECK_STATE = #{checkState}
|
|
</if>
|
|
<if test='houseHolderName != null and houseHolderName != "" '>
|
|
AND c.HOUSE_HOLDER_NAME like concat('%', #{houseHolderName},'%')
|
|
</if>
|
|
ORDER BY c.CREATED_TIME DESC
|
|
</select>
|
|
<select id="selectMemberList" parameterType="map" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO">
|
|
select
|
|
m.`NAME` AS memberName,
|
|
m.ID_NUM AS memberIdNum,
|
|
m.MOBILE AS memberMobile,
|
|
m.HE_SUAN_COUNT AS heSuanCount,
|
|
m.YMJZ AS ymjz,
|
|
m.DOMICILE_PLACE as domicilePlace,
|
|
m.DOMICILE_PLACE_CODE as domicilePlaceCode,
|
|
m.DOMICILE_PLACE_CODE_PATH as domicilePlaceCodePath,
|
|
m.WORK_PLACE as workPlace,
|
|
m.REMARK as remark,
|
|
m.RELATIONSHIP as relationship,
|
|
m.FACE_IMG as faceImg
|
|
from ic_resi_member m
|
|
where m.DEL_FLAG = 0
|
|
and m.IC_RESI_COLLECT_ID = #{id}
|
|
<if test='domicilePlace != null and domicilePlace != "" '>
|
|
AND m.DOMICILE_PLACE LIKE CONCAT('%',#{domicilePlace},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<update id="updateRec" parameterType="map">
|
|
UPDATE ic_resi_collect
|
|
SET
|
|
<if test="houseType != null and houseType !=''">
|
|
HOUSE_TYPE = #{houseType},
|
|
</if>
|
|
<if test="houseHolderName != null and houseHolderName !=''">
|
|
HOUSE_HOLDER_NAME = #{houseHolderName},
|
|
</if>
|
|
<if test="totalResi != null and totalResi !=''">
|
|
TOTAL_RESI = #{totalResi},
|
|
</if>
|
|
<if test="updatedBy != null and updatedBy !=''">
|
|
UPDATED_BY = #{updatedBy},
|
|
</if>
|
|
UPDATED_TIME = NOW(),
|
|
CHECK_STATE = '0'
|
|
WHERE
|
|
id = #{id}
|
|
</update>
|
|
|
|
<select id="selectLastSubmitId" parameterType="map" resultType="java.lang.String">
|
|
SELECT
|
|
m.IC_RESI_COLLECT_ID
|
|
FROM
|
|
ic_resi_member m
|
|
WHERE
|
|
m.DEL_FLAG = '0'
|
|
AND m.CUSTOMER_ID = #{customerId}
|
|
AND ( m.CREATED_BY = #{userId} OR m.UPDATED_BY = #{userId} )
|
|
ORDER BY
|
|
m.UPDATED_TIME DESC
|
|
</select>
|
|
<select id="getCollectPage" resultType="com.epmet.dto.result.CollectPageListDTO">
|
|
select tot.*
|
|
from (select id,
|
|
'resi' as type,
|
|
'居民登记' as title,
|
|
ADDRESS,
|
|
CHECK_STATE,
|
|
|
|
case CHECK_STATE
|
|
when '0' then '待审核'
|
|
when '1' then '审核不通过'
|
|
when '2' then '审核通过'
|
|
else ''
|
|
end as checkStateName,
|
|
CHECK_REASON,
|
|
CREATED_TIME
|
|
from ic_resi_collect
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
and ( UPDATED_BY = #{userId} OR UPDATED_BY = #{userId} )
|
|
union
|
|
select id,
|
|
'visitor' as type,
|
|
'访客登记' as title,
|
|
ADDRESS,
|
|
'2' as checkState,
|
|
'审核通过' as checkStateName,
|
|
'' as checkReason,
|
|
CREATED_TIME
|
|
from ic_resi_collect_visitor
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
and ( UPDATED_BY = #{userId} OR UPDATED_BY = #{userId} ))tot
|
|
order by tot.CREATED_TIME desc
|
|
</select>
|
|
|
|
<select id="getHouseDetailByCollect" resultType="com.epmet.dto.result.CollectHouseInfoResultDTO"
|
|
parameterType="com.epmet.dto.form.IcResiCollectGetDetailFormDTO">
|
|
select
|
|
concat(VILLAGE_NAME,'-',BUILD_NAME) label,
|
|
VILLAGE_ID as neighborHoodId,
|
|
VILLAGE_NAME as neighborHoodName,
|
|
BUILD_ID as buildingId,
|
|
BUILD_NAME as buildName,
|
|
UNIT_ID as buildingUnitId,
|
|
UNIT_NAME as buildingUnitName,
|
|
HOME_NAME as doorName,
|
|
HOUSE_HOLDER_NAME as ownerName
|
|
from ic_resi_collect
|
|
where DEL_FLAG = 0
|
|
and ID = #{id}
|
|
</select>
|
|
</mapper>
|
|
|