package com.gkhy.safePlatform.specialWork.controller;
|
|
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;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import com.gkhy.safePlatform.specialWork.model.dto.req.ApprovalRuleItemAddReqDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.req.ApprovalRuleItemModReqDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.req.DeleteForm;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.ApprovalRuleUnitItemListRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.ApprovalRuleUnitItemPageRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.query.ApprovalRuleItemPageQuery;
|
import com.gkhy.safePlatform.specialWork.model.query.ApprovalRuleItemQuery;
|
import com.gkhy.safePlatform.specialWork.service.RuleItemService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
@RestController
|
@RequestMapping("/work/ruleItem")
|
public class RuleItemController {
|
|
@Autowired
|
private RuleItemService ruleItemService;
|
|
|
@RequestMapping(value = "/page/list",method = RequestMethod.POST)
|
public ResultVO<List<ApprovalRuleUnitItemPageRespDTO>> ruleItemPageList(Authentication authentication, @RequestBody PageQuery<ApprovalRuleItemPageQuery> pageQuery) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(pageQuery);
|
return ruleItemService.listRuleItemByPage(currentUser, pageQuery);
|
}
|
|
|
@RequestMapping(value = "/list",method = RequestMethod.POST)
|
public ResultVO<List<ApprovalRuleUnitItemListRespDTO>> ruleItemList(Authentication authentication, @RequestBody ApprovalRuleItemQuery query) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
List<ApprovalRuleUnitItemListRespDTO> data = ruleItemService.listRuleItem(currentUser, query);
|
return new ResultVO<>(ResultCodes.OK,data);
|
}
|
|
|
@RequestMapping(value = "/save",method = RequestMethod.POST)
|
public ResultVO<String> ruleItemSave(Authentication authentication, @RequestBody ApprovalRuleItemAddReqDTO addReqDTO) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
ruleItemService.saveRuleItem(currentUser,addReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
@RequestMapping(value = "/update",method = RequestMethod.POST)
|
public ResultVO<String> ruleItemUpdate(Authentication authentication,@RequestBody ApprovalRuleItemModReqDTO modReqDTO) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
ruleItemService.updateRuleItem(currentUser, modReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
@RequestMapping(value = "/delete",method = RequestMethod.POST)
|
public ResultVO<String> ruleItemDelete(Authentication authentication, @RequestBody DeleteForm deleteForm) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
ruleItemService.deleteRuleItem(currentUser, deleteForm);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
}
|