<?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.zzg.system.mapper.state.StateSettlementMapper">
|
<select id="listSettleDetail" parameterType="com.zzg.system.domain.bo.SettlementDetailBO"
|
resultType="com.zzg.system.domain.vo.SettlementDetailVO">
|
SELECT t1.ID AS stateHouseholdId,
|
t1.house_using_type AS houseUsingType,
|
<!-- t1.street AS street,-->
|
<!-- t1.street as projectStreet,-->
|
<!-- 为了前端不改接口这里直接 as成旧字段-->
|
t1.belonging_street_town as street,
|
t1.household_location AS location,
|
t1.house_hold_area AS beforeHouseHoldArea,
|
t4.*,
|
t6.money AS agreementMooney,
|
t1.compensation_type as compensationType,
|
t4.audit_status as auditStatus,
|
t5.id as projectId,
|
(SELECT STRING_AGG(owner_name, '|' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) as owner_name
|
FROM state_settlement t4
|
LEFT JOIN state_household t1 ON t1.ID = t4.state_household_id
|
LEFT JOIN state_project t5 ON t5.ID = t1.state_project_id
|
LEFT JOIN state_agreement t6 ON t1.ID = t6.state_household_id AND t6.agreement_file_type = 1
|
<where>
|
and t1.id is not null
|
and t4.del_flag != 1
|
<if test="settlementDetailBO.auditStatus == null">
|
and t4.audit_status is null
|
</if>
|
<if test="settlementDetailBO.projectId != null and settlementDetailBO.projectId != ''">
|
and t5.id = #{settlementDetailBO.projectId}
|
</if>
|
<if test="settlementDetailBO.auditStatus != null">
|
<!-- 9-任务中心查询所有状态 -->
|
<if test="settlementDetailBO.auditStatus != 9">
|
AND t4.audit_status = #{settlementDetailBO.auditStatus}
|
</if>
|
<if test="settlementDetailBO.auditStatus == 9">
|
and t4.audit_status is not null
|
</if>
|
</if>
|
<if test="settlementDetailBO.compensationType != null and settlementDetailBO.compensationType != 0">
|
and t1.compensation_type = #{settlementDetailBO.compensationType}
|
</if>
|
<if test="settlementDetailBO.beforeExchangeStreet != null and settlementDetailBO.beforeExchangeStreet != ''">
|
and t1.belonging_street_town like concat('%', #{settlementDetailBO.beforeExchangeStreet}, '%')
|
</if>
|
<if test="settlementDetailBO.afterExchangeStreet != null and settlementDetailBO.afterExchangeStreet != ''">
|
and t4.exchange_street like concat('%', #{settlementDetailBO.afterExchangeStreet}, '%')
|
</if>
|
<if test="settlementDetailBO.beforeExchangeLocation != null and settlementDetailBO.beforeExchangeLocation != ''">
|
and t1.household_location like concat('%', #{settlementDetailBO.beforeExchangeLocation}, '%')
|
</if>
|
<if test="settlementDetailBO.afterExchangeLocation != null and settlementDetailBO.afterExchangeLocation != ''">
|
and t4.exchange_location like concat('%', #{settlementDetailBO.afterExchangeLocation}, '%')
|
</if>
|
<if test="settlementDetailBO.ownerName != null and settlementDetailBO.ownerName != ''">
|
and (SELECT STRING_AGG(owner_name, ',' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) like concat('%', #{settlementDetailBO.ownerName}, '%')
|
</if>
|
<if test="settlementDetailBO.taskId != null and settlementDetailBO.taskId != ''">
|
and t4.task_id = #{settlementDetailBO.taskId}
|
</if>
|
<if test="settlementDetailBO.batchName != null and settlementDetailBO.batchName != ''">
|
and t4.settle_name = #{settlementDetailBO.batchName}
|
</if>
|
</where>
|
</select>
|
|
<select id="listSettleUpdateDetail" parameterType="com.zzg.system.domain.bo.SettlementDetailBO"
|
resultType="com.zzg.system.domain.vo.SettlementDetailVO">
|
SELECT t1.ID AS stateHouseholdId,
|
t1.house_using_type AS houseUsingType,
|
<!-- t1.street AS street,-->
|
<!-- t1.street as projectStreet,-->
|
<!-- 为了前端不改接口这里直接 as成旧字段-->
|
t1.belonging_street_town as street,
|
t1.household_location AS location,
|
t1.house_hold_area AS beforeHouseHoldArea,
|
t4.*,
|
t6.money AS agreementMooney,
|
t1.compensation_type as compensationType,
|
t4.audit_status as auditStatus,
|
t5.id as projectId,
|
(SELECT STRING_AGG(owner_name, '|' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) as owner_name
|
FROM state_settlement t4
|
LEFT JOIN state_household t1 ON t1.ID = t4.state_household_id
|
LEFT JOIN state_project t5 ON t5.ID = t1.state_project_id
|
LEFT JOIN state_agreement t6 ON t1.ID = t6.state_household_id AND t6.agreement_file_type = 1
|
<where>
|
and t1.id is not null
|
and t4.del_flag != 1
|
and ( t4.audit_status is null or t4.audit_status = 0 )
|
<if test="settlementDetailBO.projectId != null and settlementDetailBO.projectId != ''">
|
and t5.id = #{settlementDetailBO.projectId}
|
</if>
|
<if test="settlementDetailBO.compensationType != null and settlementDetailBO.compensationType != 0">
|
and t1.compensation_type = #{settlementDetailBO.compensationType}
|
</if>
|
<if test="settlementDetailBO.beforeExchangeStreet != null and settlementDetailBO.beforeExchangeStreet != ''">
|
and t1.belonging_street_town like concat('%', #{settlementDetailBO.beforeExchangeStreet}, '%')
|
</if>
|
<if test="settlementDetailBO.afterExchangeStreet != null and settlementDetailBO.afterExchangeStreet != ''">
|
and t4.exchange_street like concat('%', #{settlementDetailBO.afterExchangeStreet}, '%')
|
</if>
|
<if test="settlementDetailBO.ownerName != null and settlementDetailBO.ownerName != ''">
|
and (SELECT STRING_AGG(owner_name, ',' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) like concat('%', #{settlementDetailBO.ownerName}, '%')
|
</if>
|
<if test="settlementDetailBO.beforeExchangeLocation != null and settlementDetailBO.beforeExchangeLocation != ''">
|
and t1.household_location like concat('%', #{settlementDetailBO.beforeExchangeLocation}, '%')
|
</if>
|
<if test="settlementDetailBO.afterExchangeLocation != null and settlementDetailBO.afterExchangeLocation != ''">
|
and t4.exchange_location like concat('%', #{settlementDetailBO.afterExchangeLocation}, '%')
|
</if>
|
<if test="settlementDetailBO.taskId != null and settlementDetailBO.taskId != ''">
|
and t4.task_id = #{settlementDetailBO.taskId}
|
</if>
|
<if test="settlementDetailBO.batchName != null and settlementDetailBO.batchName != ''">
|
and t4.settle_name = #{settlementDetailBO.batchName}
|
</if>
|
</where>
|
</select>
|
|
<select id="listSettleData" parameterType="com.zzg.system.domain.bo.SettlementBO"
|
resultType="com.zzg.system.domain.vo.HouseholdVO">
|
SELECT t1.project_name,
|
t1.status as project_status,
|
t1.department as department,
|
t2.*
|
FROM state_project t1
|
LEFT JOIN state_household t2 on t1.id = t2.state_project_id
|
LEFT JOIN state_project_info t4 on t1.id = t4.project_id
|
<where>
|
t2.id is not null
|
and t2.del_flag = 0
|
<if test="settlementBO != null">
|
<if test="settlementBO.isSettled != null and settlementBO.isSettled == 1">
|
and t2.id in (select state_household_id from state_settlement where audit_status is not null)
|
</if>
|
<if test="settlementBO.isSettled!=null and settlementBO.isSettled == 0">
|
and t2.id not in (select state_household_id from state_settlement where audit_status is not null)
|
</if>
|
<if test="settlementBO.projectId != null">
|
and t1.id = #{settlementBO.projectId}
|
</if>
|
<if test="settlementBO.location != null and settlementBO.location != ''">
|
and t2.household_location like concat('%', #{settlementBO.location}, '%')
|
</if>
|
<if test="settlementBO.usingType != null and settlementBO.usingType != 0">
|
and t2.house_using_type = #{settlementBO.usingType}
|
</if>
|
<if test="settlementBO.compensationType != null and settlementBO.compensationType != 0">
|
and t2.compensation_type = #{settlementBO.compensationType}
|
</if>
|
<if test="settlementBO.projectName != null and settlementBO.projectName != ''">
|
and t1.project_name = #{settlementBO.projectName}
|
</if>
|
<if test="settlementBO.houseHoldNumber != null and settlementBO.houseHoldNumber != ''">
|
and (t2.real_estate_certificate_number like concat('%', #{settlementBO.houseHoldNumber}, '%')
|
or t2.using_area_certificate_number like concat('%', #{settlementBO.houseHoldNumber}, '%'))
|
</if>
|
</if>
|
</where>
|
</select>
|
|
<delete id="deleteSettlement">
|
delete from state_settlement where id = #{id}
|
</delete>
|
|
<select id="listExecutionData" parameterType="com.zzg.system.domain.bo.StateExecutionBO"
|
resultType="com.zzg.system.domain.vo.StateExecutionDetailVO">
|
SELECT t1.ID AS houseStateId,
|
<!-- t1.street AS houseStreet,-->
|
t1.belonging_street_town AS houseStreet,
|
t1.household_location AS houseLocation,
|
t3.paid_time as paidOffTime,
|
t3.id as stateSettlementId,
|
t4.levy_time as projectTime
|
FROM state_project t4
|
left join state_household t1 on t4.id = t1.state_project_id
|
LEFT JOIN state_settlement t3 ON t1.ID = t3.state_household_id
|
<where>
|
t1.del_flag = 0
|
<if test="executionBO != null">
|
<if test="executionBO.projectId != null">
|
and t4.id = #{executionBO.projectId}
|
</if>
|
<if test="executionBO.street != null and executionBO.street != ''">
|
AND t1.belonging_street_town like concat('%', #{executionBO.street}, '%')
|
</if>
|
<if test="executionBO.houseStateIdList != null">
|
AND t1.id in
|
<foreach item="stateHouseId" collection="executionBO.houseStateIdList" open="(" separator=","
|
close=")">
|
#{stateHouseId}
|
</foreach>
|
</if>
|
<if test="executionBO.location != null and executionBO.location != ''">
|
AND t1.household_location like concat('%', #{executionBO.location}, '%')
|
</if>
|
</if>
|
</where>
|
</select>
|
</mapper>
|