工单模块

This commit is contained in:
2025-12-19 11:11:51 +08:00
parent 41cbe2bd54
commit 409e33abb6
49 changed files with 1934 additions and 323 deletions

View File

@@ -0,0 +1,131 @@
<?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">
<mapper namespace="org.xyzh.workcase.mapper.TbWorkcaseDeviceMapper">
<resultMap id="BaseResultMap" type="org.xyzh.api.workcase.dto.TbWorkcaseDeviceDTO">
<id column="workcase_id" property="workcaseId" jdbcType="VARCHAR"/>
<id column="file_id" property="fileId" jdbcType="VARCHAR"/>
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
<result column="device" property="device" jdbcType="VARCHAR"/>
<result column="device_code" property="deviceCode" jdbcType="VARCHAR"/>
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
<result column="file_root_id" property="fileRootId" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
workcase_id, file_id, optsn, device, device_code, file_name, file_root_id
</sql>
<insert id="insertWorkcaseDevice" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseDeviceDTO">
INSERT INTO workcase.tb_workcase_device (
optsn, workcase_id, device, file_id, file_name
<if test="deviceCode != null">, device_code</if>
<if test="fileRootId != null">, file_root_id</if>
) VALUES (
#{optsn}, #{workcaseId}, #{device}, #{fileId}, #{fileName}
<if test="deviceCode != null">, #{deviceCode}</if>
<if test="fileRootId != null">, #{fileRootId}</if>
)
</insert>
<update id="updateWorkcaseDevice" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseDeviceDTO">
UPDATE workcase.tb_workcase_device
<set>
<if test="device != null and device != ''">device = #{device},</if>
<if test="deviceCode != null">device_code = #{deviceCode},</if>
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="fileRootId != null">file_root_id = #{fileRootId},</if>
</set>
WHERE workcase_id = #{workcaseId} AND file_id = #{fileId}
</update>
<delete id="deleteWorkcaseDevice">
DELETE FROM workcase.tb_workcase_device
WHERE workcase_id = #{workcaseId} AND file_id = #{fileId}
</delete>
<select id="selectWorkcaseDeviceById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_device
WHERE workcase_id = #{workcaseId} AND file_id = #{fileId}
</select>
<select id="selectWorkcaseDeviceList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_device
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.fileId != null and filter.fileId != ''">
AND file_id = #{filter.fileId}
</if>
<if test="filter.fileName != null and filter.fileName != ''">
AND file_name LIKE CONCAT('%', #{filter.fileName}, '%')
</if>
<if test="filter.fileRootId != null and filter.fileRootId != ''">
AND file_root_id = #{filter.fileRootId}
</if>
</where>
ORDER BY workcase_id, file_id
</select>
<select id="selectWorkcaseDevicePage" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_device
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.fileId != null and filter.fileId != ''">
AND file_id = #{filter.fileId}
</if>
<if test="filter.fileName != null and filter.fileName != ''">
AND file_name LIKE CONCAT('%', #{filter.fileName}, '%')
</if>
<if test="filter.fileRootId != null and filter.fileRootId != ''">
AND file_root_id = #{filter.fileRootId}
</if>
</where>
ORDER BY workcase_id, file_id
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
</select>
<select id="countWorkcaseDevices" resultType="long">
SELECT COUNT(*)
FROM workcase.tb_workcase_device
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.fileId != null and filter.fileId != ''">
AND file_id = #{filter.fileId}
</if>
<if test="filter.fileName != null and filter.fileName != ''">
AND file_name LIKE CONCAT('%', #{filter.fileName}, '%')
</if>
<if test="filter.fileRootId != null and filter.fileRootId != ''">
AND file_root_id = #{filter.fileRootId}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,193 @@
<?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">
<mapper namespace="org.xyzh.workcase.mapper.TbWorkcaseMapper">
<resultMap id="BaseResultMap" type="org.xyzh.api.workcase.dto.TbWorkcaseDTO">
<id column="workcase_id" property="workcaseId" jdbcType="VARCHAR"/>
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
<result column="user_id" property="userId" jdbcType="VARCHAR"/>
<result column="username" property="username" jdbcType="VARCHAR"/>
<result column="phone" property="phone" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="VARCHAR"/>
<result column="device" property="device" jdbcType="VARCHAR"/>
<result column="device_code" property="deviceCode" jdbcType="VARCHAR"/>
<result column="imgs" property="imgs" jdbcType="ARRAY" typeHandler="org.xyzh.common.jdbc.handler.StringArrayTypeHandler"/>
<result column="emergency" property="emergency" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="processor" property="processor" jdbcType="VARCHAR"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
</resultMap>
<sql id="Base_Column_List">
workcase_id, optsn, user_id, username, phone, type, device, device_code, imgs,
emergency, status, processor, creator, create_time, update_time, delete_time, deleted
</sql>
<insert id="insertWorkcase" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseDTO">
INSERT INTO workcase.tb_workcase (
optsn, workcase_id, user_id, username, phone, type, device, device_code, creator
<if test="imgs != null">, imgs</if>
<if test="emergency != null">, emergency</if>
<if test="status != null">, status</if>
<if test="processor != null">, processor</if>
) VALUES (
#{optsn}, #{workcaseId}, #{userId}, #{username}, #{phone}, #{type}, #{device}, #{deviceCode}, #{creator}
<if test="imgs != null">, #{imgs, typeHandler=org.xyzh.common.jdbc.handler.StringArrayTypeHandler}</if>
<if test="emergency != null">, #{emergency}</if>
<if test="status != null">, #{status}</if>
<if test="processor != null">, #{processor}</if>
)
</insert>
<update id="updateWorkcase" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseDTO">
UPDATE workcase.tb_workcase
<set>
<if test="userId != null and userId != ''">user_id = #{userId},</if>
<if test="username != null and username != ''">username = #{username},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="device != null and device != ''">device = #{device},</if>
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
<if test="imgs != null">imgs = #{imgs, typeHandler=org.xyzh.common.jdbc.handler.StringArrayTypeHandler},</if>
<if test="emergency != null and emergency != ''">emergency = #{emergency},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="processor != null">processor = #{processor},</if>
update_time = now()
</set>
WHERE workcase_id = #{workcaseId} AND deleted = false
</update>
<update id="deleteWorkcase" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseDTO">
UPDATE workcase.tb_workcase
SET deleted = true, delete_time = now()
WHERE workcase_id = #{workcaseId} AND deleted = false
</update>
<select id="selectWorkcaseById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase
WHERE workcase_id = #{workcaseId} AND deleted = false
</select>
<select id="selectWorkcaseList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.userId != null and filter.userId != ''">
AND user_id = #{filter.userId}
</if>
<if test="filter.username != null and filter.username != ''">
AND username LIKE CONCAT('%', #{filter.username}, '%')
</if>
<if test="filter.phone != null and filter.phone != ''">
AND phone = #{filter.phone}
</if>
<if test="filter.type != null and filter.type != ''">
AND type = #{filter.type}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.emergency != null and filter.emergency != ''">
AND emergency = #{filter.emergency}
</if>
<if test="filter.status != null and filter.status != ''">
AND status = #{filter.status}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
AND deleted = false
</where>
ORDER BY create_time DESC
</select>
<select id="selectWorkcasePage" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.userId != null and filter.userId != ''">
AND user_id = #{filter.userId}
</if>
<if test="filter.username != null and filter.username != ''">
AND username LIKE CONCAT('%', #{filter.username}, '%')
</if>
<if test="filter.phone != null and filter.phone != ''">
AND phone = #{filter.phone}
</if>
<if test="filter.type != null and filter.type != ''">
AND type = #{filter.type}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.emergency != null and filter.emergency != ''">
AND emergency = #{filter.emergency}
</if>
<if test="filter.status != null and filter.status != ''">
AND status = #{filter.status}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
AND deleted = false
</where>
ORDER BY create_time DESC
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
</select>
<select id="countWorkcases" resultType="long">
SELECT COUNT(*)
FROM workcase.tb_workcase
<where>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.userId != null and filter.userId != ''">
AND user_id = #{filter.userId}
</if>
<if test="filter.username != null and filter.username != ''">
AND username LIKE CONCAT('%', #{filter.username}, '%')
</if>
<if test="filter.phone != null and filter.phone != ''">
AND phone = #{filter.phone}
</if>
<if test="filter.type != null and filter.type != ''">
AND type = #{filter.type}
</if>
<if test="filter.device != null and filter.device != ''">
AND device LIKE CONCAT('%', #{filter.device}, '%')
</if>
<if test="filter.deviceCode != null and filter.deviceCode != ''">
AND device_code = #{filter.deviceCode}
</if>
<if test="filter.emergency != null and filter.emergency != ''">
AND emergency = #{filter.emergency}
</if>
<if test="filter.status != null and filter.status != ''">
AND status = #{filter.status}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
AND deleted = false
</where>
</select>
</mapper>

View File

@@ -0,0 +1,130 @@
<?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">
<mapper namespace="org.xyzh.workcase.mapper.TbWorkcaseProcessMapper">
<resultMap id="BaseResultMap" type="org.xyzh.api.workcase.dto.TbWorkcaseProcessDTO">
<id column="process_id" property="processId" jdbcType="VARCHAR"/>
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
<result column="workcase_id" property="workcaseId" jdbcType="VARCHAR"/>
<result column="action" property="action" jdbcType="VARCHAR"/>
<result column="message" property="message" jdbcType="VARCHAR"/>
<result column="files" property="files" jdbcType="ARRAY" typeHandler="org.xyzh.common.jdbc.handler.StringArrayTypeHandler"/>
<result column="processor" property="processor" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
process_id, optsn, workcase_id, action, message, files, processor, remark, creator, create_time
</sql>
<insert id="insertWorkcaseProcess" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseProcessDTO">
INSERT INTO workcase.tb_workcase_process (
optsn, workcase_id, process_id, action, creator
<if test="message != null">, message</if>
<if test="files != null">, files</if>
<if test="processor != null">, processor</if>
<if test="remark != null">, remark</if>
) VALUES (
#{optsn}, #{workcaseId}, #{processId}, #{action}, #{creator}
<if test="message != null">, #{message}</if>
<if test="files != null">, #{files, typeHandler=org.xyzh.common.jdbc.handler.StringArrayTypeHandler}</if>
<if test="processor != null">, #{processor}</if>
<if test="remark != null">, #{remark}</if>
)
</insert>
<update id="updateWorkcaseProcess" parameterType="org.xyzh.api.workcase.dto.TbWorkcaseProcessDTO">
UPDATE workcase.tb_workcase_process
<set>
<if test="action != null and action != ''">action = #{action},</if>
<if test="message != null">message = #{message},</if>
<if test="files != null">files = #{files, typeHandler=org.xyzh.common.jdbc.handler.StringArrayTypeHandler},</if>
<if test="processor != null">processor = #{processor},</if>
<if test="remark != null">remark = #{remark},</if>
</set>
WHERE process_id = #{processId}
</update>
<delete id="deleteWorkcaseProcess">
DELETE FROM workcase.tb_workcase_process
WHERE process_id = #{processId}
</delete>
<select id="selectWorkcaseProcessById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_process
WHERE process_id = #{processId}
</select>
<select id="selectWorkcaseProcessList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_process
<where>
<if test="filter.processId != null and filter.processId != ''">
AND process_id = #{filter.processId}
</if>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.action != null and filter.action != ''">
AND action = #{filter.action}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
<if test="filter.creator != null and filter.creator != ''">
AND creator = #{filter.creator}
</if>
</where>
ORDER BY create_time ASC
</select>
<select id="selectWorkcaseProcessPage" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM workcase.tb_workcase_process
<where>
<if test="filter.processId != null and filter.processId != ''">
AND process_id = #{filter.processId}
</if>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.action != null and filter.action != ''">
AND action = #{filter.action}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
<if test="filter.creator != null and filter.creator != ''">
AND creator = #{filter.creator}
</if>
</where>
ORDER BY create_time ASC
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
</select>
<select id="countWorkcaseProcesses" resultType="long">
SELECT COUNT(*)
FROM workcase.tb_workcase_process
<where>
<if test="filter.processId != null and filter.processId != ''">
AND process_id = #{filter.processId}
</if>
<if test="filter.workcaseId != null and filter.workcaseId != ''">
AND workcase_id = #{filter.workcaseId}
</if>
<if test="filter.action != null and filter.action != ''">
AND action = #{filter.action}
</if>
<if test="filter.processor != null and filter.processor != ''">
AND processor = #{filter.processor}
</if>
<if test="filter.creator != null and filter.creator != ''">
AND creator = #{filter.creator}
</if>
</where>
</select>
</mapper>