<?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.panzhihua.service_community.dao.ComActAcidDangerMemberDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActAcidDangerMember"
|
id="ComActAcidDangerMemberBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="recordId" column="record_id"/>
|
<result property="name" column="name"/>
|
<result property="phone" column="phone"/>
|
<result property="idCard" column="id_card"/>
|
<result property="type" column="type"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="relationName" column="relation_name"/>
|
<result property="riskType" column="risk_type"/>
|
</resultMap>
|
|
<select id="pageList" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidDangerMemberVO">
|
SELECT t1.id, t1.`name`, t1.`status`, t1.record_id, t1.phone, t1.risk_type, t2.local_city,
|
t1.source, t2.create_time AS reportTime, t2.real_address, MAX(t3.create_time) AS checkTime
|
FROM com_act_acid_danger_member t1
|
LEFT JOIN com_act_acid_record t2 ON t1.record_id = t2.id
|
LEFT JOIN com_act_acid_check_record t3 ON t1.id = t3.member_id
|
<where>
|
t1.is_del=0
|
<if test="commonPage.keyword!=null and commonPage.keyword !=''">
|
and (t1.`name` like concat('%',#{commonPage.keyword},'%')
|
or t1.phone like concat('%',#{commonPage.keyword},'%')
|
or t1.id_card like concat('%',#{commonPage.keyword},'%'))
|
</if>
|
<if test="commonPage.source!=null">
|
and t1.source =#{commonPage.source}
|
</if>
|
<if test="commonPage.status!=null">
|
and t1.`status` =#{commonPage.status}
|
</if>
|
<if test="commonPage.status==null">
|
and t1.`status` != 5
|
</if>
|
<if test="commonPage.type != null">
|
AND t1.`type` = #{commonPage.type}
|
</if>
|
<if test="commonPage.relationName !=null and commonPage.relationName !='' and commonPage.relationName !='panzhihua'">
|
and t1.relation_name like concat('%',#{commonPage.relationName},'%')
|
</if>
|
<if test="commonPage.isAddress !=null">
|
<if test="commonPage.isAddress == 0">
|
and (t2.local_city is null OR LENGTH(TRIM(t2.local_city)) = 0)
|
</if>
|
<if test="commonPage.isAddress == 1">
|
and t2.local_city is not null AND LENGTH(TRIM(t2.local_city)) > 0
|
</if>
|
</if>
|
<if test="commonPage.localCity !=null and commonPage.localCity !='' and commonPage.localCity !='panzhihua'">
|
and t2.local_city like concat('%',#{commonPage.localCity},'%')
|
</if>
|
<if test="commonPage.riskType != null and commonPage.riskType != """>
|
AND t1.risk_type LIKE CONCAT('%', #{commonPage.riskType}, '%')
|
</if>
|
</where>
|
GROUP BY t1.id
|
HAVING 1=1
|
<if test="commonPage.type == 1">
|
<if test="commonPage.startTime!=null">
|
AND checkTime >= #{commonPage.startTime}
|
</if>
|
<if test="commonPage.stopTime!=null">
|
AND concat(SUBSTR(#{commonPage.stopTime} FROM 1 FOR 10),' 23:59:59') >= checkTime
|
</if>
|
order by checkTime asc,reportTime desc
|
</if>
|
<if test="commonPage.type == 2">
|
<if test="commonPage.startTime!=null">
|
AND reportTime >= #{commonPage.startTime}
|
</if>
|
<if test="commonPage.stopTime!=null">
|
AND concat(SUBSTR(#{commonPage.stopTime} FROM 1 FOR 10),' 23:59:59') >= reportTime
|
</if>
|
order by reportTime desc
|
</if>
|
</select>
|
<select id="pageDangerMember"
|
resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidDangerMemberVO">
|
SELECT t1.id, t1.`name`, t1.`status`, t1.record_id, t1.phone, t2.color_mark, t2.acid_test, MAX(t3.create_time) AS checkTime,t1.create_time
|
FROM com_act_acid_danger_member t1
|
LEFT JOIN com_act_acid_record t2 ON t1.record_id = t2.id
|
LEFT JOIN com_act_acid_check_record t3 ON t1.id = t3.member_id
|
<where>
|
t1.is_del=0
|
<if test="pageDangerMemberDTO.keyword != null and pageDangerMemberDTO.keyword != """>
|
AND t1.`name` LIKE CONCAT('%', #{pageDangerMemberDTO.keyword}, '%')
|
</if>
|
<if test="pageDangerMemberDTO.isFill != null">
|
<if test="pageDangerMemberDTO.isFill == 1">
|
AND t2.local_city IS NOT NULL AND LENGTH(TRIM(t2.local_city)) > 0
|
</if>
|
<if test="pageDangerMemberDTO.isFill == 2">
|
AND (t2.local_city IS NULL OR LENGTH(TRIM(t2.local_city)) = 0)
|
</if>
|
</if>
|
<if test="pageDangerMemberDTO.type != null">
|
AND t1.`type` = #{pageDangerMemberDTO.type}
|
</if>
|
<if test="pageDangerMemberDTO.relationName !=null and pageDangerMemberDTO.relationName !='' and pageDangerMemberDTO.relationName !='panzhihua'">
|
and t1.relation_name like concat('%',#{pageDangerMemberDTO.relationName},'%')
|
</if>
|
</where>
|
GROUP BY t1.id ORDER BY checkTime ASC
|
</select>
|
|
</mapper>
|