|
@@ -1,23 +1,15 @@
|
|
|
package com.fdkankan.manage.controller;
|
|
|
|
|
|
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.fdkankan.manage.common.ResultCode;
|
|
|
-import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.common.ResultData;
|
|
|
-import com.fdkankan.manage.entity.Case;
|
|
|
import com.fdkankan.manage.service.ICaseService;
|
|
|
-import com.fdkankan.manage.util.Dateutils;
|
|
|
-import com.fdkankan.manage.vo.request.CaseAddParam;
|
|
|
import com.fdkankan.manage.vo.request.CaseParam;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -25,72 +17,18 @@ import java.util.Date;
|
|
|
* </p>
|
|
|
*
|
|
|
* @author
|
|
|
- * @since 2022-10-25
|
|
|
+ * @since 2024-12-04
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/service/manage/case")
|
|
|
public class CaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- ICaseService caseService;
|
|
|
+ ICaseService caseService;
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
- public ResultData list(@RequestBody CaseParam param){
|
|
|
+ public ResultData pageList(@RequestBody CaseParam param){
|
|
|
return ResultData.ok(caseService.pageList(param));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("/addOrUpdate")
|
|
|
- public ResultData addOrUpdate(@RequestBody CaseAddParam param){
|
|
|
- Case caseEntity = new Case();
|
|
|
- BeanUtils.copyProperties(param,caseEntity);
|
|
|
- if(param.getIconIdList() != null && param.getIconIdList().size() >0){
|
|
|
- caseEntity.setIconIds(JSONObject.toJSONString(param.getIconIdList()));
|
|
|
- }
|
|
|
- caseEntity.setCreateTime(null);
|
|
|
- caseEntity.setUpdateTime(null);
|
|
|
- caseEntity.setSysUserId(Integer.valueOf((String)StpUtil.getLoginId()));
|
|
|
- caseService.saveOrUpdate(caseEntity);
|
|
|
- return ResultData.ok();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("/del")
|
|
|
- public ResultData del(@RequestBody CaseAddParam param){
|
|
|
- if(param.getId() == null){
|
|
|
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
- }
|
|
|
- caseService.removeById(param.getId());
|
|
|
- return ResultData.ok();
|
|
|
- }
|
|
|
- @GetMapping("/release")
|
|
|
- public ResultData release(@RequestParam(required = false) Integer id,
|
|
|
- @RequestParam(required = false) Integer isPublic){
|
|
|
- if(id == null || isPublic == null){
|
|
|
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
- }
|
|
|
- LambdaUpdateWrapper<Case> wrapper = new LambdaUpdateWrapper<>();
|
|
|
- wrapper.eq(Case::getId,id);
|
|
|
- wrapper.set(Case::getIsPublic,isPublic);
|
|
|
- if(isPublic == 1){
|
|
|
- wrapper.set(Case::getPublicTime, Dateutils.getDate(new Date()));
|
|
|
- }else {
|
|
|
- wrapper.set(Case::getPublicTime,null);
|
|
|
- }
|
|
|
- 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();
|
|
|
- }
|
|
|
}
|
|
|
|