<?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.StateAgreementMapper">
|
<select id="listDataByConditions" parameterType="com.zzg.system.domain.bo.StateAgreementBO"
|
resultType="com.zzg.system.domain.vo.StateAgreementVO">
|
SELECT
|
<!-- t1.street,-->
|
<!-- 为了前端不改接口这里直接 as成旧字段-->
|
t1.belonging_street_town as street,
|
t1.household_location as location,
|
t1.real_estate_certificate_number,
|
t1.using_area_certificate_number,
|
t1.id as stateHouseholdId,
|
t3.status as project_status,
|
t1.agreement_status as work_status,
|
(SELECT STRING_AGG(owner_name, '|' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) as owner_name,
|
(select count(1) from state_household_owner where state_household_id = t1.id) as person_num
|
FROM state_household t1
|
LEFT JOIN state_project t3 on t3.id = t1.state_project_id
|
<where>
|
t1.id is not null
|
and t3.id is not null
|
and t1.del_flag = 0
|
<!-- and t4.id is not null-->
|
<if test="request.stateHouseholdId != null">
|
and t1.id = #{request.stateHouseholdId}
|
</if>
|
<if test="request.projectId != null">
|
and t3.id = #{request.projectId}
|
</if>
|
<if test="request.location != null and request.location != ''">
|
and t1.household_location like concat('%', #{request.location}, '%')
|
</if>
|
<if test="request.usingType != null and request.usingType != 0">
|
and t1.house_using_type = #{request.usingType}
|
</if>
|
<if test="request.houseHoldNumber != null and request.houseHoldNumber != ''">
|
and (t1.real_estate_certificate_number like concat('%', #{request.houseHoldNumber}, '%')
|
or t1.using_area_certificate_number like concat('%', #{request.houseHoldNumber}, '%'))
|
</if>
|
<if test="request.street != null and request.street != ''">
|
and t1.belonging_street_town like concat('%', #{request.street}, '%')
|
</if>
|
<if test="request.ownerName != null and request.ownerName != ''">
|
AND (SELECT STRING_AGG(owner_name, '|' ORDER BY owner_name) FROM state_household_owner WHERE state_household_id = t1.id) LIKE CONCAT('%', #{request.ownerName}, '%')
|
</if>
|
</where>
|
</select>
|
</mapper>
|