<?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.StateHouseholdMapper">
|
<select id="listByConditions" parameterType="com.zzg.system.domain.bo.HouseholdBO"
|
resultType="com.zzg.system.domain.vo.HouseholdVO">
|
SELECT t1.project_name,
|
t1.project_no,
|
t1.is_need_evaluate,
|
t1.status as project_status,
|
<!-- t1.street as projectStreet,-->
|
<!-- 为了前端不改接口这里直接 as成旧字段-->
|
t2.belonging_street_town as projectStreet,
|
t2.door_number,
|
t2.building_number,
|
t1.audit_status,
|
t5.dept_name as department,
|
t2.*,
|
t3.owner_name as ownerName,
|
t3.owner_type as ownerType
|
FROM state_project t1
|
LEFT JOIN state_household t2 on t1.id = t2.state_project_id
|
LEFT JOIN state_household_owner t3 on t2.id = t3.state_household_id
|
LEFT JOIN state_project_info t4 on t1.id = t4.project_id
|
left join sys_dept t5 on t2.dept_id = t5.dept_id
|
<where>
|
T2.id is not null
|
and t2.del_flag != 1
|
<if test="householdBOBody != null">
|
<if test="householdBOBody.location != null and householdBOBody.location != ''">
|
and t2.household_location like concat('%', #{householdBOBody.location}, '%')
|
</if>
|
<if test="householdBOBody.usingType != null and householdBOBody.usingType != 0">
|
and t2.house_using_type = #{householdBOBody.usingType}
|
</if>
|
<if test="householdBOBody.projectId != null">
|
and t1.id = #{householdBOBody.projectId}
|
</if>
|
<if test="householdBOBody.searchStatus != null">
|
and t2.search_status = #{householdBOBody.searchStatus}
|
</if>
|
<if test="householdBOBody.houseHoldNumber != null and householdBOBody.houseHoldNumber != ''">
|
and (t2.real_estate_certificate_number like concat('%', #{householdBOBody.houseHoldNumber}, '%')
|
or t2.using_area_certificate_number like concat('%', #{householdBOBody.houseHoldNumber}, '%'))
|
</if>
|
<if test="householdBOBody.ownerName != null and householdBOBody.ownerName != ''">
|
and t3.owner_name like concat('%', #{householdBOBody.ownerName}, '%')
|
</if>
|
<if test="householdBOBody.constructionCompany != null and householdBOBody.constructionCompany != ''">
|
and t5.dept_name like
|
concat('%', #{householdBOBody.constructionCompany}, '%')
|
</if>
|
<if test="householdBOBody.projectName != null and householdBOBody.projectName != ''">
|
and t1.project_name like
|
concat('%', #{householdBOBody.projectName}, '%')
|
</if>
|
<if test="householdBOBody.appSearchStr != null and householdBOBody.appSearchStr != ''">
|
and (
|
t2.belonging_street_town like concat('%', #{householdBOBody.appSearchStr}, '%')
|
or
|
t2.door_number like concat('%', #{householdBOBody.appSearchStr}, '%')
|
or
|
t2.building_number like concat('%', #{householdBOBody.appSearchStr}, '%')
|
)
|
</if>
|
</if>
|
</where>
|
ORDER BY t2.create_time DESC
|
</select>
|
|
|
<select id="pageByConditionsWithoutOwners" parameterType="com.zzg.system.domain.bo.HouseholdBO"
|
resultType="com.zzg.system.domain.vo.HouseholdVO">
|
SELECT t1.project_name,
|
t1.project_no,
|
t1.is_need_evaluate,
|
t1.status as project_status,
|
<!-- t1.street as projectStreet,-->
|
<!-- 为了前端不改接口这里直接 as成旧字段-->
|
t2.belonging_street_town as projectStreet,
|
t2.door_number,
|
t2.building_number,
|
t1.audit_status,
|
t5.dept_name 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
|
left join sys_dept t5 on t2.dept_id = t5.dept_id
|
<where>
|
T2.id is not null
|
and t2.del_flag != 1
|
<if test="householdBOBody != null">
|
<if test="householdBOBody.location != null and householdBOBody.location != ''">
|
and t2.household_location like concat('%', #{householdBOBody.location}, '%')
|
</if>
|
<if test="householdBOBody.usingType != null and householdBOBody.usingType != 0">
|
and t2.house_using_type = #{householdBOBody.usingType}
|
</if>
|
<if test="householdBOBody.projectId != null">
|
and t1.id = #{householdBOBody.projectId}
|
</if>
|
<if test="householdBOBody.houseHoldNumber != null and householdBOBody.houseHoldNumber != ''">
|
and (t2.real_estate_certificate_number like concat('%', #{householdBOBody.houseHoldNumber}, '%')
|
or t2.using_area_certificate_number like concat('%', #{householdBOBody.houseHoldNumber}, '%'))
|
</if>
|
<if test="householdBOBody.constructionCompany != null and householdBOBody.constructionCompany != ''">
|
and t5.dept_name like
|
concat('%', #{householdBOBody.constructionCompany}, '%')
|
</if>
|
<if test="householdBOBody.projectName != null and householdBOBody.projectName != ''">
|
and t1.project_name like
|
concat('%', #{householdBOBody.projectName}, '%')
|
</if>
|
<if test="householdBOBody.appSearchStr != null and householdBOBody.appSearchStr != ''">
|
and (
|
t2.belonging_street_town like concat('%', #{householdBOBody.appSearchStr}, '%')
|
or
|
t2.door_number like concat('%', #{householdBOBody.appSearchStr}, '%')
|
or
|
t2.building_number like concat('%', #{householdBOBody.appSearchStr}, '%')
|
)
|
</if>
|
</if>
|
</where>
|
ORDER BY t2.create_time DESC
|
</select>
|
|
|
|
<select id="pageByConditions" parameterType="com.zzg.system.domain.bo.HouseholdBO"
|
resultType="com.zzg.system.domain.vo.HouseholdVO">
|
SELECT t1.department as department, t2.*, t3.owner_name as ownerName, t3.owner_type as ownerType
|
FROM state_project t1
|
LEFT JOIN state_household t2 on t1.id = t2.state_project_id
|
LEFT JOIN state_household_owner t3 on t2.id = t3.state_household_id
|
LEFT JOIN state_project_info t4 on t1.id = t4.project_id
|
<where>
|
<if test="getProjectPageBO.projectName != null and getProjectPageBO.projectName != ''">
|
and t1.project_name = #{getProjectPageBO.projectName}
|
</if>
|
<if test="getProjectPageBO.collectionEnforcementDepartment != null and getProjectPageBO.collectionEnforcementDepartment != ''">
|
and t4.collection_enforcement_department like
|
concat('%', #{getProjectPageBO.collectionEnforcementDepartment}, '%')
|
</if>
|
<if test="getProjectPageBO.department != null and getProjectPageBO.department != ''">
|
and t4.department like
|
concat('%', #{getProjectPageBO.department}, '%')
|
</if>
|
</where>
|
</select>
|
|
<select id="pageByProjectId" resultType="com.zzg.system.domain.vo.HouseholdVO">
|
SELECT *
|
FROM (
|
SELECT A.*, t1.sign_at as signAt
|
FROM state_household A
|
left join state_agreement t1 on a.id = t1.state_household_id
|
WHERE t1.agreement_file_type = 1
|
and t1.agreement_number is not null
|
and A.agreement_status = 3
|
and A.del_flag = 0
|
and A.state_project_id IN
|
<foreach item="projectId" collection="projectIdList" open="(" separator="," close=")">
|
#{projectId}
|
</foreach>
|
|
<if test="street != null and street != ''">
|
and A.belonging_street_town like
|
concat('%', #{street}, '%')
|
</if>
|
ORDER BY t1.sign_at ASC
|
LIMIT 100
|
) AS result
|
</select>
|
|
<select id="listBySearchCondition" parameterType="com.zzg.system.domain.bo.HouseQueryBO"
|
resultType="com.zzg.system.domain.vo.HouseQueryVO">
|
SELECT t1.ID AS projectId,
|
t1.project_name,
|
t1.street AS projectStreet,
|
t1.audit_status as auditStatus,
|
t1.department AS department,
|
t1.create_time AS lastCreateTime
|
FROM state_project t1
|
LEFT JOIN state_household t2 ON t1.ID = t2.state_project_id
|
<where>
|
-- 入户调查接口只需要 入户调查阶段的项目
|
t1.id is not null and t1.status = 2 and t1.del_flag = 0
|
<if test="houseQueryBO != null">
|
<if test="houseQueryBO.projectId != null">
|
and t1.id = #{houseQueryBO.projectId}
|
</if>
|
<if test="houseQueryBO.department != null and houseQueryBO.department != ''">
|
and t1.department like concat('%', #{houseQueryBO.department},'%')
|
</if>
|
<if test="houseQueryBO.street != null and houseQueryBO.street != '' ">
|
and t1.street like concat('%', #{houseQueryBO.street},'%')
|
</if>
|
</if>
|
</where>
|
GROUP BY t1.ID,
|
t1.project_name,
|
t1.street,
|
t1.audit_status,
|
t1.department,
|
lastCreateTime
|
ORDER BY lastCreateTime DESC
|
</select>
|
</mapper>
|