<?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: dyh_th_grid_event
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: wangwh
|
* @time:2025-02-21 17:42:19
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.grid.dao.mapper.GridEventMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.grid.domain.po.GridEvent">
|
<result property="id" column="id"/>
|
<result property="eventCode" column="event_code"/>
|
<result property="title" column="title"/>
|
<result property="entryItemName" column="entry_item_name"/>
|
<result property="eventTime" column="event_time"/>
|
<result property="sysOrgId" column="sys_org_id"/>
|
<result property="sysOrgName" column="sys_org_name"/>
|
<result property="eventx" column="eventx"/>
|
<result property="eventy" column="eventy"/>
|
<result property="address" column="address"/>
|
<result property="handleTime" column="handle_time"/>
|
<result property="delayCount" column="delay_count"/>
|
<result property="nowWorkDate" column="now_work_date"/>
|
<result property="yjFlag" column="yj_flag"/>
|
<result property="processingTime" column="processing_time"/>
|
<result property="infoSource" column="info_source"/>
|
<result property="curNodeCustomTag" column="cur_node_custom_tag"/>
|
<result property="eventArea" column="event_area"/>
|
<result property="selectHandleOrgName" column="select_handle_org_name"/>
|
<result property="status" column="status"/>
|
<result property="gridCode" column="grid_code"/>
|
<result property="entryItemCode" column="entry_item_code"/>
|
<result property="caseId" column="case_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<!-- 表 -->
|
<sql id='table-name'>dyh_th_grid_event</sql>
|
<!-- 字段 -->
|
<sql id="column-part">
|
id,
|
event_code,
|
title,
|
entry_item_name,
|
event_time,
|
sys_org_id,
|
sys_org_name,
|
eventx,
|
eventy,
|
address,
|
handle_time,
|
delay_count,
|
now_work_date,
|
yj_flag,
|
processing_time,
|
info_source,
|
cur_node_custom_tag,
|
event_area,
|
select_handle_org_name,
|
status,
|
grid_code,
|
entry_item_code,
|
case_id,
|
create_time,
|
update_time
|
</sql>
|
<!-- 更新实体字段 -->
|
<sql id="set-part">
|
<if test="entity.eventCode != null">event_code = #{entity.eventCode},</if>
|
<if test="entity.title != null">title = #{entity.title},</if>
|
<if test="entity.entryItemName != null">entry_item_name = #{entity.entryItemName},</if>
|
<if test="entity.eventTime != null">event_time = #{entity.eventTime},</if>
|
<if test="entity.sysOrgId != null">sys_org_id = #{entity.sysOrgId},</if>
|
<if test="entity.sysOrgName != null">sys_org_name = #{entity.sysOrgName},</if>
|
<if test="entity.eventx != null">eventx = #{entity.eventx},</if>
|
<if test="entity.eventy != null">eventy = #{entity.eventy},</if>
|
<if test="entity.address != null">address = #{entity.address},</if>
|
<if test="entity.handleTime != null">handle_time = #{entity.handleTime},</if>
|
<if test="entity.delayCount != null">delay_count = #{entity.delayCount},</if>
|
<if test="entity.nowWorkDate != null">now_work_date = #{entity.nowWorkDate},</if>
|
<if test="entity.yjFlag != null">yj_flag = #{entity.yjFlag},</if>
|
<if test="entity.processingTime != null">processing_time = #{entity.processingTime},</if>
|
<if test="entity.infoSource != null">info_source = #{entity.infoSource},</if>
|
<if test="entity.curNodeCustomTag != null">cur_node_custom_tag = #{entity.curNodeCustomTag},</if>
|
<if test="entity.eventArea != null">event_area = #{entity.eventArea},</if>
|
<if test="entity.selectHandleOrgName != null">select_handle_org_name = #{entity.selectHandleOrgName},</if>
|
<if test="entity.status != null">status = #{entity.status},</if>
|
<if test="entity.gridCode != null">grid_code = #{entity.gridCode},</if>
|
<if test="entity.entryItemCode != null">entry_item_code = #{entity.entryItemCode},</if>
|
<if test="entity.caseId != null">case_id = #{entity.caseId}</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.eventCode != null and terms.eventCode !=''">
|
and event_code = #{terms.eventCode}
|
</if>
|
<if test="terms.title != null and terms.title !=''">
|
and title = #{terms.title}
|
</if>
|
<if test="terms.entryItemName != null and terms.entryItemName !=''">
|
and entry_item_name = #{terms.entryItemName}
|
</if>
|
<if test="terms.eventTime != null and terms.eventTime !=''">
|
and event_time = #{terms.eventTime}
|
</if>
|
<if test="terms.sysOrgId != null and terms.sysOrgId !=''">
|
and sys_org_id = #{terms.sysOrgId}
|
</if>
|
<if test="terms.sysOrgName != null and terms.sysOrgName !=''">
|
and sys_org_name = #{terms.sysOrgName}
|
</if>
|
<if test="terms.eventx != null and terms.eventx !=''">
|
and eventx = #{terms.eventx}
|
</if>
|
<if test="terms.eventy != null and terms.eventy !=''">
|
and eventy = #{terms.eventy}
|
</if>
|
<if test="terms.address != null and terms.address !=''">
|
and address = #{terms.address}
|
</if>
|
<if test="terms.handleTime != null and terms.handleTime !=''">
|
and handle_time = #{terms.handleTime}
|
</if>
|
<if test="terms.delayCount != null and terms.delayCount !=''">
|
and delay_count = #{terms.delayCount}
|
</if>
|
<if test="terms.nowWorkDate != null and terms.nowWorkDate !=''">
|
and now_work_date = #{terms.nowWorkDate}
|
</if>
|
<if test="terms.yjFlag != null and terms.yjFlag !=''">
|
and yj_flag = #{terms.yjFlag}
|
</if>
|
<if test="terms.processingTime != null and terms.processingTime !=''">
|
and processing_time = #{terms.processingTime}
|
</if>
|
<if test="terms.infoSource != null and terms.infoSource !=''">
|
and info_source = #{terms.infoSource}
|
</if>
|
<if test="terms.curNodeCustomTag != null and terms.curNodeCustomTag !=''">
|
and cur_node_custom_tag = #{terms.curNodeCustomTag}
|
</if>
|
<if test="terms.eventArea != null and terms.eventArea !=''">
|
and event_area = #{terms.eventArea}
|
</if>
|
<if test="terms.selectHandleOrgName != null and terms.selectHandleOrgName !=''">
|
and select_handle_org_name = #{terms.selectHandleOrgName}
|
</if>
|
<if test="terms.status != null and terms.status !=''">
|
and status = #{terms.status}
|
</if>
|
<if test="terms.gridCode != null and terms.gridCode !=''">
|
and grid_code = #{terms.gridCode}
|
</if>
|
<if test="terms.entryItemCode != null and terms.entryItemCode !=''">
|
and entry_item_code = #{terms.entryItemCode}
|
</if>
|
<if test="terms.caseId != null and terms.caseId !=''">
|
and case_id = #{terms.caseId}
|
</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="updateGridEvent">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<where>
|
id = #{entity.id}
|
</where>
|
</update>
|
<!-- 条件更新对象 -->
|
<update id="updateGridEventTerms">
|
update
|
<include refid="table-name"/>
|
<set>
|
<include refid="set-part"/>
|
</set>
|
<include refid="where-part"/>
|
</update>
|
<!-- 根据编号物理删除 -->
|
<delete id="deleteGridEvent">
|
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="getEventByCaseId" resultMap="dataResult">
|
SELECT
|
<include refid="column-part"/>
|
FROM
|
dyh_th_grid_event
|
where case_id = #{caseId}
|
</select>
|
|
</mapper>
|