提供需求创建者分页查询

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

@ -45,7 +45,8 @@ public class TDemandDataController {
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"), @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.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", 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") // @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) {

View File

@ -22,9 +22,25 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
@Override @Override
public QueryWrapper<TDemandDataEntity> getWrapper(Map<String, Object> params) { public QueryWrapper<TDemandDataEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<TDemandDataEntity> wrapper = new QueryWrapper<>(); QueryWrapper<TDemandDataEntity> wrapper = new QueryWrapper<>();
if (params.containsKey("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")); wrapper.eq("flag", params.get("flag"));
break;
default:
wrapper.eq("flag", 3); // 默认只出审核通过
} }
});
return wrapper; return wrapper;
} }