package com.yiboshi.science.rest.v1; import com.yiboshi.arch.base.ResponseDataModel; import com.yiboshi.science.base.Pagination; import com.yiboshi.science.config.annotation.Logs; import com.yiboshi.science.config.security.SecurityUserHolder; import com.yiboshi.science.entity.ComTalentApply; import com.yiboshi.science.enumeration.CommonEnum; import com.yiboshi.science.param.dto.ComProjectDTO; import com.yiboshi.science.param.dto.ComTalentApplyDTO; import com.yiboshi.science.param.dto.DataStatisticsDTO; import com.yiboshi.science.param.query.ComTalentApplyQueryVO; import com.yiboshi.science.rest.BaseController; import com.yiboshi.science.service.ComTalentApplyService; import com.yiboshi.science.utils.StringUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @Api(tags = "com-talent-apply", description = "项目表") @RestController @RequestMapping("/v1/science-admin/com-talent-apply") public class ComTalentApplyController extends BaseController<ComTalentApplyService, ComTalentApplyQueryVO, ComTalentApplyDTO, ComTalentApply> { @Autowired private ComTalentApplyService comTalentApplyService; @ApiOperation(value = "分页查询", httpMethod = "GET", notes = "根据参数获取列表") @GetMapping @RequestMapping(value = "/getListByPage") @PreAuthorize("hasAnyRole('REPORT','ADMIN')") public ResponseDataModel<Pagination<ComTalentApplyDTO>> getListByPage(@Validated ComTalentApplyQueryVO vo, BindingResult bindingResult) { if (!StringUtil.isContainsRole(SecurityUserHolder.getRoles(), CommonEnum.systemRole.sys.getCode().toString())) { vo.setAppPersonId(SecurityUserHolder.getPersonId()); } Pagination<ComTalentApplyDTO> page = comTalentApplyService.getListByPage(vo); return ResponseDataModel.ok(page); } /** * 获取统计数据 */ @ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据") @GetMapping @RequestMapping("/getCount") public ResponseDataModel<DataStatisticsDTO> getCount(@Validated ComTalentApply e) { e.setAppPersonId(SecurityUserHolder.getPersonId()); return ResponseDataModel.ok(comTalentApplyService.getCount(e)); } /** * 根据id获取人才申报信息 * * @param id 查询条件 */ @ApiOperation(value = "根据id获取人才申报信息", httpMethod = "GET", notes = "根据id获取人才申报信息") @GetMapping @RequestMapping("/getTalentApplyById") public ResponseDataModel<ComTalentApplyDTO> getTalentApplyById(@Validated String id) { return ResponseDataModel.ok(comTalentApplyService.getTalentApplyById(id)); } /** * 创建基础人才申报信息 */ @ApiOperation(value = "创建基础人才申报信息", httpMethod = "GET", notes = "创建基础人才申报信息") @GetMapping @RequestMapping("/getNewTalentApply") public ResponseDataModel<ComTalentApplyDTO> getNewTalentApply() { return ResponseDataModel.ok(comTalentApplyService.getNewTalentApply()); } @ApiOperation(value = "保存人才申报信息", httpMethod = "POST", notes = "保存人才申报信息") @PostMapping @RequestMapping("/save") @PreAuthorize("hasAnyRole('REPORT','GOV','ADMIN')") @Logs(value = CommonEnum.logType.talentApply) public ResponseDataModel<String> save(@RequestBody ComTalentApplyDTO comTalentApplyDTO, BindingResult bindingResult) { return ResponseDataModel.ok(comTalentApplyService.save(comTalentApplyDTO)); } }