package com.newfiber.api.pc.controller.zhz; import com.newfiber.api.core.annotation.SysLog; import com.newfiber.api.core.commons.*; import com.newfiber.api.pc.model.meet.Duty; import com.newfiber.api.pc.service.DutyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @Author:zzh * @CreateDate:2020/11/24 13:45 * @Description: */ @RestController @RequestMapping("/meet/duty") @Api(value = "DutyController",tags = "职责状态管理") public class DutyController { @Autowired private DutyService dutyService; @PostMapping("/list") @ApiOperation("分页获取所有职责状态信息") @SysLog(actionType = "4",value = "分页获取所有职责状态信息") public ResultObj<PageResultObject<Duty>> queryPage(@RequestBody PageRequestObject<String> pageRequestObject){ return new ResultObj<PageResultObject<Duty>>(ResultCode.OK,dutyService.queryPage(pageRequestObject)); } @PostMapping("/add") @ApiOperation("添加职责状态") @SysLog(actionType = "1",value = "添加职责状态") public ResultObj addDuty(@RequestParam("dutyName")String dutyName){ if(!StringUtils.isEmpty(dutyName)){ Duty duty = new Duty(); duty.setDutyName(dutyName); boolean insert = dutyService.insert(duty); if(insert){ return ResultObj.ok(); } } return new ResultObj(ResultCode.PARAM_NULL); } @PostMapping("/update") @ApiOperation("修改职责") @SysLog(actionType = "3",value = "修改职责") public ResultObj updateDuty(@RequestBody Duty duty){ if(!StringUtils.isEmpty(duty)){ boolean delete = dutyService.deleteById(duty); if(delete){ return ResultObj.ok(); } } return new ResultObj(ResultCode.UPDATE_ERROR); } @PostMapping("/delete") @ApiOperation("删除职责状态") @SysLog(actionType = "2",value = "删除职责状态") public ResultObj delete(@RequestParam("id")Integer id){ if(StringUtils.isEmpty(id)){ throw new CustomException(ResultCode.PARAM_NULL); } boolean deleteById = dutyService.deleteById(id); if(deleteById){ return ResultObj.ok(); } return new ResultObj(ResultCode.DELETE_ERROR); } @PostMapping("/queryList") @ApiOperation("查询所有的职责状态-不分页") @SysLog(actionType = "4",value = "查询所有的职责状态-不分页") public ResultObj<List<Duty>> list(){ return new ResultObj<List<Duty>>(ResultCode.OK,dutyService.selectList(null)); } }