From c009850d302e4bf515264e09c6fd7c21d8e85c02 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Mon, 13 Jun 2022 17:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E7=84=A1=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=94=B9=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/service/ActHistoryService.java | 2 +- .../notice/enums/NoticeReadStatusEnum.java | 8 +- .../notice/enums/NoticeStatusEnum.java | 8 +- .../notice/enums/ReceiverTypeEnum.java | 8 +- .../controller/ResourceController.java | 9 +-- .../modules/resource/dao/ResourceDao.java | 5 +- .../service/impl/ResourceServiceImpl.java | 75 ++++++++----------- .../resource/task/KnowledgeBaseTask.java | 2 +- .../impl/ResourceBrowseServiceImpl.java | 10 +-- .../impl/ResourceCollectionServiceImpl.java | 8 +- .../service/impl/WorkDynamicsServiceImpl.java | 4 - .../io/renren/websocket/WebSocketServer.java | 9 +-- .../websocket/config/WebSocketConfig.java | 8 +- .../io/renren/websocket/data/MessageData.java | 8 +- .../renren/websocket/data/WebSocketData.java | 8 +- .../src/main/resources/application.yml | 1 + renren-admin/src/main/resources/banner.txt | 16 ++-- .../resources/mapper/resource/ResourceDao.xml | 42 ++++++----- 18 files changed, 83 insertions(+), 148 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index e1e964a8..7623679c 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -47,7 +47,7 @@ import java.util.stream.Collectors; */ @Service public class ActHistoryService { - private static Logger logger = LoggerFactory.getLogger(ActHistoryService.class); + private static final Logger logger = LoggerFactory.getLogger(ActHistoryService.class); @Autowired protected RepositoryService repositoryService; diff --git a/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeReadStatusEnum.java b/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeReadStatusEnum.java index 3504b607..2dfb7d44 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeReadStatusEnum.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeReadStatusEnum.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.modules.notice.enums; +package io.renren.modules.notice.enums; /** * 通知阅读状态枚举 diff --git a/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeStatusEnum.java b/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeStatusEnum.java index 754b1244..0fd59bb1 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeStatusEnum.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/enums/NoticeStatusEnum.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.modules.notice.enums; +package io.renren.modules.notice.enums; /** * 通知状态枚举 diff --git a/renren-admin/src/main/java/io/renren/modules/notice/enums/ReceiverTypeEnum.java b/renren-admin/src/main/java/io/renren/modules/notice/enums/ReceiverTypeEnum.java index 328880f4..5e5acac2 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/enums/ReceiverTypeEnum.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/enums/ReceiverTypeEnum.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.modules.notice.enums; +package io.renren.modules.notice.enums; /** * 接受者类型枚举 diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 7d9b4cbe..7d0143ac 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -41,6 +41,7 @@ import java.util.Map; @RequestMapping("/resource") @Api(tags = "资源表") public class ResourceController { + @Value("${qdyjj.ipAndPort}") private String ipAndPort; @@ -77,7 +78,7 @@ public class ResourceController { @Autowired private RestTemplate restTemplate; - private static Logger logger = LoggerFactory.getLogger(ResourceController.class); + private static final Logger logger = LoggerFactory.getLogger(ResourceController.class); @GetMapping("/page") @ApiOperation("分页查询资源信息") @@ -93,9 +94,7 @@ public class ResourceController { }) public Result> page(@ApiIgnore @RequestParam Map params) { PageData page = resourceService.page(params); - page.getList().forEach(item -> { - item.setInfoList(resourceService.selectAttrsByResourceId(item.getId())); - }); + page.getList().forEach(item -> item.setInfoList(resourceService.selectAttrsByResourceId(item.getId()))); return new Result>().ok(page); } @@ -192,7 +191,7 @@ public class ResourceController { @LogOperation("修改") //@RequiresPermissions("resource:resource:update") public Result update(@RequestBody ResourceDTO dto) { - ////效验数据 + //效验数据 //ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); resourceService.updateWithAttrs(dto); 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 0c2d9aaf..f9309b18 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 @@ -23,10 +23,7 @@ public interface ResourceDao extends BaseDao { List selectWithAttrs(@Param("dto") ResourceDTO resourceDTO, @Param("orderField") String orderField, - @Param("orderType") String orderType, - @Param("pageNum") Integer pageNum, - @Param("pageSize") Integer pageSize - ); + @Param("orderType") String orderType); List selectTypeCount(); 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 956b0324..48423def 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 @@ -54,7 +54,7 @@ import java.util.stream.Collectors; */ @Service public class ResourceServiceImpl extends CrudServiceImpl implements ResourceService { - private static Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class); + private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class); @Value("${zsk.appid}") private String appId; @@ -143,6 +143,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resultPage = new Page<>(pageNum, pageSize); if (resourceDTO.getInfoList().isEmpty()) { List resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType); - //resourceDTOS.forEach(item -> { - // item.setInfoList(this.selectAttrsByResourceId(item.getId())); - //}); resultPage.setRecords(resourceDTOS); resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size()); } else { - List resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, (pageNum - 1) * pageSize, pageSize); + List resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType); int j = Math.min(pageNum * pageSize, resourceDTOS.size()); if (resourceDTOS.isEmpty()) { resultPage.setRecords(null); @@ -302,7 +300,7 @@ public class ResourceServiceImpl extends CrudServiceImpl applyAreaList = resourceDao.selectApplyArea(userId); //没有收藏和申请过,按最热能力选取,否则根据应用领域最多类型推荐 JSONObject object = new JSONObject(); @@ -324,19 +322,19 @@ public class ResourceServiceImpl extends CrudServiceImpl Page = (Page) this.pageWithAttrs(jsonObject); + Page page = (Page) this.pageWithAttrs(jsonObject); //若查出数据不足9条则在热门能力补充缺少的数量 - if (Page.getRecords().size() < 9) { - for (int i = 0; Page.getRecords().size() < 9; i++) { - for (int j = 0; j < Page.getRecords().size(); j++) { - if (!Page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) { - Page.getRecords().add(resultPage.getRecords().get(i)); + if (page.getRecords().size() < 9) { + for (int i = 0; page.getRecords().size() < 9; i++) { + for (int j = 0; j < page.getRecords().size(); j++) { + if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) { + page.getRecords().add(resultPage.getRecords().get(i)); break; } } } } - return Page; + return page; } else { return resultPage; } @@ -344,8 +342,7 @@ public class ResourceServiceImpl extends CrudServiceImpl> getAmountGroupByType() { - List> amountInfo = resourceDao.getAmountGroupByType(); - return amountInfo; + return resourceDao.getAmountGroupByType(); } @Override @@ -374,9 +371,7 @@ public class ResourceServiceImpl extends CrudServiceImpl map = new HashMap<>(); map.put("type", item.getKey()); map.put("total", resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"))); - item.getValue().forEach(item1 -> { - item1.remove("type"); - }); + item.getValue().forEach(item1 -> item1.remove("type")); map.put("dataList", item.getValue()); resultList.add(map); }); @@ -387,14 +382,12 @@ public class ResourceServiceImpl extends CrudServiceImpl areaListTemp = new ArrayList<>(); - areaTypeList.orElse(new HashMap<>()).entrySet().stream().forEach(item -> { + areaTypeList.orElse(new HashMap<>()).forEach((key, value) -> { HashMap map = new HashMap<>(); - map.put("type", item.getKey()); - map.put("total", resourceDao.selectTypeCountByDist(item.getKey(), jsonObject.getString("type"))); - item.getValue().forEach(item1 -> { - item1.remove("type"); - }); - map.put("dataList", item.getValue()); + map.put("type", key); + map.put("total", resourceDao.selectTypeCountByDist(key, jsonObject.getString("type"))); + value.forEach(item1 -> item1.remove("type")); + map.put("dataList", value); areaListTemp.add(map); }); areaMap.put("dataList", areaListTemp); @@ -428,13 +421,11 @@ public class ResourceServiceImpl extends CrudServiceImpl deptTypeCount = resourceDao.selectDeptTypeCount(); - map.entrySet().forEach(item -> { - deptTypeCount.forEach(index -> { - if (index.get("type").equals(item.getKey())) { - item.setValue(index.get("count")); - } - }); - }); + map.entrySet().forEach(item -> deptTypeCount.forEach(index -> { + if (index.get("type").equals(item.getKey())) { + item.setValue(index.get("count")); + } + })); resultMap.put("deptTypeCount", map); List deptTotalCount = resourceDao.selectDeptTotalCount(); HashMap map1 = new HashMap() { @@ -446,13 +437,11 @@ public class ResourceServiceImpl extends CrudServiceImpl { - deptTotalCount.forEach(index -> { - if (index.get("type").equals(item.getKey())) { - item.setValue(index.get("total")); - } - }); - }); + map1.entrySet().forEach(item -> deptTotalCount.forEach(index -> { + if (index.get("type").equals(item.getKey())) { + item.setValue(index.get("total")); + } + })); resultMap.put("deptTotalCount", map1); return resultMap; } @@ -515,9 +504,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { HashMap map = new HashMap<>(); map.put("name", k); - v.forEach(item -> { - map.put(item.get("type").toString(), item.get("count")); - }); + v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); resultList.add(map); }); return resultList; @@ -531,9 +518,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { HashMap map = new HashMap<>(); map.put("name", k); - v.forEach(item -> { - map.put(item.get("type").toString(), item.get("count")); - }); + v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); resultList.add(map); }); return resultList; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/task/KnowledgeBaseTask.java b/renren-admin/src/main/java/io/renren/modules/resource/task/KnowledgeBaseTask.java index d5272648..7c4df1f4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/task/KnowledgeBaseTask.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/task/KnowledgeBaseTask.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; */ @Component("knowledgeBaseTask") public class KnowledgeBaseTask implements ITask { - private static Logger logger = LoggerFactory.getLogger(KnowledgeBaseTask.class); + private static final Logger logger = LoggerFactory.getLogger(KnowledgeBaseTask.class); @Autowired private ResourceService resourceService; diff --git a/renren-admin/src/main/java/io/renren/modules/resourceBrowse/service/impl/ResourceBrowseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceBrowse/service/impl/ResourceBrowseServiceImpl.java index ee63b8ab..00205120 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceBrowse/service/impl/ResourceBrowseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceBrowse/service/impl/ResourceBrowseServiceImpl.java @@ -2,14 +2,12 @@ package io.renren.modules.resourceBrowse.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.renren.common.service.impl.CrudServiceImpl; -import io.renren.common.constant.Constant; import io.renren.common.utils.DateUtils; import io.renren.modules.resourceBrowse.dao.ResourceBrowseDao; import io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO; import io.renren.modules.resourceBrowse.entity.ResourceBrowseEntity; import io.renren.modules.resourceBrowse.service.ResourceBrowseService; import io.renren.modules.security.user.SecurityUser; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -64,12 +62,12 @@ public class ResourceBrowseServiceImpl extends CrudServiceImpl> resultMap = new ArrayList<>(); - for (int i = 0; i < dayList.size(); i++) { + for (String s : dayList) { HashMap dayMap = new HashMap<>(); - dayMap.put(dayList.get(i), 0); + dayMap.put(s, 0); for (Map map : maps) { - if (dayList.get(i).equals(map.get("date"))) { - dayMap.put(dayList.get(i), map.get("count")); + if (s.equals(map.get("date"))) { + dayMap.put(s, map.get("count")); } } resultMap.add(dayMap); diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java index 8528a570..27a6829f 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCollection/service/impl/ResourceCollectionServiceImpl.java @@ -4,20 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.service.impl.CrudServiceImpl; -import io.renren.common.constant.Constant; import io.renren.modules.resource.service.ResourceService; -import io.renren.modules.resourceCar.dto.ResourceCarDTO; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO; import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity; import io.renren.modules.resourceCollection.service.ResourceCollectionService; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ObjectUtils; import java.util.HashMap; import java.util.List; @@ -52,9 +48,7 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl page = new Page(pageNum, pageSize); params.put("userId", user.getId()); List resourceCollectionDTOS = resourceCollectionDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize); - resourceCollectionDTOS.forEach(item -> { - item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId())); - }); + resourceCollectionDTOS.forEach(item -> item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId()))); List resourceCollectionDTOSs = resourceCollectionDao.selectPageWithResource(params, 0, 100000); page.setRecords(resourceCollectionDTOS); page.setTotal(resourceCollectionDTOSs.size()); diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java index 47337b82..26f043c6 100644 --- a/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java @@ -3,14 +3,10 @@ package io.renren.modules.workDynamics.service.impl; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.renren.common.service.impl.CrudServiceImpl; -import io.renren.common.constant.Constant; import io.renren.modules.workDynamics.dao.WorkDynamicsDao; import io.renren.modules.workDynamics.dto.WorkDynamicsDTO; import io.renren.modules.workDynamics.entity.WorkDynamicsEntity; import io.renren.modules.workDynamics.service.WorkDynamicsService; -import io.renren.modules.security.user.SecurityUser; -import org.apache.commons.lang.ObjectUtils; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java b/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java index a4a89ec5..1a1542cb 100644 --- a/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java +++ b/renren-admin/src/main/java/io/renren/websocket/WebSocketServer.java @@ -1,10 +1,3 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */ package io.renren.websocket; import com.alibaba.fastjson.JSON; @@ -31,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; @Component @ServerEndpoint(value = "/websocket", configurator = WebSocketConfig.class) public class WebSocketServer { - private static Logger logger = LoggerFactory.getLogger(WebSocketServer.class); + private static final Logger logger = LoggerFactory.getLogger(WebSocketServer.class); public WebSocketServer() { logger.info("-------------websocket----------------"); diff --git a/renren-admin/src/main/java/io/renren/websocket/config/WebSocketConfig.java b/renren-admin/src/main/java/io/renren/websocket/config/WebSocketConfig.java index 4ce30209..36b0ff23 100644 --- a/renren-admin/src/main/java/io/renren/websocket/config/WebSocketConfig.java +++ b/renren-admin/src/main/java/io/renren/websocket/config/WebSocketConfig.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.websocket.config; +package io.renren.websocket.config; import io.renren.common.constant.Constant; import io.renren.modules.security.user.SecurityUser; diff --git a/renren-admin/src/main/java/io/renren/websocket/data/MessageData.java b/renren-admin/src/main/java/io/renren/websocket/data/MessageData.java index f852af0d..ff400bfe 100644 --- a/renren-admin/src/main/java/io/renren/websocket/data/MessageData.java +++ b/renren-admin/src/main/java/io/renren/websocket/data/MessageData.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.websocket.data; +package io.renren.websocket.data; import lombok.Data; diff --git a/renren-admin/src/main/java/io/renren/websocket/data/WebSocketData.java b/renren-admin/src/main/java/io/renren/websocket/data/WebSocketData.java index 281010ba..18d30f06 100644 --- a/renren-admin/src/main/java/io/renren/websocket/data/WebSocketData.java +++ b/renren-admin/src/main/java/io/renren/websocket/data/WebSocketData.java @@ -1,10 +1,4 @@ -/** - * Copyright (c) 2016-2020 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */package io.renren.websocket.data; +package io.renren.websocket.data; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index af0b3da5..3233eb42 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -87,6 +87,7 @@ system: yawei: enable: true + #知识库 zsk: url: diff --git a/renren-admin/src/main/resources/banner.txt b/renren-admin/src/main/resources/banner.txt index 3e4ef7b1..3bf8752d 100644 --- a/renren-admin/src/main/resources/banner.txt +++ b/renren-admin/src/main/resources/banner.txt @@ -1,5 +1,11 @@ -==================================================================================================================== - - 欢迎使用 renren-security 人人权限专业版 - Powered By https://www.renren.io - -==================================================================================================================== \ No newline at end of file + .----------------. .----------------. .----------------. .----------------. .----------------. +| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | +| | ____ ____ | || | _________ | || | ____ ____ | || | ________ | || | ________ | | +| | |_ _||_ _| | || | | _ _ | | || | |_ || _| | || | |_ ___ `. | || | | __ _| | | +| | \ \ / / | || | |_/ | | \_| | || | | |__| | | || | | | `. \ | || | |_/ / / | | +| | \ \/ / | || | | | | || | | __ | | || | | | | | | || | .'.' _ | | +| | _| |_ | || | _| |_ | || | _| | | |_ | || | _| |___.' / | || | _/ /__/ | | | +| | |______| | || | |_____| | || | |____||____| | || | |________.' | || | |________| | | +| | | || | | || | | || | | || | | | +| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + '----------------' '----------------' '----------------' '----------------' '----------------' \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index b4b8ff77..1bb9d670 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -121,10 +121,11 @@ 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id - LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" - FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} GROUP BY resource_id + LEFT JOIN ( SELECT resource_id, user_id, ( IF(COUNT( id ) = 1, 'true', 'false') ) AS "isCollect" + FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} GROUP BY resource_id ) trc2 ON tdr.id = trc2.resource_id - LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} + LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 + AND user_id = #{dto.creator} GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 @@ -251,14 +252,17 @@ ( taa2.approve_status < 1, '未申请', "已申请" ) AS "applyState" FROM tb_data_resource tdr - LEFT JOIN ( SELECT resource_id, AVG( score ) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id - LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id - LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id + LEFT JOIN ( SELECT resource_id, AVG( score ) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 + GROUP BY resource_id ) trs ON tdr.id = trs.resource_id + LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag + = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id + LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND + del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id LEFT JOIN ( SELECT resource_id, user_id, - ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" + ( IF(COUNT( id ) = 1, 'true', 'false') ) AS "isCollect" FROM tb_resource_collection WHERE @@ -268,7 +272,8 @@ GROUP BY resource_id ) trc2 ON tdr.id = trc2.resource_id - LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{userId} GROUP BY resource_id ) taa2 ON tdr.id = taa2.resource_id + LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1 + AND del_flag = 0 AND user_id = #{userId} GROUP BY resource_id ) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 @@ -293,10 +298,11 @@ 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id - LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" + LEFT JOIN ( SELECT resource_id, user_id, ( IF(COUNT( id ) = 1, 'true', 'false') ) AS "isCollect" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id - LEFT JOIN ( SELECT DISTINCT resource_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} + LEFT JOIN ( SELECT DISTINCT resource_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 + AND user_id = #{dto.creator} GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 @@ -412,12 +418,12 @@ FROM ( SELECT - * + type, + deptCount FROM ( SELECT ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type", - sd.NAME AS "deptName", IFNULL( tdr.deptCount, 0 ) AS "deptCount" FROM sys_dept sd @@ -451,15 +457,13 @@ FROM ( SELECT - * + type, deptCount, districtName FROM ( SELECT ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type", - sd.NAME AS "deptName", IFNULL( tdr.deptCount, 0) AS "deptCount", IFNULL(sr.name, '暂无该地区') AS "districtName", - sr.id AS "districtId" FROM sys_dept sd LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource @@ -609,8 +613,7 @@ FROM ( SELECT - COUNT( id ) AS "count", - dept_id + COUNT( id ) AS "count" FROM tb_data_resource WHERE @@ -673,8 +676,7 @@ FROM ( SELECT - COUNT( taa.id ) AS "count", - su.dept_id + COUNT( taa.id ) AS "count" FROM t_ability_application taa, sys_user su @@ -787,7 +789,7 @@ SELECT MAX( count ) AS "total" FROM - ( SELECT COUNT( id ) AS "count", type FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY type ) temp2 + ( SELECT COUNT( id ) AS "count" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY type ) temp2 )