<?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-10-18 17:30:09
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.grid.dao.mapper.GridCaseTaskMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.grid.domain.po.GridCaseTask">
|
<result property="id" column="id"/>
|
<result property="objId" column="obj_id"/>
|
<result property="objType" column="obj_type"/>
|
<result property="todoYpe" column="todo_ype"/>
|
<result property="sysContent" column="sys_content"/>
|
<result property="yzyContent" column="yzy_content"/>
|
<result property="objTag" column="obj_tag"/>
|
<result property="title" column="title"/>
|
<result property="limitTime" column="limit_time"/>
|
<result property="userId" column="user_id"/>
|
<result property="mobile" column="mobile"/>
|
<result property="caseId" column="case_id"/>
|
<result property="caseTaskId" column="case_task_id"/>
|
<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_th_grid_case_task</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
obj_id,
|
obj_type,
|
todo_ype,
|
sys_content,
|
yzy_content,
|
obj_tag,
|
title,
|
limit_time,
|
user_id,
|
mobile,
|
case_id,
|
case_task_id,
|
delete_status,
|
cust_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.objId != null">obj_id = #{entity.objId},</if>
|
<if test="entity.objType != null">obj_type = #{entity.objType},</if>
|
<if test="entity.todoYpe != null">todo_ype = #{entity.todoYpe},</if>
|
<if test="entity.sysContent != null">sys_content = #{entity.sysContent},</if>
|
<if test="entity.yzyContent != null">yzy_content = #{entity.yzyContent},</if>
|
<if test="entity.objTag != null">obj_tag = #{entity.objTag},</if>
|
<if test="entity.title != null">title = #{entity.title},</if>
|
<if test="entity.limitTime != null">limit_time = #{entity.limitTime},</if>
|
<if test="entity.userId != null">user_id = #{entity.userId},</if>
|
<if test="entity.mobile != null">mobile = #{entity.mobile},</if>
|
<if test="entity.caseId != null">case_id = #{entity.caseId},</if>
|
<if test="entity.caseTaskId != null">case_task_id = #{entity.caseTaskId},</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.objId != null and terms.objId !=''">
|
and obj_id = #{terms.objId}
|
</if>
|
<if test="terms.objType != null and terms.objType !=''">
|
and obj_type = #{terms.objType}
|
</if>
|
<if test="terms.todoYpe != null and terms.todoYpe !=''">
|
and todo_ype = #{terms.todoYpe}
|
</if>
|
<if test="terms.sysContent != null and terms.sysContent !=''">
|
and sys_content = #{terms.sysContent}
|
</if>
|
<if test="terms.yzyContent != null and terms.yzyContent !=''">
|
and yzy_content = #{terms.yzyContent}
|
</if>
|
<if test="terms.objTag != null and terms.objTag !=''">
|
and obj_tag = #{terms.objTag}
|
</if>
|
<if test="terms.title != null and terms.title !=''">
|
and title = #{terms.title}
|
</if>
|
<if test="terms.limitTime != null and terms.limitTime !=''">
|
and limit_time = #{terms.limitTime}
|
</if>
|
<if test="terms.userId != null and terms.userId !=''">
|
and user_id = #{terms.userId}
|
</if>
|
<if test="terms.mobile != null and terms.mobile !=''">
|
and mobile = #{terms.mobile}
|
</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.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="updateGridCaseTask">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateGridCaseTaskTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteGridCaseTask">
|
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="getGridUnitIdByUnitId" resultType="string">
|
select third_unit_id from dyh_th_grid_unit where dyh_unit_id = #{unitId} order by length(third_grid_code) asc limit 1
|
</select>
|
</mapper>
|