From eb72e3fb74939365c0953bad6bff1e8736b47a3b Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 26 Apr 2022 11:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E9=9C=80=E6=B1=82=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=80=85=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TDemandDataController.java | 31 ++++++++++--------- .../service/impl/TDemandDataServiceImpl.java | 22 +++++++++++-- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/controller/TDemandDataController.java b/renren-admin/src/main/java/io/renren/modules/demanData/controller/TDemandDataController.java index 1d58d8a7..f0a1bd95 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/controller/TDemandDataController.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/controller/TDemandDataController.java @@ -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> page(@ApiIgnore @RequestParam Map params){ + public Result> page(@ApiIgnore @RequestParam Map params) { PageData page = tDemandDataService.page(params); return new Result>().ok(page); @@ -57,7 +58,7 @@ public class TDemandDataController { @GetMapping("{id}") @ApiOperation("信息") // @RequiresPermissions("demanData:tdemanddata:info") - public Result get(@PathVariable("id") Long id){ + public Result get(@PathVariable("id") Long id) { TDemandDataDTO data = tDemandDataService.get(id); return new Result().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"); diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java index 5c90f10c..6e24b21c 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java @@ -22,9 +22,25 @@ public class TDemandDataServiceImpl extends CrudServiceImpl getWrapper(Map params) { QueryWrapper 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; }