<?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: 纠纷办理反馈j信息表
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: wangwh
|
* @time:2024-08-30 17:35:02
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseFeedbackMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseFeedback">
|
<result property="id" column="id"/>
|
<result property="caseId" column="case_id"/>
|
<result property="caseTaskId" column="case_task_id"/>
|
<result property="handleType" column="handle_type"/>
|
<result property="handleUnitId" column="handle_unit_id"/>
|
<result property="handleUnitName" column="handle_unit_name"/>
|
<result property="handleUserId" column="handle_user_id"/>
|
<result property="handleUserName" column="handle_user_name"/>
|
<result property="handleContent" column="handle_content"/>
|
<result property="deleteStatus" column="delete_status"/>
|
<result property="custId" column="cust_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_case_feedback</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
case_id,
|
case_task_id,
|
handle_type,
|
handle_unit_id,
|
handle_unit_name,
|
handle_user_id,
|
handle_user_name,
|
handle_content,
|
delete_status,
|
cust_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.caseId != null">case_id = #{entity.caseId},</if>
|
<if test="entity.caseTskId != null">case_task_id = #{entity.caseTskId},</if>
|
<if test="entity.handleType != null">handle_type = #{entity.handleType},</if>
|
<if test="entity.handleUnitId != null">handle_unit_id = #{entity.handleUnitId},</if>
|
<if test="entity.handleUnitName != null">handle_unit_name = #{entity.handleUnitName},</if>
|
<if test="entity.handleUserId != null">handle_user_id = #{entity.handleUserId},</if>
|
<if test="entity.handleUserName != null">handle_user_name = #{entity.handleUserName},</if>
|
<if test="entity.handleContent != null">handle_content = #{entity.handleContent},</if>
|
<if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</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.caseId != null and terms.caseId !=''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.caseTaskId != null and terms.caseTaskId !=''">
|
and case_task_id = #{terms.caseTaskId}
|
</if>
|
<if test="terms.handleType != null and terms.handleType !=''">
|
and handle_type = #{terms.handleType}
|
</if>
|
<if test="terms.handleUnitId != null and terms.handleUnitId !=''">
|
and handle_unit_id = #{terms.handleUnitId}
|
</if>
|
<if test="terms.handleUnitName != null and terms.handleUnitName !=''">
|
and handle_unit_name = #{terms.handleUnitName}
|
</if>
|
<if test="terms.handleUserId != null and terms.handleUserId !=''">
|
and handle_user_id = #{terms.handleUserId}
|
</if>
|
<if test="terms.handleUserName != null and terms.handleUserName !=''">
|
and handle_user_name = #{terms.handleUserName}
|
</if>
|
<if test="terms.handleContent != null and terms.handleContent !=''">
|
and handle_content = #{terms.handleContent}
|
</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.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="updatecaseFeedback">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updatecaseFeedbackTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deletecaseFeedback">
|
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>
|
|
</mapper>
|