From 1e3eeec2d3a470d066d21900586b912dfef58c91 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 17 四月 2025 15:07:41 +0800
Subject: [PATCH] 优化代码
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrCropMapper.xml | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrCropMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrCropMapper.xml
new file mode 100644
index 0000000..da5e8f4
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrCropMapper.xml
@@ -0,0 +1,110 @@
+<?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.daoIr.IrCropMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrCrop">
+ <!--@mbg.generated-->
+ <!--@Table ir_crop-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="crop_name" jdbcType="VARCHAR" property="cropName" />
+ <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+ <result column="deleted" jdbcType="TINYINT" property="deleted" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, crop_name, remarks, deleted
+ </sql>
+ <!--娣诲姞-->
+ <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop">
+ insert into ir_crop
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="cropName != null">
+ crop_name,
+ </if>
+ <if test="remarks != null">
+ remarks,
+ </if>
+ <if test="deleted != null">
+ deleted,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=BIGINT},
+ </if>
+ <if test="cropName != null">
+ #{cropName,jdbcType=VARCHAR},
+ </if>
+ <if test="remarks != null">
+ #{remarks,jdbcType=VARCHAR},
+ </if>
+ <if test="deleted != null">
+ #{deleted,jdbcType=TINYINT},
+ </if>
+ </trim>
+ </insert>
+ <!--閫昏緫鍒犻櫎-->
+ <delete id="deleteLogicById" parameterType="java.lang.Long">
+ <!--@mbg.generated-->
+ update ir_crop
+ set deleted = 1
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+
+ <!--淇敼淇℃伅-->
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop">
+ update ir_crop
+ <set>
+ <if test="cropName != null">
+ crop_name = #{cropName,jdbcType=VARCHAR},
+ </if>
+ <if test="remarks != null">
+ remarks = #{remarks,jdbcType=VARCHAR},
+ </if>
+ <if test="deleted != null">
+ deleted = #{deleted,jdbcType=TINYINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <select id="getRecordCount" resultType="java.lang.Long">
+ SELECT COUNT(*) AS recordCount
+ FROM ir_crop cro
+ <where>
+ cro.deleted = 0
+ <if test="cropName != null and cropName != ''">
+ AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%')
+ </if>
+ </where>
+ </select>
+
+ <select id="getCrops" resultType="com.dy.pipIrrGlobal.voIr.VoCrop">
+ SELECT
+ CAST(cro.id AS char)AS id,
+ cro.crop_name AS cropName,
+ cro.remarks
+ FROM ir_crop cro
+ <where>
+ cro.deleted = 0
+ <if test="cropName != null and cropName != ''">
+ AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%')
+ </if>
+ </where>
+ <if test="pageCurr != null and pageSize != null">
+ LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
+ </if>
+ </select>
+
+ <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoCropOne">
+ select
+ CAST(cro.id AS char)AS id,
+ cro.crop_name AS cropName,
+ cro.remarks
+ from ir_crop cro
+ where cro.id = #{id,jdbcType=BIGINT} and cro.deleted = 0
+
+ </select>
+</mapper>
\ No newline at end of file
--
Gitblit v1.8.0