<?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">
|
<!--
|
* @title: 纠纷代理人信息表
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: wangwh
|
* @time:2024-08-27 10:48:17
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseAgentMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseAgent">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="partyUserId" column="party_user_id"/>
|
<result property="perType" column="per_type"/>
|
<result property="perTypeName" column="per_type_name"/>
|
<result property="perClass" column="per_class"/>
|
<result property="perClassName" column="per_class_name"/>
|
<result property="trueName" column="true_name"/>
|
<result property="mobile" column="mobile"/>
|
<result property="certiType" column="certi_type"/>
|
<result property="certiTypeName" column="certi_type_name"/>
|
<result property="certiNo" column="certi_no"/>
|
<result property="prov" column="prov"/>
|
<result property="provName" column="prov_name"/>
|
<result property="city" column="city"/>
|
<result property="cityName" column="city_name"/>
|
<result property="area" column="area"/>
|
<result property="areaName" column="area_name"/>
|
<result property="road" column="road"/>
|
<result property="roadName" column="road_name"/>
|
<result property="village" column="village"/>
|
<result property="villageName" column="village_name"/>
|
<result property="addr" column="addr"/>
|
<result property="placeProv" column="place_prov"/>
|
<result property="placeProvName" column="place_prov_name"/>
|
<result property="placeCity" column="place_city"/>
|
<result property="placeCityName" column="place_city_name"/>
|
<result property="placeArea" column="place_area"/>
|
<result property="placeAreaName" column="place_area_name"/>
|
<result property="placeRoad" column="place_road"/>
|
<result property="placeRoadName" column="place_road_name"/>
|
<result property="placeVillage" column="place_village"/>
|
<result property="placeVillageName" column="place_village_name"/>
|
<result property="placeAddr" column="place_addr"/>
|
<result property="workUnit" column="work_unit"/>
|
<result property="nation" column="nation"/>
|
<result property="nationName" column="nation_name"/>
|
<result property="sex" column="sex"/>
|
<result property="sexName" column="sex_name"/>
|
<result property="extreme" column="extreme"/>
|
<result property="agentRelate" column="agent_relate"/>
|
<result property="agentRelateName" column="agent_relate_name"/>
|
<result property="agentType" column="agent_type"/>
|
<result property="agentTypeName" column="agent_type_name"/>
|
<result property="personId" column="person_id"/>
|
<result property="avatar" column="avatar"/>
|
<result property="job" column="job"/>
|
<result property="jobName" column="job_name"/>
|
<result property="birthday" column="birthday"/>
|
<result property="age" column="age"/>
|
<result property="agentStatus" column="agent_status"/>
|
<result property="custId" column="cust_id"/>
|
<result property="deleteStatus" column="delete_status"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_case_agent</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
party_user_id,
|
per_type,
|
per_type_name,
|
per_class,
|
per_class_name,
|
true_name,
|
mobile,
|
certi_type,
|
certi_type_name,
|
certi_no,
|
prov,
|
prov_name,
|
city,
|
city_name,
|
area,
|
area_name,
|
road,
|
road_name,
|
village,
|
village_name,
|
addr,
|
place_prov,
|
place_prov_name,
|
place_city,
|
place_city_name,
|
place_area,
|
place_area_name,
|
place_road,
|
place_road_name,
|
place_village,
|
place_village_name,
|
place_addr,
|
work_unit,
|
nation,
|
nation_name,
|
sex,
|
sex_name,
|
extreme,
|
agent_relate,
|
agent_relate_name,
|
agent_type,
|
agent_type_name,
|
person_id,
|
avatar,
|
job,
|
job_name,
|
birthday,
|
age,
|
agent_status,
|
cust_id,
|
delete_status,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.caseId != null">case_id = #{entity.caseId},</if>
|
<if test="entity.partyUserId != null">party_user_id = #{entity.partyUserId},</if>
|
<if test="entity.perType != null">per_type = #{entity.perType},</if>
|
<if test="entity.perTypeName != null">per_type_name = #{entity.perTypeName},</if>
|
<if test="entity.perClass != null">per_class = #{entity.perClass},</if>
|
<if test="entity.perClassName != null">per_class_name = #{entity.perClassName},</if>
|
<if test="entity.trueName != null">true_name = #{entity.trueName},</if>
|
<if test="entity.mobile != null">mobile = #{entity.mobile},</if>
|
<if test="entity.certiType != null">certi_type = #{entity.certiType},</if>
|
<if test="entity.certiTypeName != null">certi_type_name = #{entity.certiTypeName},</if>
|
<if test="entity.certiNo != null">certi_no = #{entity.certiNo},</if>
|
<if test="entity.prov != null">prov = #{entity.prov},</if>
|
<if test="entity.provName != null">prov_name = #{entity.provName},</if>
|
<if test="entity.city != null">city = #{entity.city},</if>
|
<if test="entity.cityName != null">city_name = #{entity.cityName},</if>
|
<if test="entity.area != null">area = #{entity.area},</if>
|
<if test="entity.areaName != null">area_name = #{entity.areaName},</if>
|
<if test="entity.road != null">road = #{entity.road},</if>
|
<if test="entity.roadName != null">road_name = #{entity.roadName},</if>
|
<if test="entity.village != null">village = #{entity.village},</if>
|
<if test="entity.villageName != null">village_name = #{entity.villageName},</if>
|
<if test="entity.addr != null">addr = #{entity.addr},</if>
|
<if test="entity.placeProv != null">place_prov = #{entity.placeProv},</if>
|
<if test="entity.placeProvName != null">place_prov_name = #{entity.placeProvName},</if>
|
<if test="entity.placeCity != null">place_city = #{entity.placeCity},</if>
|
<if test="entity.placeCityName != null">place_city_name = #{entity.placeCityName},</if>
|
<if test="entity.placeArea != null">place_area = #{entity.placeArea},</if>
|
<if test="entity.placeAreaName != null">place_area_name = #{entity.placeAreaName},</if>
|
<if test="entity.placeRoad != null">place_road = #{entity.placeRoad},</if>
|
<if test="entity.placeRoadName != null">place_road_name = #{entity.placeRoadName},</if>
|
<if test="entity.placeVillage != null">place_village = #{entity.placeVillage},</if>
|
<if test="entity.placeVillageName != null">place_village_name = #{entity.placeVillageName},</if>
|
<if test="entity.placeAddr != null">place_addr = #{entity.placeAddr},</if>
|
<if test="entity.workUnit != null">work_unit = #{entity.workUnit},</if>
|
<if test="entity.nation != null">nation = #{entity.nation},</if>
|
<if test="entity.nationName != null">nation_name = #{entity.nationName},</if>
|
<if test="entity.sex != null">sex = #{entity.sex},</if>
|
<if test="entity.sexName != null">sex_name = #{entity.sexName},</if>
|
<if test="entity.extreme != null">extreme = #{entity.extreme},</if>
|
<if test="entity.agentRelate != null">agent_relate = #{entity.agentRelate},</if>
|
<if test="entity.agentRelateName != null">agent_relate_name = #{entity.agentRelateName},</if>
|
<if test="entity.agentType != null">agent_type = #{entity.agentType},</if>
|
<if test="entity.agentTypeName != null">agent_type_name = #{entity.agentTypeName},</if>
|
<if test="entity.personId != null">person_id = #{entity.personId},</if>
|
<if test="entity.avatar != null">avatar = #{entity.avatar},</if>
|
<if test="entity.job != null">job = #{entity.job},</if>
|
<if test="entity.jobName != null">job_name = #{entity.jobName},</if>
|
<if test="entity.birthday != null">birthday = #{entity.birthday},</if>
|
<if test="entity.age != null">age = #{entity.age},</if>
|
<if test="entity.agentStatus != null">agent_status = #{entity.agentStatus},</if>
|
<if test="entity.custId != null">cust_id = #{entity.custId},</if>
|
<if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
|
<if test="entity.createTime != null">create_time = #{entity.createTime},</if>
|
<if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
|
</sql>
|
<!-- 条件 -->
|
<sql id="where-part">
|
<if test="terms != null">
|
<where>
|
<if test="terms.id != null and terms.id !=''">
|
and id = #{terms.id}
|
</if>
|
<if test="terms.caseId != null and terms.caseId !=''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.partyUserId != null and terms.partyUserId !=''">
|
and party_user_id = #{terms.partyUserId}
|
</if>
|
<if test="terms.perType != null and terms.perType !=''">
|
and per_type = #{terms.perType}
|
</if>
|
<if test="terms.perTypeName != null and terms.perTypeName !=''">
|
and per_type_name = #{terms.perTypeName}
|
</if>
|
<if test="terms.perClass != null and terms.perClass !=''">
|
and per_class = #{terms.perClass}
|
</if>
|
<if test="terms.perClassName != null and terms.perClassName !=''">
|
and per_class_name = #{terms.perClassName}
|
</if>
|
<if test="terms.trueName != null and terms.trueName !=''">
|
and true_name = #{terms.trueName}
|
</if>
|
<if test="terms.mobile != null and terms.mobile !=''">
|
and mobile = #{terms.mobile}
|
</if>
|
<if test="terms.certiType != null and terms.certiType !=''">
|
and certi_type = #{terms.certiType}
|
</if>
|
<if test="terms.certiTypeName != null and terms.certiTypeName !=''">
|
and certi_type_name = #{terms.certiTypeName}
|
</if>
|
<if test="terms.certiNo != null and terms.certiNo !=''">
|
and certi_no = #{terms.certiNo}
|
</if>
|
<if test="terms.prov != null and terms.prov !=''">
|
and prov = #{terms.prov}
|
</if>
|
<if test="terms.provName != null and terms.provName !=''">
|
and prov_name = #{terms.provName}
|
</if>
|
<if test="terms.city != null and terms.city !=''">
|
and city = #{terms.city}
|
</if>
|
<if test="terms.cityName != null and terms.cityName !=''">
|
and city_name = #{terms.cityName}
|
</if>
|
<if test="terms.area != null and terms.area !=''">
|
and area = #{terms.area}
|
</if>
|
<if test="terms.areaName != null and terms.areaName !=''">
|
and area_name = #{terms.areaName}
|
</if>
|
<if test="terms.road != null and terms.road !=''">
|
and road = #{terms.road}
|
</if>
|
<if test="terms.roadName != null and terms.roadName !=''">
|
and road_name = #{terms.roadName}
|
</if>
|
<if test="terms.village != null and terms.village !=''">
|
and village = #{terms.village}
|
</if>
|
<if test="terms.villageName != null and terms.villageName !=''">
|
and village_name = #{terms.villageName}
|
</if>
|
<if test="terms.addr != null and terms.addr !=''">
|
and addr = #{terms.addr}
|
</if>
|
<if test="terms.placeProv != null and terms.placeProv !=''">
|
and place_prov = #{terms.placeProv}
|
</if>
|
<if test="terms.placeProvName != null and terms.placeProvName !=''">
|
and place_prov_name = #{terms.placeProvName}
|
</if>
|
<if test="terms.placeCity != null and terms.placeCity !=''">
|
and place_city = #{terms.placeCity}
|
</if>
|
<if test="terms.placeCityName != null and terms.placeCityName !=''">
|
and place_city_name = #{terms.placeCityName}
|
</if>
|
<if test="terms.placeArea != null and terms.placeArea !=''">
|
and place_area = #{terms.placeArea}
|
</if>
|
<if test="terms.placeAreaName != null and terms.placeAreaName !=''">
|
and place_area_name = #{terms.placeAreaName}
|
</if>
|
<if test="terms.placeRoad != null and terms.placeRoad !=''">
|
and place_road = #{terms.placeRoad}
|
</if>
|
<if test="terms.placeRoadName != null and terms.placeRoadName !=''">
|
and place_road_name = #{terms.placeRoadName}
|
</if>
|
<if test="terms.placeVillage != null and terms.placeVillage !=''">
|
and place_village = #{terms.placeVillage}
|
</if>
|
<if test="terms.placeVillageName != null and terms.placeVillageName !=''">
|
and place_village_name = #{terms.placeVillageName}
|
</if>
|
<if test="terms.placeAddr != null and terms.placeAddr !=''">
|
and place_addr = #{terms.placeAddr}
|
</if>
|
<if test="terms.workUnit != null and terms.workUnit !=''">
|
and work_unit = #{terms.workUnit}
|
</if>
|
<if test="terms.nation != null and terms.nation !=''">
|
and nation = #{terms.nation}
|
</if>
|
<if test="terms.nationName != null and terms.nationName !=''">
|
and nation_name = #{terms.nationName}
|
</if>
|
<if test="terms.sex != null and terms.sex !=''">
|
and sex = #{terms.sex}
|
</if>
|
<if test="terms.sexName != null and terms.sexName !=''">
|
and sex_name = #{terms.sexName}
|
</if>
|
<if test="terms.extreme != null and terms.extreme !=''">
|
and extreme = #{terms.extreme}
|
</if>
|
<if test="terms.agentRelate != null and terms.agentRelate !=''">
|
and agent_relate = #{terms.agentRelate}
|
</if>
|
<if test="terms.agentRelateName != null and terms.agentRelateName !=''">
|
and agent_relate_name = #{terms.agentRelateName}
|
</if>
|
<if test="terms.agentType != null and terms.agentType !=''">
|
and agent_type = #{terms.agentType}
|
</if>
|
<if test="terms.agentTypeName != null and terms.agentTypeName !=''">
|
and agent_type_name = #{terms.agentTypeName}
|
</if>
|
<if test="terms.personId != null and terms.personId !=''">
|
and person_id = #{terms.personId}
|
</if>
|
<if test="terms.avatar != null and terms.avatar !=''">
|
and avatar = #{terms.avatar}
|
</if>
|
<if test="terms.job != null and terms.job !=''">
|
and job = #{terms.job}
|
</if>
|
<if test="terms.jobName != null and terms.jobName !=''">
|
and job_name = #{terms.jobName}
|
</if>
|
<if test="terms.birthday != null and terms.birthday !=''">
|
and birthday = #{terms.birthday}
|
</if>
|
<if test="terms.age != null and terms.age !=''">
|
and age = #{terms.age}
|
</if>
|
<if test="terms.agentStatus != null and terms.agentStatus !=''">
|
and agent_status = #{terms.agentStatus}
|
</if>
|
<if test="terms.custId != null and terms.custId !=''">
|
and cust_id = #{terms.custId}
|
</if>
|
<if test="terms.deleteStatus = null and terms.deleteStatus =''">
|
and delete_status = 0
|
</if>
|
<if test="terms.deleteStatus != null and terms.deleteStatus !=''">
|
and delete_status = #{terms.deleteStatus}
|
</if>
|
<if test="terms.createTime != null and terms.createTime !=''">
|
and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.updateTime != null and terms.updateTime !=''">
|
and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime}
|
</if>
|
<if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''">
|
and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart}
|
and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd})
|
</if>
|
</where>
|
</if>
|
</sql>
|
<!-- 更新对象 -->
|
<update id="updateCaseAgent">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateCaseAgentTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteCaseAgent">
|
delete from
|
<include refid="table-name" />
|
where id = #{id}
|
</delete>
|
<!-- 根据条件查询 -->
|
<select id="listTerms" resultMap="dataResult">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件统计 -->
|
<select id="countTerms" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
</select>
|
<!-- 根据条件分页查询 -->
|
<select id="pageTerms" resultMap="dataResult">
|
SELECT
|
<include refid="column-part"/>
|
FROM
|
<include refid="table-name" />
|
<include refid="where-part"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(create_time), create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 根据纠纷编号查询人员编号 -->
|
<select id="listIdByCaseId" resultType="java.lang.String">
|
select
|
id
|
from
|
<include refid="table-name" />
|
where case_id = #{caseId}
|
</select>
|
|
<select id="listByCertiNo" resultMap="dataResult">
|
select
|
a.case_id,a.certi_no,a.per_type
|
from
|
dyh_case_agent a INNER JOIN dyh_case_info b ON a.case_id = b.id
|
where a.certi_no = #{certiNo} and b.delete_status = 0
|
</select>
|
</mapper>
|