<?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: liyj
|
* @time:2024-11-15 10:56:26
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.thirdByRmtj.dao.mapper.ThRmtjUserMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.thirdByRmtj.domain.po.ThRmtjUser">
|
<result property="id" column="id"/>
|
<result property="accType" column="acc_type"/>
|
<result property="userId" column="user_id"/>
|
<result property="unitId" column="unit_id"/>
|
<result property="disputeMediatorId" column="dispute_mediator_id"/>
|
<result property="disputeUserId" column="dispute_user_id"/>
|
<result property="name" column="name"/>
|
<result property="loginAcc" column="login_acc"/>
|
<result property="committeeId" column="committee_id"/>
|
<result property="committeeName" column="committee_name"/>
|
<result property="provinceId" column="province_id"/>
|
<result property="cityId" column="city_id"/>
|
<result property="townId" column="town_id"/>
|
<result property="streetId" column="street_id"/>
|
<result property="custId" column="cust_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_th_rmtj_user</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
acc_type,
|
user_id,
|
unit_id,
|
dispute_mediator_id,
|
dispute_user_id,
|
name,
|
login_acc,
|
committee_id,
|
committee_name,
|
province_id,
|
city_id,
|
town_id,
|
street_id,
|
cust_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.accType != null">acc_type = #{entity.accType},</if>
|
<if test="entity.userId != null">user_id = #{entity.userId},</if>
|
<if test="entity.unitId != null">unit_id = #{entity.unitId},</if>
|
<if test="entity.disputeMediatorId != null">dispute_mediator_id = #{entity.disputeMediatorId},</if>
|
<if test="entity.disputeUserId != null">dispute_user_id = #{entity.disputeUserId},</if>
|
<if test="entity.name != null">name = #{entity.name},</if>
|
<if test="entity.loginAcc != null">login_acc = #{entity.loginAcc},</if>
|
<if test="entity.committeeId != null">committee_id = #{entity.committeeId},</if>
|
<if test="entity.committeeName != null">committee_name = #{entity.committeeName},</if>
|
<if test="entity.provinceId != null">province_id = #{entity.provinceId},</if>
|
<if test="entity.cityId != null">city_id = #{entity.cityId},</if>
|
<if test="entity.townId != null">town_id = #{entity.townId},</if>
|
<if test="entity.streetId != null">street_id = #{entity.streetId},</if>
|
<if test="entity.custId != null">cust_id = #{entity.custId},</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.accType != null and terms.accType !=''">
|
and acc_type = #{terms.accType}
|
</if>
|
<if test="terms.userId != null and terms.userId !=''">
|
and user_id = #{terms.userId}
|
</if>
|
<if test="terms.unitId != null and terms.unitId !=''">
|
and unit_id = #{terms.unitId}
|
</if>
|
<if test="terms.disputeMediatorId != null and terms.disputeMediatorId !=''">
|
and dispute_mediator_id = #{terms.disputeMediatorId}
|
</if>
|
<if test="terms.disputeUserId != null and terms.disputeUserId !=''">
|
and dispute_user_id = #{terms.disputeUserId}
|
</if>
|
<if test="terms.name != null and terms.name !=''">
|
and name = #{terms.name}
|
</if>
|
<if test="terms.loginAcc != null and terms.loginAcc !=''">
|
and login_acc = #{terms.loginAcc}
|
</if>
|
<if test="terms.committeeId != null and terms.committeeId !=''">
|
and committee_id = #{terms.committeeId}
|
</if>
|
<if test="terms.committeeName != null and terms.committeeName !=''">
|
and committee_name = #{terms.committeeName}
|
</if>
|
<if test="terms.provinceId != null and terms.provinceId !=''">
|
and province_id = #{terms.provinceId}
|
</if>
|
<if test="terms.cityId != null and terms.cityId !=''">
|
and city_id = #{terms.cityId}
|
</if>
|
<if test="terms.townId != null and terms.townId !=''">
|
and town_id = #{terms.townId}
|
</if>
|
<if test="terms.streetId != null and terms.streetId !=''">
|
and street_id = #{terms.streetId}
|
</if>
|
<if test="terms.custId != null and terms.custId !=''">
|
and cust_id = #{terms.custId}
|
</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="updateThRmtjUser">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateThRmtjUserTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteThRmtjUser">
|
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="getUserByName" resultType="map">
|
SELECT id, true_name, unit_id, unit_name
|
FROM dyh_ct_user
|
WHERE true_name = #{trueName}
|
AND delete_status = 0
|
</select>
|
|
</mapper>
|