提供需求创建者分页查询

This commit is contained in:
wangliwen 2022-04-26 11:06:33 +08:00
parent 3e3183c511
commit eb72e3fb74
2 changed files with 35 additions and 18 deletions

View File

@ -27,14 +27,14 @@ import java.util.Map;
/**
* 能力需求评审主体
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-25
*/
* 能力需求评审主体
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-25
*/
@RestController
@RequestMapping("demanData/tdemanddata")
@Api(tags="能力需求评审主体")
@Api(tags = "能力需求评审主体")
public class TDemandDataController {
@Autowired
private TDemandDataService tDemandDataService;
@ -42,13 +42,14 @@ public class TDemandDataController {
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "creator", value = "创建者id", paramType = "query", dataType = "Long")
})
// @RequiresPermissions("demanData:tdemanddata:page")
public Result<PageData<TDemandDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<TDemandDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TDemandDataDTO> page = tDemandDataService.page(params);
return new Result<PageData<TDemandDataDTO>>().ok(page);
@ -57,7 +58,7 @@ public class TDemandDataController {
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("demanData:tdemanddata:info")
public Result<TDemandDataDTO> get(@PathVariable("id") Long id){
public Result<TDemandDataDTO> get(@PathVariable("id") Long id) {
TDemandDataDTO data = tDemandDataService.get(id);
return new Result<TDemandDataDTO>().ok(data);
@ -67,7 +68,7 @@ public class TDemandDataController {
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("demanData:tdemanddata:save")
public Result save(@RequestBody TDemandDataDTO dto){
public Result save(@RequestBody TDemandDataDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -80,7 +81,7 @@ public class TDemandDataController {
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("demanData:tdemanddata:update")
public Result update(@RequestBody TDemandDataDTO dto){
public Result update(@RequestBody TDemandDataDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -93,7 +94,7 @@ public class TDemandDataController {
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("demanData:tdemanddata:delete")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

View File

@ -22,9 +22,25 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
@Override
public QueryWrapper<TDemandDataEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<TDemandDataEntity> wrapper = new QueryWrapper<>();
if (params.containsKey("flag")) {
wrapper.eq("flag", params.get("flag"));
}
// if (params.containsKey("flag")) {
// wrapper.eq("flag", params.get("flag"));
// }
// if (params.containsKey("creator")) {
// wrapper.eq("creator", params.get("creator"));
// }
params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> {
switch (index) {
case "creator":
wrapper.eq("creator", params.get("creator"));
break;
case "flag":
wrapper.eq("flag", params.get("flag"));
break;
default:
wrapper.eq("flag", 3); // 默认只出审核通过
}
});
return wrapper;
}