1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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));
}
}