From 4a2deb11b819dd78a8c75e244ef67ec2e48cf5f5 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 14 四月 2025 21:03:28 +0800 Subject: [PATCH] 重构轮灌组修改接口 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml | 194 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 194 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml new file mode 100644 index 0000000..c11b0d3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml @@ -0,0 +1,194 @@ +<?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="com.dy.pipIrrGlobal.daoOp.OpeInspectMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> + <!--@mbg.generated--> + <!--@Table ope_inspect--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="inspector_id" jdbcType="BIGINT" property="inspectorId" /> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> + <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" /> + <result column="inspect_distance" jdbcType="FLOAT" property="inspectDistance" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, inspector_id, start_time, stop_time, inspect_distance + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ope_inspect + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ope_inspect + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> + <!--@mbg.generated--> + insert into ope_inspect (id, inspector_id, start_time, + stop_time, inspect_distance) + values (#{id,jdbcType=BIGINT}, #{inspectorId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, + #{stopTime,jdbcType=TIMESTAMP}, #{inspectDistance,jdbcType=FLOAT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> + <!--@mbg.generated--> + insert into ope_inspect + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="inspectorId != null"> + inspector_id, + </if> + <if test="startTime != null"> + start_time, + </if> + <if test="stopTime != null"> + stop_time, + </if> + <if test="inspectDistance != null"> + inspect_distance, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="inspectorId != null"> + #{inspectorId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="stopTime != null"> + #{stopTime,jdbcType=TIMESTAMP}, + </if> + <if test="inspectDistance != null"> + #{inspectDistance,jdbcType=FLOAT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> + <!--@mbg.generated--> + update ope_inspect + <set> + <if test="inspectorId != null"> + inspector_id = #{inspectorId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + start_time = #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="stopTime != null"> + stop_time = #{stopTime,jdbcType=TIMESTAMP}, + </if> + <if test="inspectDistance != null"> + inspect_distance = #{inspectDistance,jdbcType=FLOAT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> + <!--@mbg.generated--> + update ope_inspect + set inspector_id = #{inspectorId,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + stop_time = #{stopTime,jdbcType=TIMESTAMP}, + inspect_distance = #{inspectDistance,jdbcType=FLOAT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!-- 鏌ヨ鎬绘暟 --> + <select id="getInspectsCount" resultType="java.lang.Long"> + SELECT + count(*) + FROM `ope_inspect` oi + INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id + <where> + ba_user.deleted = 0 + <if test="inspectorId != null"> + AND oi.inspector_id = #{inspectorId} + </if> + <if test="inspectId != null"> + AND oi.id = #{inspectId} + </if> + <if test="inspectorName != null"> + AND ba_user.`name` LIKE CONCAT('%',#{inspectorName},'%') + </if> + <if test="timeStart != null and timeStop != null"> + AND oi.start_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + </select> + + <!-- 鏌ヨ鍒楄〃 --> + <select id="getInspects" resultType="com.dy.pipIrrGlobal.voOp.VoInspect"> + SELECT + oi.inspector_id AS inspectorId, + ba_user.`name` AS inspectorName, + oi.id AS inspectId, + oi.start_time AS startTime, + oi.stop_time AS stopTime, + oi.inspect_distance AS inspectDistance + FROM `ope_inspect` oi + INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id + <where> + ba_user.deleted = 0 + <if test="inspectorId != null"> + AND oi.inspector_id = #{inspectorId} + </if> + <if test="inspectId != null"> + AND oi.id = #{inspectId} + </if> + <if test="inspectorName != null"> + AND ba_user.`name` LIKE CONCAT('%',#{inspectorName},'%') + </if> + <if test="timeStart != null and timeStop != null"> + AND oi.start_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + + <!--鏇存柊鎸囧畾宸℃璁板綍鐨勫贰妫�璺濈--> + <update id="updateInspectDistance"> + UPDATE ope_inspect + SET inspect_distance = #{distance} + WHERE id = #{inspectId} + </update> + + <!--鏍规嵁宸℃鍛業D鑾峰彇宸℃璁板綍鏁伴噺--> + <select id="getInstectsCountByInspectorId" resultType="java.lang.Long"> + SELECT + count(*) + FROM ope_inspect ins + LEFT JOIN ba_user user ON user.id = ins.inspector_id + WHERE ins.inspector_id = #{inspectorId} + </select> + + <!--鏍规嵁宸℃鍛業D鑾峰彇宸℃鍒楄〃--> + <select id="getInstectsByInspectorId" resultType="com.dy.pipIrrGlobal.voOp.VoInspect"> + SELECT + user.id AS inspectorId, + user.name AS inspectorName, + ins.id AS inspectId, + ins.start_time AS startTime, + ins.stop_time AS stopTime, + ins.inspect_distance AS inspectDistance + FROM ope_inspect ins + LEFT JOIN ba_user user ON user.id = ins.inspector_id + WHERE ins.inspector_id = #{inspectorId} + ORDER BY ins.start_time DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> +</mapper> \ No newline at end of file -- Gitblit v1.8.0