| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | */ |
| | | @PostMapping("update") |
| | | public ResultMessage updateUnit(@RequestBody ResponsibilityUnit responsibilityUnit){ |
| | | |
| | | Integer integer = responsibilityUnitService.updateUnit(responsibilityUnit); |
| | | if (integer<0){ |
| | | return ResultMessage.fail(ResponseCodeEnum.ROLE_IS_EXIST.getCode(),ResponseCodeEnum.ROLE_IS_EXIST.getMsg()); |
| | |
| | | |
| | | /** |
| | | * 改变状态 |
| | | * @param id |
| | | * @param unitId |
| | | * @return |
| | | */ |
| | | @GetMapping("state") |
| | | public ResultMessage state(Integer id){ |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | public ResultMessage state(Integer unitId){ |
| | | if (ObjectUtils.isEmpty(unitId)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | responsibilityUnitService.updateState(id); |
| | | responsibilityUnitService.updateState(unitId); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 是否作废 |
| | | * @param id |
| | | * @param unitId |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @GetMapping("invalid") |
| | | public ResultMessage invalid(Integer id,String code){ |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | public ResultMessage invalid(Integer unitId,String code){ |
| | | if (ObjectUtils.isEmpty(unitId)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | responsibilityUnitService.updateInvalid(id,code); |
| | | responsibilityUnitService.updateInvalid(unitId,code); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 是否删除 |
| | | * @param id |
| | | * @param unitId |
| | | * @return |
| | | */ |
| | | @GetMapping("delete") |
| | | public ResultMessage delete(Integer id){ |
| | | responsibilityUnitService.removeById(id); |
| | | public ResultMessage delete(Integer unitId){ |
| | | responsibilityUnitService.removeById(unitId); |
| | | return ResultMessage.ok(); |
| | | } |
| | | } |