From 585f08af50da99f2c2b94c5df80424e459d5bf69 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 27 Oct 2022 09:26:11 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E5=B1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/service/impl/ResourceServiceImpl.java | 5 +++-- renren-admin/src/main/resources/application-dev.yml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index cee417f9..670f7f0d 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -56,6 +56,7 @@ import okhttp3.*; import org.activiti.engine.HistoryService; import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.history.HistoricProcessInstanceQuery; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -2002,8 +2003,8 @@ public class ResourceServiceImpl extends CrudServiceImpl resultList = new ArrayList<>(); - Boolean nonChinese_ = Boolean.getBoolean(nonChinese);// 不传默认为中文走全文索引 + List resultList = new CopyOnWriteArrayList<>(); + Boolean nonChinese_ = BooleanUtils.toBoolean(nonChinese.toLowerCase());// 不传默认为中文走全文索引 CompletableFuture DBresourceCount = CompletableFuture.runAsync(() -> resultList.addAll(resourceDao.selectTypeCountByName(keyWorld, nonChinese_))); final Integer[] meetCountNew = new Integer[1]; switch (Constant.ProjectPlace.getByFlag(projectPlace)) { diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index f4e58d73..a21e26f4 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -6,9 +6,9 @@ spring: #MySQL driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://192.168.124.236:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false + url: jdbc:mysql://192.168.124.46:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false username: root - password: Hisense2019 + password: Liwen073898! #Hisense2019 # #Oracle # driver-class-name: oracle.jdbc.OracleDriver From f39b22751f135424962ad48a8509afb119817764 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 27 Oct 2022 10:54:48 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E5=A2=9E=E5=8A=A0=E4=BC=9A=E8=AE=AE?= =?UTF-8?q?=E5=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActTaskController.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 0d710aaa..4fef4fe1 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -1,5 +1,6 @@ package io.renren.modules.activiti.controller; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; @@ -30,6 +31,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 任务管理 @@ -98,6 +100,34 @@ public class ActTaskController { taskDTO.setAssigneeName(userDTO.getRealName()); } } + if (!(params.containsKey("processDefinitionKey") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("processDefinitionKey").toString()))) { + int meetingroom_book = jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Integer.class); + page.setTotal(page.getTotal() + meetingroom_book); + Integer limit = 10; + if (params.get(Constant.LIMIT) != null) { + limit = Integer.parseInt((String) params.get(Constant.LIMIT)); + } + if (page.getList().size() < limit) { + List> meetingroom_bookTask = jdbcTemplate.queryForList("SELECT " + + " t_meetingroom_book.id AS `taskId`, " + + " t_meetingroom_book.dept AS `userDeptName`, " + + " t_meetingroom.`name` AS `userName`, " + + " '会议室审核' AS `taskName `, " + + " t_meetingroom.create_date AS `createTime` " + + "FROM " + + " t_meetingroom_book " + + " LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " + + "WHERE " + + " state = 1;"); + List meetingroom_bookTaskDto = meetingroom_bookTask + .stream().map(index -> { + TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class); + return taskDTO; + }).collect(Collectors.toList()); + page.getList().addAll(meetingroom_bookTaskDto); + page.setList(page.getList()); + } + } return new Result>().ok(page); } From d07548e6eb660f6387a85b6be24eff0f2720a8bf Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 27 Oct 2022 11:34:36 +0800 Subject: [PATCH 03/14] =?UTF-8?q?pageWithAttrs=20=E9=9D=9E=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=95=B0=E9=87=8F=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/dao/ResourceDao.java | 2 +- .../service/impl/ResourceServiceImpl.java | 2 +- .../resources/mapper/resource/ResourceDao.xml | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index 47a3b5b6..22682303 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -53,7 +53,7 @@ public interface ResourceDao extends BaseDao { */ List selectDTOPageSpecilTotal(@Param("dto") ResourceDTO resourceDTO); - Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO); + Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO, @Param("nonChinese") Boolean nonChinese); List selectApplyArea(Long userId); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 670f7f0d..7c116eaf 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -554,7 +554,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, nonChinese); diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 52404ca8..f0ee8b64 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -539,9 +539,12 @@ WHERE 1 = 1 AND tdr.del_flag = 0 - + AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE) + + AND tdr.name LIKE CONCAT( '%', #{dto.name}, '%' ) + AND tdr.type = #{dto.type} @@ -1621,14 +1624,14 @@ tb_data_attr tda LEFT JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id WHERE 1 = 1 - - AND tda.attr_type = '应用图片' + + AND tda.attr_type = '应用图片' - - AND tda.attr_type = '图层缩略图' + + AND tda.attr_type = '图层缩略图' - - AND tda.attr_type = '应用场景' + + AND tda.attr_type = '应用场景' AND tdr.id = #{id} AND tda.del_flag = 0 From 0c88de3898bb4d9ae579e97c137dcdcc9e748760 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 27 Oct 2022 14:50:01 +0800 Subject: [PATCH 04/14] ... --- .../modules/activiti/controller/ActTaskController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 4fef4fe1..be2a19b7 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -124,8 +124,9 @@ public class ActTaskController { TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class); return taskDTO; }).collect(Collectors.toList()); - page.getList().addAll(meetingroom_bookTaskDto); - page.setList(page.getList()); + List temp = page.getList(); + temp.addAll(meetingroom_bookTaskDto); + page.setList(temp); } } return new Result>().ok(page); From 5ac3e333c2112a177d692fc8ef6ace475b6f0d69 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Thu, 27 Oct 2022 14:56:55 +0800 Subject: [PATCH 05/14] npe --- .../renren/modules/activiti/controller/HistoryController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java index df5076df..b806fcb7 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java @@ -200,7 +200,7 @@ public class HistoryController { if (StringUtils.isNotEmpty(activityDTO.getStartUserId())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getStartUserId())); activityDTO.setStartUserName(userDTO != null ? userDTO.getRealName() : ""); - activityDTO.setStartUserDeptName(sysUserDao.getDeptNameByUserId(userDTO.getId().toString())); + activityDTO.setStartUserDeptName(userDTO != null ? sysUserDao.getDeptNameByUserId(userDTO.getId().toString()) : ""); } if (StringUtils.isNotEmpty(activityDTO.getAssignee())) { SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getAssignee())); From 72947ca3944c4e399d84c14e8f8229985e305385 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Thu, 27 Oct 2022 17:51:24 +0800 Subject: [PATCH 06/14] npe --- .../controller/TResourceMountApplyController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java index 1464eed4..30b216f2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java @@ -68,7 +68,7 @@ public class TResourceMountApplyController { // @RequiresPermissions("resourceMountApply:tresourcemountapply:info") public Result get(@PathVariable("id") Long id) { TResourceMountApplyDTO data = tResourceMountApplyService.get(id); - if (data.getDeptId() != null) { + if (data != null && data.getDeptId() != null) { SysDeptDTO sysDeptDTO = sysDeptService.get(Long.valueOf(data.getDeptId())); if (sysDeptDTO != null) { ResourceDTO resourceDTO = data.getResourceDTO(); From f3fbf82b3a117e37a7ec86aeb226e09a06f85d01 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Thu, 27 Oct 2022 20:34:58 +0800 Subject: [PATCH 07/14] =?UTF-8?q?1.=E9=97=A8=E6=88=B7=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD=E7=BB=9F=E8=AE=A1=E4=BC=9A?= =?UTF-8?q?=E5=AE=A2=E5=8E=85=E6=95=B0=E9=87=8F=E9=94=99=E8=AF=AF=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/service/impl/ResourceServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 7c116eaf..1288feff 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1899,6 +1899,7 @@ public class ResourceServiceImpl extends CrudServiceImpl hkt = CompletableFuture.runAsync(() -> { QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("del_flag", 0); resultMap.put("会客厅", tMeetingroomMapper.selectCount(wrapper)); }, executor); From 29458b0fc9cebefe3c1fc005fb78718abf0c2ac2 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 28 Oct 2022 11:49:16 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E8=A2=AB=E6=8B=92=E7=BB=9D=E6=97=B6=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=AE=B0=E5=BD=95=20del=5Fflg=20=E7=BD=AE1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/renren/modules/activiti/service/ActTaskService.java | 5 +++++ .../resources/mapper/processForm/TAbilityApplicationDao.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 0912f227..d16f2f63 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -59,6 +59,7 @@ import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -122,6 +123,8 @@ public class ActTaskService extends BaseServiceImpl { private ResourceDao resourceDao; @Autowired private SysNoticeService sysNoticeService; + @Autowired + private JdbcTemplate jdbcTemplate; /** * 根据参数获取当前运行的任务信息 @@ -685,6 +688,7 @@ public class ActTaskService extends BaseServiceImpl { pvmTransitionListC.clear(); pvmTransitionListC.addAll(oriPvmTransitionList); } + jdbcTemplate.update(String.format("UPDATE t_ability_application SET del_flag = 1 WHERE instance_id = %s ;", task.getProcessInstanceId())); sysNoticeService.updateApplyStateById(task.getProcessInstanceId(), 1); } @@ -743,6 +747,7 @@ public class ActTaskService extends BaseServiceImpl { pvmTransitionListC.clear(); pvmTransitionListC.addAll(oriPvmTransitionList); } + jdbcTemplate.update(String.format("UPDATE t_ability_application SET del_flag = 1 WHERE instance_id = %s ;", instanceId)); sysNoticeService.updateApplyStateById(instanceId, 1); } diff --git a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml index a2d39ac4..a2ff7228 100644 --- a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml +++ b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml @@ -274,6 +274,7 @@ AND t_ability_application.user_id = #{userId} AND t_ability_application.resource_id = #{resourceId} AND tb_data_resource.type != '基础设施' + AND t_ability_application.del_flag = 0 + + + update sys_notice set apply_state = #{applyState} where receiver_type_ids like concat('%', #{userId}, '%') and apply_id=#{applyId} + \ No newline at end of file From 23bd3c44a0d30b7cbc39eeb3903ca2a194dc0539 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Fri, 28 Oct 2022 17:29:21 +0800 Subject: [PATCH 12/14] bug fix --- .../src/main/resources/mapper/resource/ResourceDao.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index f0ee8b64..70976a8b 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1763,17 +1763,19 @@ END ) AS "type" FROM - (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag FROM tb_data_resource d LEFT JOIN + (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.dept_id, d.del_flag FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr, sys_dept sd, sys_user su, - t_ability_application taa + t_ability_application taa, + sys_dept dept WHERE 1 = 1 AND tdr.del_flag = 0 AND taa.user_id = su.id AND su.dept_id = sd.id AND taa.resource_id = tdr.id + AND dept.id = tdr.dept_id AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR tdr.type = '业务组件') From b15402adad89ddf3c1b2a8c0e749a7f963a06d19 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 29 Oct 2022 10:50:43 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=86=85=E4=B9=9F=E8=BF=94=E5=9B=9E=E5=AF=B9=E5=BA=94=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/controller/SysDictTypeController.java | 15 ++++++++++++--- .../io/renren/modules/sys/dto/SysDictTypeDTO.java | 6 ++++++ .../modules/sys/service/SysDictDataService.java | 3 +++ .../sys/service/impl/SysDictDataServiceImpl.java | 9 +++++++++ .../sys/service/impl/SysDictTypeServiceImpl.java | 6 +++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDictTypeController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDictTypeController.java index 87ce47e5..f29104f0 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDictTypeController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDictTypeController.java @@ -10,6 +10,7 @@ import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.UpdateGroup; import io.renren.modules.sys.dto.SysDictTypeDTO; import io.renren.modules.sys.entity.DictType; +import io.renren.modules.sys.service.SysDictDataService; import io.renren.modules.sys.service.SysDictTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -21,6 +22,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 字典类型 @@ -31,6 +33,8 @@ import java.util.Map; public class SysDictTypeController { @Autowired private SysDictTypeService sysDictTypeService; + @Autowired + private SysDictDataService sysDictDataService; @GetMapping("page") @ApiOperation("字典类型分页查询") @@ -41,13 +45,18 @@ public class SysDictTypeController { @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataType = "String") + @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:dict:page") public Result> page(@ApiIgnore @RequestParam Map params) { //字典类型 PageData page = sysDictTypeService.page(params); - + page.setList(page.getList().stream().map(index -> { + index.setSysDictDataDTOList(sysDictDataService.selectByDictTypeId(index.getId().toString())); + return index; + }).collect(Collectors.toList())); // return new Result>().ok(page); } @@ -57,7 +66,7 @@ public class SysDictTypeController { // @RequiresPermissions("sys:dict:info") public Result get(@PathVariable("id") Long id) { SysDictTypeDTO data = sysDictTypeService.get(id); - + data.setSysDictDataDTOList(sysDictDataService.selectByDictTypeId(data.getId().toString())); return new Result().ok(data); } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/dto/SysDictTypeDTO.java b/renren-admin/src/main/java/io/renren/modules/sys/dto/SysDictTypeDTO.java index eb7fd086..06cfbdba 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/dto/SysDictTypeDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/dto/SysDictTypeDTO.java @@ -14,6 +14,7 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * 字典类型 @@ -50,4 +51,9 @@ public class SysDictTypeDTO implements Serializable { @ApiModelProperty(value = "更新时间") @JsonProperty(access = JsonProperty.Access.READ_ONLY) private Date updateDate; + + + @ApiModelProperty(value = "对应字典数据") + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + List sysDictDataDTOList; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/SysDictDataService.java b/renren-admin/src/main/java/io/renren/modules/sys/service/SysDictDataService.java index d33b984b..cd835d9c 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/SysDictDataService.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/SysDictDataService.java @@ -5,6 +5,7 @@ import io.renren.common.service.BaseService; import io.renren.modules.sys.dto.SysDictDataDTO; import io.renren.modules.sys.entity.SysDictDataEntity; +import java.util.List; import java.util.Map; /** @@ -22,4 +23,6 @@ public interface SysDictDataService extends BaseService { void delete(Long[] ids); + List selectByDictTypeId(String dictTypeId); + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictDataServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictDataServiceImpl.java index d2a30383..e67c906e 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictDataServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictDataServiceImpl.java @@ -14,7 +14,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 字典类型 @@ -75,4 +77,11 @@ public class SysDictDataServiceImpl extends BaseServiceImpl selectByDictTypeId(String dictTypeId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("dict_type_id", dictTypeId); + return baseDao.selectList(wrapper).stream().map(index -> ConvertUtils.sourceToTarget(index, SysDictDataDTO.class)).collect(Collectors.toList()); + } + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java index 4a949c3c..48776078 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java @@ -43,10 +43,14 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(dictType), "dict_type", dictType); wrapper.like(StringUtils.isNotBlank(dictName), "dict_name", dictName); - + wrapper.exists(StringUtils.isNotBlank(dictLabel), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_label LIKE CONCAT( '%', '%s', '%' ) ", dictLabel)); + wrapper.exists(StringUtils.isNotBlank(dictValue), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_value =1", dictValue)); return wrapper; } From 105047f346987dc1a932c5f146fe889bc4cdc6ee Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 29 Oct 2022 11:07:23 +0800 Subject: [PATCH 14/14] 500 --- .../sys/service/impl/SysDictTypeServiceImpl.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java index 48776078..da309c9a 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java @@ -31,10 +31,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, "sort", true), - getWrapper(params) - ); + IPage page = baseDao.selectPage(getPage(params, "sort", true), getWrapper(params)); return getPageData(page, SysDictTypeDTO.class); } @@ -42,15 +39,14 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl getWrapper(Map params) { String dictType = (String) params.get("dictType"); String dictName = (String) params.get("dictName"); - - String dictLabel = (String) params.get("dictLabel"); - String dictValue = (String) params.get("dictValue"); + String dictLabel = params.containsKey("dictLabel") ? (String) params.get("dictLabel") : ""; + String dictValue = params.containsKey("dictValue") ? (String) params.get("dictValue") : ""; QueryWrapper wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(dictType), "dict_type", dictType); wrapper.like(StringUtils.isNotBlank(dictName), "dict_name", dictName); - wrapper.exists(StringUtils.isNotBlank(dictLabel), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_label LIKE CONCAT( '%', '%s', '%' ) ", dictLabel)); - wrapper.exists(StringUtils.isNotBlank(dictValue), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_value =1", dictValue)); + wrapper.exists(StringUtils.isNotEmpty(dictLabel), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_label LIKE CONCAT( '%%', '%s', '%%' ) ", dictLabel)); + wrapper.exists(StringUtils.isNotEmpty(dictValue), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_value =1", dictValue)); return wrapper; }