| | |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.ObjectUtils; |
| | |
| | | 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; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moral.api.entity.ResponsibilityUnit; |
| | | import com.moral.api.pojo.dto.responsibilityUnit.ResponsibilityUnitQuery; |
| | | import com.moral.api.service.ResponsibilityUnitService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | |
| | | */ |
| | | @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(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("query") |
| | | @ApiOperation("显示已有的责任单位") |
| | | public ResultMessage query(){ |
| | | List<ResponsibilityUnitQuery> responsibilityUnitQueries = responsibilityUnitService.unitQuery(); |
| | | return ResultMessage.ok(responsibilityUnitQueries); |
| | | } |
| | | } |