| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrProject; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voIr.VoProject; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrIrrigate.result.IrrigateResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.util.*; |
| | |
| | | @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete_batch(@RequestBody List<Long> projectIds) { |
| | | public BaseResponse<Boolean> delete_batch(@RequestBody Map<String,List> projectIds) { |
| | | if (projectIds == null || projectIds.size() <= 0) { |
| | | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); |
| | | } |
| | | for (int i = 0; i < projectIds.size(); i++) { |
| | | Long projectId = projectIds.get(i); |
| | | List ids = projectIds.get("projectIds"); |
| | | for (int i = 0; i < ids.size(); i++) { |
| | | long projectId = Long.parseLong(ids.get(i).toString()); |
| | | try { |
| | | Integer rows = projectSv.deleteProject(projectId); |
| | | if (rows == 0) { |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 获取一个项目数据 |
| | | * |
| | | * @return 获取一个项目数据 |
| | | */ |
| | | @Operation(summary = "获取一个项目数据", description = "获取一个项目数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获取一个项目数据(BaseResponse.content:{})", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = IrProject.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one") |
| | | @SsoAop() |
| | | public BaseResponse<IrProject> one(@RequestParam Long id) { |
| | | IrProject irProject = this.projectSv.selectById(id); |
| | | if (irProject == null) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage()); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(irProject); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页项目记录", description = "获得一页项目记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获得一页项目记录(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "some") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoProject>>> getIntakes(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoProject>> res = projectSv.getProjects(vo); |
| | | if (res == null) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取项目记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |