songhuangfeng123
2022-08-03 81695c67562b55493a2e98263223c5440e28feed
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/ExamineMngController.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
@@ -10,6 +11,7 @@
import com.gkhy.safePlatform.targetDuty.model.dto.req.ExamineMngQueryCriteria;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.ExamineMngDto;
import com.gkhy.safePlatform.targetDuty.service.ExamineMngService;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -17,7 +19,7 @@
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 绩效考核管理-安全考核管理(ExamineMng)表控制层
@@ -45,7 +47,7 @@
      PageUtils.checkCheck(pageQuery);
      return this.examineMngService.queryAll(pageQuery);
    }
    /**
     * 通过主键查询单条数据
@@ -66,7 +68,11 @@
     * @return 修改结果
     */
    @PostMapping(value = "/addOrUpdate")
    public ResultVO update(@RequestBody ExamineMng examineMng) {
    public ResultVO update(Authentication authentication, @RequestBody ExamineMng examineMng) {
        // 获取当前用户
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        examineMng.setExamineDepartmentId(currentUser.getDepId());
        examineMng.setExaminePersonId(currentUser.getUid());
        if (examineMng.getId() == null) {
            return new ResultVO<>(ResultCodes.OK,examineMngService.save(examineMng));
        } else {
@@ -81,10 +87,12 @@
     * @param ids 主键结合
     * @return 删除结果
     */
    @GetMapping(value = "/delete")
    public ResultVO delete(String ids) {
   List<String> idList = Arrays.stream(ids.split(","))
                .collect(Collectors.toList());
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public ResultVO delete(@RequestBody Long[] ids) {
        if(ids == null){
            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL);
        }
        List<Long> idList = Arrays.asList(ids);
        this.examineMngService.removeByIds(idList);
        return new ResultVO<>(ResultCodes.OK);
    }
@@ -98,7 +106,7 @@
        examineTemplateSaveOrUpdate.setExamineDate(new Timestamp(new java.util.Date().getTime()));
        examineTemplateSaveOrUpdate.setExamineTotalNumber("3");
        examineTemplateSaveOrUpdate.setMemo("4");
        examineTemplateSaveOrUpdate.setExaminePersonId("5");
        examineTemplateSaveOrUpdate.setExaminePersonId(5L);
        examineTemplateSaveOrUpdate.setBeExaminedPersonId("6");
        examineTemplateSaveOrUpdate.setExamineDepartmentId(7L);
        examineTemplateSaveOrUpdate.setBeExaminedDepartmentId(8L);
@@ -107,4 +115,4 @@
        System.out.println(JSONObject.toJSONString(examineTemplateSaveOrUpdate));
    }
}
}