Просмотр исходного кода

feat(schedule): 增加启用排班配置功能

- 在 IScheduleConfigService 接口中,修改 stopScheduleConfig 方法,添加 type 参数
- 在 ScheduleConfigController 中,添加 startScheduleConfig 方法,用于启用排班配置
- 在 ScheduleConfigServiceImpl 中,实现 stopScheduleConfig 方法,根据 type 参数决定是否启用排班配置
- 修改 ScheduleConfigMapper.xml,更新 selectScheduleConfigById 查询,加入 enabled 条件
fugui001 4 месяцев назад
Родитель
Сommit
55e6289c5a

+ 7 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/ScheduleConfigController.java

@@ -176,7 +176,13 @@ public class ScheduleConfigController extends BaseController {
 
     @PostMapping("/stopScheduleConfig/{id}")
     public R<Void> stopScheduleConfig(@PathVariable Long id) {
-        return toAjax(scheduleConfigService.stopScheduleConfig(id));
+        return toAjax(scheduleConfigService.stopScheduleConfig(id,0));
+    }
+
+
+    @PostMapping("/startScheduleConfig/{id}")
+    public R<Void> startScheduleConfig(@PathVariable Long id) {
+        return toAjax(scheduleConfigService.stopScheduleConfig(id,1));
     }
 
 }

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/IScheduleConfigService.java

@@ -118,7 +118,7 @@ public interface IScheduleConfigService {
      * @param configId
      * @return
      */
-    Boolean stopScheduleConfig(Long configId);
+    Boolean stopScheduleConfig(Long configId,int type);
 
 
 

+ 7 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/ScheduleConfigServiceImpl.java

@@ -582,10 +582,15 @@ public class ScheduleConfigServiceImpl implements IScheduleConfigService {
     }
 
     @Override
-    public Boolean stopScheduleConfig(Long configId) {
+    public Boolean stopScheduleConfig(Long configId,int type) {
+        //是否使用   0 false   1 true
         ScheduleConfig scheduleConfig = new ScheduleConfig();
         scheduleConfig.setId(configId);
-        scheduleConfig.setEnabled(false);
+        if(type==0){
+            scheduleConfig.setEnabled(false);
+        }else{
+            scheduleConfig.setEnabled(true);
+        }
         int scheduleConfig1 = baseMapper.updateScheduleConfig(scheduleConfig);
         return scheduleConfig1>0?true:false;
     }

+ 4 - 4
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/ScheduleConfigMapper.xml

@@ -12,10 +12,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <!-- 根据 id 查询单条记录 -->
     <select id="selectScheduleConfigById" parameterType="long" resultType="org.dromara.business.domain.vo.ScheduleConfigVo">
-        SELECT id, template_id, creation_scheme_id, start_date, end_date, enabled, created_at, updated_at
-        FROM schedule_config
-        WHERE id = #{id}
-    </select>
+        SELECT a.id, a.template_id,a.creation_scheme_id, a.start_date, a.end_date, a.enabled, a.created_at, a.updated_at
+        FROM schedule_config  a left join tournaments_template b  on a.template_id=b.id
+        WHERE a.id =  #{id}  and a.enabled=TRUE
+   </select>
 
 
     <!-- 查询所有字段 -->