市北互联平台后端仓库
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.

93 lines
3.5 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">
4 years ago
<select id="selectByAddress" parameterType="java.lang.String" resultType="com.epmet.entity.IcResiCollectEntity">
select c.id from ic_resi_collect c
4 years ago
where c.address=#{address}
and c.DEL_FLAG='0'
</select>
4 years ago
<!-- 查询采集居民信息 -->
<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"/>
<collection property="list" ofType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO" column="id" select="selectMemberList"/>
</resultMap>
<select id="getCollectList" resultMap="getCollectListMap">
SELECT
c.id as id,
c.HOUSE_HOLDER_NAME AS houseHolderName,
c.ADDRESS AS address,
c.HOUSE_TYPE AS houseType,
c.TOTAL_RESI AS totalResi
FROM ic_resi_collect c
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>
4 years ago
ORDER BY c.CREATED_TIME DESC
</select>
<select id="selectMemberList" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO">
select
m.`NAME` AS memberName,
m.ID_NUM AS memberIdNum,
m.MOBILE AS memberMobile,
4 years ago
m.HE_SUAN_COUNT AS heSuanCount,
m.YMJZ AS ymjz,
m.DOMICILE_PLACE as domicilePlace,
m.WORK_PLACE as workPlace
4 years ago
from ic_resi_member m
where m.DEL_FLAG = 0
and m.IC_RESI_COLLECT_ID = #{id}
</select>
4 years ago
<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()
4 years ago
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>
</mapper>