lyhzzz 2 роки тому
батько
коміт
3736982847

+ 12 - 0
src/main/java/com/fdkankan/manage/controller/CaseController.java

@@ -70,5 +70,17 @@ public class CaseController {
         caseService.update(wrapper);
         return ResultData.ok();
     }
+    @GetMapping("/isShow")
+    public ResultData isShow(@RequestParam(required = false) Integer id,
+                              @RequestParam(required = false) Integer isShow){
+        if(id == null || isShow == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaUpdateWrapper<Case> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(Case::getId,id);
+        wrapper.set(Case::getIsShow,isShow);
+        caseService.update(wrapper);
+        return ResultData.ok();
+    }
 }
 

+ 2 - 0
src/main/java/com/fdkankan/manage/entity/Case.java

@@ -81,5 +81,7 @@ public class Case implements Serializable {
     @TableField("public_time")
     private String publicTime;
 
+    @TableField("is_show")
+    private Integer isShow;
 
 }

+ 3 - 1
src/main/java/com/fdkankan/manage/service/impl/CaseServiceImpl.java

@@ -47,7 +47,9 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
         if(StringUtils.isNotBlank(param.getEndTime())){
             wrapper.lt(Case::getPublicTime,param.getEndTime());
         }
-        wrapper.orderByAsc(Case::getSort);
+        wrapper.orderByDesc(Case::getSort);
+        wrapper.orderByDesc(Case::getIsPublic);
+        wrapper.orderByDesc(Case::getPublicTime);
         wrapper.orderByDesc(Case::getCreateTime);
         Page<Case> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);