Преглед на файлове

版本说明,同一类型只有一个启用

lyhzzz преди 2 години
родител
ревизия
8b5b29de4e

+ 3 - 0
src/main/java/com/fdkankan/manage/controller/ServiceUpTipController.java

@@ -43,6 +43,9 @@ public class ServiceUpTipController {
     public ResultData saveOrUpdate(@RequestBody ServiceUpTip param){
         param.setCreateTime(null);
         param.setUpdateTime(null);
+        if(param.getBanStatus() !=null && param.getBanStatus() == 0){
+            serviceUpTipService.banOther(param.getType());
+        }
         serviceUpTipService.saveOrUpdate(param);
         return ResultData.ok();
 

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IServiceUpTipService.java

@@ -17,4 +17,6 @@ public interface IServiceUpTipService extends IService<ServiceUpTip> {
     Object pageList(ServiceUPTipParam param);
 
     Object getServiceUpTipByType(Integer type);
+
+    void banOther(Integer type);
 }

+ 10 - 0
src/main/java/com/fdkankan/manage/service/impl/ServiceUpTipServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.manage.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.entity.ServiceUpTip;
@@ -55,4 +56,13 @@ public class ServiceUpTipServiceImpl extends ServiceImpl<IServiceUpTipMapper, Se
         }
         return list.get(0);
     }
+
+    @Override
+    public void banOther(Integer type) {
+        LambdaUpdateWrapper<ServiceUpTip> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(ServiceUpTip::getType,type);
+        wrapper.eq(ServiceUpTip::getBanStatus,0);
+        wrapper.set(ServiceUpTip::getBanStatus,1);
+        this.update(wrapper);
+    }
 }