chenr 2 місяців тому
батько
коміт
4f7860bb08

+ 45 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ServicePlanMapper.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.entity.ServicePlan;
+import org.springblade.manager.vo.ServicePlanVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+public interface ServicePlanMapper extends BaseMapper<ServicePlan> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param servicePlan
+	 * @return
+	 */
+	List<ServicePlan> selectServicePlanPage(IPage page, @Param("servicePlan")ServicePlanDTO servicePlan);
+
+    List<String> getUserID(@Param("projectId") Long projectId, @Param("contractId") Long contractId, @Param("type") int type);
+}

+ 53 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ServicePlanMapper.xml

@@ -0,0 +1,53 @@
+<?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.springblade.manager.mapper.ServicePlanMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="servicePlanResultMap" type="org.springblade.manager.entity.ServicePlan">
+        <result column="id" property="id"/>
+        <result column="status" property="status"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="file_in_type" property="fileInType"/>
+        <result column="plan_start_time" property="planStartTime"/>
+        <result column="plan_end_time" property="planEndTime"/>
+        <result column="send_user" property="sendUser"/>
+    </resultMap>
+
+
+    <select id="selectServicePlanPage" resultMap="servicePlanResultMap">
+        select * from m_service_plan where is_deleted = 0 and project_id = #{servicePlan.projectId} and contract_id = #{servicePlan.contractId}
+                                       and (FIND_IN_SET(write_user,#{servicePlan.userId}) or FIND_IN_SET(send_user,#{servicePlan.userId}))
+        <if test="servicePlan.fileInType != null">
+            and file_in_type = #{servicePlan.fileInType}
+        </if>
+        <if test="servicePlan.status!=null">
+            and status = #{servicePlan.status}
+        </if>
+        <if test="servicePlan.writeUser!=null">
+            and FIND_IN_SET(write_user,#{servicePlan.writeUser})
+        </if>
+        <if test="servicePlan.sendUser!=null">
+            and FIND_IN_SET(send_user,#{servicePlan.sendUser})
+        </if>
+        <if test="servicePlan.planStartTime != null and servicePlan.planEndTime != null">
+            and (
+            (#{servicePlan.planStartTime} between plan_start_time and plan_end_time)
+            or (#{servicePlan.planEndTime} between plan_start_time and plan_end_time)
+            or (plan_start_time between #{servicePlan.planStartTime} and #{servicePlan.planEndTime})
+            or (plan_end_time between #{servicePlan.planStartTime} and #{servicePlan.planEndTime})
+            )
+        </if>
+    </select>
+    <select id="getUserID" resultType="java.lang.String">
+        <if test="type == 1">
+            select send_user from m_service_plan where is_deleted = 0 and project_id = #{projectId} and contract_id = #{contractId}
+        </if>
+        <if test="type == 2">
+            select write_user from m_service_plan where is_deleted = 0 and project_id = #{projectId} and contract_id = #{contractId}
+        </if>
+    </select>
+
+</mapper>