From fea22e82e7e49691f6e0c20a29b228d0ab3173e9 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 29 十月 2025 17:08:38 +0800
Subject: [PATCH] 修改问题
---
ycl-server/src/main/resources/mapper/zgyw/TContractMapper.xml | 122 ++++++++++++++--------------------------
1 files changed, 43 insertions(+), 79 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TContractMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TContractMapper.xml
index 712d66b..91e239e 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TContractMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TContractMapper.xml
@@ -1,86 +1,50 @@
<?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">
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.platform.mapper.TContractMapper">
-
- <resultMap type="com.ycl.platform.domain.entity.TContract" id="TContractResult">
- <result property="id" column="id" />
- <result property="companyId" column="company_id" />
- <result property="companyName" column="company_name" />
- <result property="deptId" column="dept_id" />
- <result property="deptName" column="dept_name" />
- <result property="detail" column="detail" />
- <result property="startTime" column="start_time" />
- <result property="endTime" column="end_time" />
- </resultMap>
- <sql id="selectTContractVo">
- select id, company_id, company_name, dept_id, dept_name, detail ,start_time,end_time from t_contract
- </sql>
+ <select id="selectAll" resultType="com.ycl.platform.domain.entity.TContract">
+ select a.*, b.unit_name
+ from t_contract a
+ left join t_yw_unit b on a.unit_id = b.id and b.deleted = 0
+ where a.deleted = 0
+ order by create_time desc
+ </select>
- <select id="selectTContractList" parameterType="com.ycl.platform.domain.entity.TContract" resultMap="TContractResult">
- <include refid="selectTContractVo"/>
- <where>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
- <if test="deptId != null "> and dept_id = #{deptId}</if>
- <if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
- <if test="detail != null and detail != ''"> and detail = #{detail}</if>
- <if test="startTime != null"> and start_time = #{startTime}</if>
- <if test="endTime != null"> and end_time = #{endTime}</if>
+ <select id="getPage" resultType="com.ycl.platform.domain.vo.ContractVO">
+ select a.*, b.unit_name
+ from t_contract a
+ left join t_yw_unit b on a.unit_id = b.id and b.deleted = 0
+ where a.deleted = 0
+ <if test="query.unitId != null">
+ and a.unit_id = #{query.unitId}
+ </if>
+ <if test="query.name != null and query.name != ''">
+ and a.name like concat('%', #{query.name}, '%')
+ </if>
+ <if test="query.status != null and query.status != ''">
+ <choose>
+ <when test="query.status == 'ACTIVE'">
+ and a.start_time < sysdate() and a.end_time > sysdate()
+ </when>
+ <when test="query.status == 'NOT_START'">
+ and a.start_time > sysdate()
+ </when>
+ <when test="query.status == 'FINISHED'">
+ and a.end_time < sysdate()
+ </when>
+ </choose>
+ </if>
+ order by create_time desc
+ </select>
+
+ <select id="getCalculateRule" resultType="com.ycl.platform.domain.vo.CalculateRuleVO">
+ select tc.unit_id ,tcr.*
+ from t_contract tc
+ left join t_calculate_rule tcr on tc.id = tcr.contract_id and tcr.deleted =0
+ <where>
+ tc.deleted =0 and #{date} between tc.start_time and tc.end_time
</where>
</select>
-
- <select id="selectTContractById" parameterType="Long" resultMap="TContractResult">
- <include refid="selectTContractVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertTContract" parameterType="com.ycl.platform.domain.entity.TContract" useGeneratedKeys="true" keyProperty="id">
- insert into t_contract
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="companyId != null">company_id,</if>
- <if test="companyName != null">company_name,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="deptName != null">dept_name,</if>
- <if test="detail != null">detail,</if>
- <if test="startTime != null">start_time,</if>
- <if test="endTime != null">end_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="companyId != null">#{companyId},</if>
- <if test="companyName != null">#{companyName},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="deptName != null">#{deptName},</if>
- <if test="detail != null">#{detail},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="endTime != null">#{endTime},</if>
- </trim>
- </insert>
-
- <update id="updateTContract" parameterType="com.ycl.platform.domain.entity.TContract">
- update t_contract
- <trim prefix="SET" suffixOverrides=",">
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyName != null">company_name = #{companyName},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="detail != null">detail = #{detail},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- </trim>
- where id = #{id}
- </update>
-
- <delete id="deleteTContractById" parameterType="Long">
- delete from t_contract where id = #{id}
- </delete>
-
- <delete id="deleteTContractByIds" parameterType="String">
- delete from t_contract where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-</mapper>
\ No newline at end of file
+</mapper>
--
Gitblit v1.8.0