<?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
|
* @time:2024-09-25 10:00:00
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.cases.dao.mapper.ThGridCitizenEventMapper">
|
<!-- 结果集 -->
|
<resultMap id="dataResult" type="cn.huge.module.cases.domain.po.ThGridCitizenEvent">
|
<result property="caseId" column="case_id"/>
|
<result property="citizenEventCode" column="citizen_event_code"/>
|
<result property="qrcodeImg" column="qrcode_img"/>
|
<result property="title" column="title"/>
|
<result property="reportTime" column="report_time"/>
|
<result property="reportUser" column="report_user"/>
|
<result property="entryItemName" column="entry_item_name"/>
|
<result property="unifiedCode" column="unified_code"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="deleteStatus" column="delete_status"/>
|
</resultMap>
|
|
<!-- 表 -->
|
<sql id='table-name'>dyh_th_grid_citizen_event</sql>
|
|
<!-- 字段 -->
|
<sql id="column-part">
|
case_id,
|
citizen_event_code,
|
qrcode_img,
|
title,
|
report_time,
|
report_user,
|
entry_item_name,
|
unified_code,
|
create_time,
|
update_time,
|
delete_status
|
</sql>
|
|
<!-- 条件查询 -->
|
<select id="listTerms" resultMap="dataResult" parameterType="map">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name"/>
|
<where>
|
delete_status = 0
|
<if test="terms.caseId != null and terms.caseId != ''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
|
and citizen_event_code = #{terms.citizenEventCode}
|
</if>
|
<if test="terms.title != null and terms.title != ''">
|
and title like CONCAT('%',#{terms.title},'%')
|
</if>
|
<if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
|
and report_time >= #{terms.reportTimeStart}
|
</if>
|
<if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
|
and report_time <= #{terms.reportTimeEnd}
|
</if>
|
<if test="terms.reportUser != null and terms.reportUser != ''">
|
and report_user like CONCAT('%',#{terms.reportUser},'%')
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
<!-- 统计条数 -->
|
<select id="countTerms" resultType="long" parameterType="map">
|
select count(*) from
|
<include refid="table-name"/>
|
<where>
|
delete_status = 0
|
<if test="terms.caseId != null and terms.caseId != ''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
|
and citizen_event_code = #{terms.citizenEventCode}
|
</if>
|
<if test="terms.title != null and terms.title != ''">
|
and title like CONCAT('%',#{terms.title},'%')
|
</if>
|
<if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
|
and report_time >= #{terms.reportTimeStart}
|
</if>
|
<if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
|
and report_time <= #{terms.reportTimeEnd}
|
</if>
|
<if test="terms.reportUser != null and terms.reportUser != ''">
|
and report_user like CONCAT('%',#{terms.reportUser},'%')
|
</if>
|
</where>
|
</select>
|
|
<!-- 分页查询 -->
|
<select id="pageTerms" resultMap="dataResult" parameterType="map">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name"/>
|
<where>
|
delete_status = 0
|
<if test="terms.caseId != null and terms.caseId != ''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
|
and citizen_event_code = #{terms.citizenEventCode}
|
</if>
|
<if test="terms.title != null and terms.title != ''">
|
and title like CONCAT('%',#{terms.title},'%')
|
</if>
|
<if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
|
and report_time >= #{terms.reportTimeStart}
|
</if>
|
<if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
|
and report_time <= #{terms.reportTimeEnd}
|
</if>
|
<if test="terms.reportUser != null and terms.reportUser != ''">
|
and report_user like CONCAT('%',#{terms.reportUser},'%')
|
</if>
|
</where>
|
order by create_time desc
|
limit #{page.offset}, #{page.pageSize}
|
</select>
|
|
<!-- 更新对象 -->
|
<update id="updateThGridCitizenEvent" parameterType="cn.huge.module.cases.domain.po.ThGridCitizenEvent">
|
update
|
<include refid="table-name"/>
|
<set>
|
<if test="entity.citizenEventCode != null and entity.citizenEventCode != ''">
|
citizen_event_code = #{entity.citizenEventCode},
|
</if>
|
<if test="entity.qrcodeImg != null and entity.qrcodeImg != ''">
|
qrcode_img = #{entity.qrcodeImg},
|
</if>
|
<if test="entity.title != null and entity.title != ''">
|
title = #{entity.title},
|
</if>
|
<if test="entity.reportTime != null">
|
report_time = #{entity.reportTime},
|
</if>
|
<if test="entity.reportUser != null and entity.reportUser != ''">
|
report_user = #{entity.reportUser},
|
</if>
|
<if test="entity.entryItemName != null and entity.entryItemName != ''">
|
entry_item_name = #{entity.entryItemName},
|
</if>
|
<if test="entity.unifiedCode != null and entity.unifiedCode != ''">
|
unified_code = #{entity.unifiedCode},
|
</if>
|
update_time = now()
|
</set>
|
where case_id = #{entity.caseId}
|
</update>
|
|
<!-- 条件更新 -->
|
<update id="updateThGridCitizenEventTerms" parameterType="map">
|
update
|
<include refid="table-name"/>
|
<set>
|
<if test="entity.citizenEventCode != null and entity.citizenEventCode != ''">
|
citizen_event_code = #{entity.citizenEventCode},
|
</if>
|
<if test="entity.qrcodeImg != null and entity.qrcodeImg != ''">
|
qrcode_img = #{entity.qrcodeImg},
|
</if>
|
<if test="entity.title != null and entity.title != ''">
|
title = #{entity.title},
|
</if>
|
<if test="entity.reportTime != null">
|
report_time = #{entity.reportTime},
|
</if>
|
<if test="entity.reportUser != null and entity.reportUser != ''">
|
report_user = #{entity.reportUser},
|
</if>
|
<if test="entity.entryItemName != null and entity.entryItemName != ''">
|
entry_item_name = #{entity.entryItemName},
|
</if>
|
<if test="entity.unifiedCode != null and entity.unifiedCode != ''">
|
unified_code = #{entity.unifiedCode},
|
</if>
|
update_time = now()
|
</set>
|
<where>
|
delete_status = 0
|
<if test="terms.caseId != null and terms.caseId != ''">
|
and case_id = #{terms.caseId}
|
</if>
|
<if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
|
and citizen_event_code = #{terms.citizenEventCode}
|
</if>
|
</where>
|
</update>
|
|
<!-- 物理删除 -->
|
<delete id="deleteThGridCitizenEvent" parameterType="java.lang.String">
|
delete from
|
<include refid="table-name"/>
|
where case_id = #{caseId}
|
</delete>
|
|
<!-- 根据案件ID查询市民工单信息 -->
|
<select id="getByCaseId" resultMap="dataResult" parameterType="java.lang.String">
|
select
|
<include refid="column-part"/>
|
from
|
<include refid="table-name"/>
|
where case_id = #{caseId} and delete_status = 0
|
</select>
|
</mapper>
|