From 1127c066ceee4bf7fe187dbc2345f5b8d9700fc6 Mon Sep 17 00:00:00 2001 From: liyongbo2 Date: Mon, 27 Jun 2022 09:12:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E5=92=8C=E8=B4=A1=E7=8C=AE=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TbProjectContribController.java | 4 +- .../controller/TbProjectUseController.java | 4 +- .../project/dao/TbProjectContribDao.java | 14 +++- .../modules/project/dao/TbProjectUseDao.java | 13 +++- .../project/dto/TbProjectContribDTO.java | 4 +- .../modules/project/dto/TbProjectUseDTO.java | 4 +- .../entity/TbProjectContribEntity.java | 4 +- .../project/entity/TbProjectUseEntity.java | 4 +- .../project/excel/TbProjectContribExcel.java | 4 +- .../project/excel/TbProjectUseExcel.java | 4 +- .../service/TbProjectContribService.java | 4 ++ .../project/service/TbProjectUseService.java | 4 ++ .../impl/TbProjectContribServiceImpl.java | 33 +++++++++ .../service/impl/TbProjectUseServiceImpl.java | 34 ++++++++++ .../resources/db/V2.2__project_update_col.sql | 7 ++ .../mapper/project/TbProjectContribDao.xml | 68 +++++++++++++++++++ .../resources/mapper/project/TbProjectDao.xml | 29 ++++++++ .../mapper/project/TbProjectUseDao.xml | 68 +++++++++++++++++++ 18 files changed, 288 insertions(+), 18 deletions(-) create mode 100644 renren-admin/src/main/resources/db/V2.2__project_update_col.sql create mode 100644 renren-admin/src/main/resources/mapper/project/TbProjectContribDao.xml create mode 100644 renren-admin/src/main/resources/mapper/project/TbProjectDao.xml create mode 100644 renren-admin/src/main/resources/mapper/project/TbProjectUseDao.xml diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java index 4ef98c37..7681d132 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java @@ -52,8 +52,8 @@ public class TbProjectContribController { }) // @RequiresPermissions("project:tbprojectcontrib:page") public Result> page(@ApiIgnore @RequestParam Map params){ - PageData page = tbProjectContribService.page(params); - +// PageData page = tbProjectContribService.page(params); + PageData page = tbProjectContribService.queryList(params); return new Result>().ok(page); } diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java index 112317cc..9ad5a81b 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java @@ -52,8 +52,8 @@ public class TbProjectUseController { }) // @RequiresPermissions("project:tbprojectuse:page") public Result> page(@ApiIgnore @RequestParam Map params){ - PageData page = tbProjectUseService.page(params); - +// PageData page = tbProjectUseService.page(params); + PageData page = tbProjectUseService.queryList(params); return new Result>().ok(page); } diff --git a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java index aae4739f..1853832b 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java +++ b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java @@ -1,8 +1,13 @@ package io.renren.modules.project.dao; import io.renren.common.dao.BaseDao; +import io.renren.modules.project.dto.TbProjectContribDTO; import io.renren.modules.project.entity.TbProjectContribEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.security.core.parameters.P; + +import java.util.List; /** * 项目贡献表 @@ -12,5 +17,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface TbProjectContribDao extends BaseDao { - + + int queryCount(@Param("projectName")String projectName, + @Param("resourceName")String resourceName); + + List queryList(@Param("currentNum") int currentNum, + @Param("pageSize")int pageSize, + @Param("projectName")String projectName, + @Param("resourceName")String resourceName); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java index fdff1c25..cc67a71e 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java +++ b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java @@ -1,8 +1,12 @@ package io.renren.modules.project.dao; import io.renren.common.dao.BaseDao; +import io.renren.modules.project.dto.TbProjectUseDTO; import io.renren.modules.project.entity.TbProjectUseEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 项目使用表 @@ -12,5 +16,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface TbProjectUseDao extends BaseDao { - + + int queryCount(@Param("projectName")String projectName, + @Param("resourceName")String resourceName); + + List queryList(@Param("currentNum") int currentNum, + @Param("pageSize")int pageSize, + @Param("projectName")String projectName, + @Param("resourceName")String resourceName); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java index c2dc0422..4d1ed66d 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java @@ -42,9 +42,9 @@ public class TbProjectContribDTO implements Serializable { private Long updater; @ApiModelProperty(value = "修改时间") private Date updateDate; - @ApiModelProperty(value = "备用字段") + @ApiModelProperty(value = "项目id") private String note1; - @ApiModelProperty(value = "备用字段") + @ApiModelProperty(value = "应用资源id") private String note2; @ApiModelProperty(value = "备用字段") private String note3; diff --git a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java index 21c9ae47..56b465bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java @@ -42,9 +42,9 @@ public class TbProjectUseDTO implements Serializable { private Long updater; @ApiModelProperty(value = "修改时间") private Date updateDate; - @ApiModelProperty(value = "备用字段") + @ApiModelProperty(value = "项目id") private String note1; - @ApiModelProperty(value = "备用字段") + @ApiModelProperty(value = "应用资源id") private String note2; @ApiModelProperty(value = "备用字段") private String note3; diff --git a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java index 3ffb917b..1220d0ed 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java @@ -57,11 +57,11 @@ public class TbProjectContribEntity extends BaseEntity { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateDate; /** - * 备用字段 + * 项目id */ private String note1; /** - * 备用字段 + * 应用资源id */ private String note2; /** diff --git a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java index 5ea696c6..3ca7a5b2 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java @@ -57,11 +57,11 @@ public class TbProjectUseEntity extends BaseEntity { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateDate; /** - * 备用字段 + * 项目id */ private String note1; /** - * 备用字段 + * 应用资源id */ private String note2; /** diff --git a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java index b84b35ef..02a04287 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java +++ b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java @@ -42,9 +42,9 @@ public class TbProjectContribExcel { private Long updater; @ExcelProperty(value = "修改时间", index = 11) private Date updateDate; - @ExcelProperty(value = "备用字段", index = 12) + @ExcelProperty(value = "项目id", index = 12) private String note1; - @ExcelProperty(value = "备用字段", index = 13) + @ExcelProperty(value = "应用资源id", index = 13) private String note2; @ExcelProperty(value = "备用字段", index = 14) private String note3; diff --git a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java index cd107882..3299c670 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java +++ b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java @@ -42,9 +42,9 @@ public class TbProjectUseExcel { private Long updater; @ExcelProperty(value = "修改时间", index = 11) private Date updateDate; - @ExcelProperty(value = "备用字段", index = 12) + @ExcelProperty(value = "项目id", index = 12) private String note1; - @ExcelProperty(value = "备用字段", index = 13) + @ExcelProperty(value = "应用资源id", index = 13) private String note2; @ExcelProperty(value = "备用字段", index = 14) private String note3; diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java index 8f27e871..3282d637 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java @@ -1,9 +1,12 @@ package io.renren.modules.project.service; +import io.renren.common.page.PageData; import io.renren.common.service.CrudService; import io.renren.modules.project.dto.TbProjectContribDTO; import io.renren.modules.project.entity.TbProjectContribEntity; +import java.util.Map; + /** * 项目贡献表 * @@ -12,4 +15,5 @@ import io.renren.modules.project.entity.TbProjectContribEntity; */ public interface TbProjectContribService extends CrudService { + PageData queryList(Map params); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java index bc334317..9ab2e8ab 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java @@ -1,9 +1,12 @@ package io.renren.modules.project.service; +import io.renren.common.page.PageData; import io.renren.common.service.CrudService; import io.renren.modules.project.dto.TbProjectUseDTO; import io.renren.modules.project.entity.TbProjectUseEntity; +import java.util.Map; + /** * 项目使用表 * @@ -12,4 +15,5 @@ import io.renren.modules.project.entity.TbProjectUseEntity; */ public interface TbProjectUseService extends CrudService { + PageData queryList(Map params); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java index 310700f1..205a0b26 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java @@ -1,6 +1,7 @@ package io.renren.modules.project.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.page.PageData; import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.constant.Constant; import io.renren.modules.project.dao.TbProjectContribDao; @@ -9,8 +10,10 @@ import io.renren.modules.project.entity.TbProjectContribEntity; import io.renren.modules.project.service.TbProjectContribService; import io.renren.modules.security.user.SecurityUser; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -22,6 +25,9 @@ import java.util.Map; @Service public class TbProjectContribServiceImpl extends CrudServiceImpl implements TbProjectContribService { + @Autowired + private TbProjectContribDao tbProjectContribDao; + @Override public QueryWrapper getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); @@ -36,5 +42,32 @@ public class TbProjectContribServiceImpl extends CrudServiceImpl queryList(Map params) { + //分页参数 + int page = 1; + int pageSize = 10; + if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){ + pageSize = Integer.valueOf(params.get("limit").toString()); + } + if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){ + page = Integer.valueOf(params.get("page").toString()); + } + int currentNum = (page-1)*pageSize; + //查询参数 + String projectName = null; + String resourceName = null; + if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){ + projectName = params.get("projectName").toString(); + } + if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){ + resourceName = params.get("resourceName").toString(); + } + + int count = tbProjectContribDao.queryCount(projectName,resourceName); + List list = tbProjectContribDao.queryList(currentNum,pageSize,projectName,resourceName); + + return new PageData<>(list,count); + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java index 5b5f59ce..1888e2d6 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java @@ -1,6 +1,7 @@ package io.renren.modules.project.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.page.PageData; import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.constant.Constant; import io.renren.modules.project.dao.TbProjectUseDao; @@ -9,8 +10,10 @@ import io.renren.modules.project.entity.TbProjectUseEntity; import io.renren.modules.project.service.TbProjectUseService; import io.renren.modules.security.user.SecurityUser; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -22,6 +25,9 @@ import java.util.Map; @Service public class TbProjectUseServiceImpl extends CrudServiceImpl implements TbProjectUseService { + @Autowired + private TbProjectUseDao tbProjectUseDao; + @Override public QueryWrapper getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); @@ -37,4 +43,32 @@ public class TbProjectUseServiceImpl extends CrudServiceImpl queryList(Map params) { + //分页参数 + int page = 1; + int pageSize = 10; + if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){ + pageSize = Integer.valueOf(params.get("limit").toString()); + } + if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){ + page = Integer.valueOf(params.get("page").toString()); + } + int currentNum = (page-1)*pageSize; + + //查询参数 + String projectName = null; + String resourceName = null; + if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){ + projectName = params.get("projectName").toString(); + } + if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){ + resourceName = params.get("resourceName").toString(); + } + + int count = tbProjectUseDao.queryCount(projectName,resourceName); + List list = tbProjectUseDao.queryList(currentNum,pageSize,projectName,resourceName); + + return new PageData<>(list,count); + } } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V2.2__project_update_col.sql b/renren-admin/src/main/resources/db/V2.2__project_update_col.sql new file mode 100644 index 00000000..76a96265 --- /dev/null +++ b/renren-admin/src/main/resources/db/V2.2__project_update_col.sql @@ -0,0 +1,7 @@ +ALTER TABLE `tb_project_contrib` +MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目id,tb_project主键', +MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用id,tb_data_resource中类型为应用资源的主键id'; + +ALTER TABLE `tb_project_use` +MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目id,tb_project主键', +MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用id,tb_data_resource中类型为应用资源的主键id'; \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/project/TbProjectContribDao.xml b/renren-admin/src/main/resources/mapper/project/TbProjectContribDao.xml new file mode 100644 index 00000000..9e383c1c --- /dev/null +++ b/renren-admin/src/main/resources/mapper/project/TbProjectContribDao.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/project/TbProjectDao.xml b/renren-admin/src/main/resources/mapper/project/TbProjectDao.xml new file mode 100644 index 00000000..d69ff4c5 --- /dev/null +++ b/renren-admin/src/main/resources/mapper/project/TbProjectDao.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/project/TbProjectUseDao.xml b/renren-admin/src/main/resources/mapper/project/TbProjectUseDao.xml new file mode 100644 index 00000000..a763a6d1 --- /dev/null +++ b/renren-admin/src/main/resources/mapper/project/TbProjectUseDao.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 1be5641717ef6a0d8a57cb355318bc095d977bb9 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Mon, 27 Jun 2022 10:33:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E7=BB=A7=E7=BB=AD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=96=B0=E8=83=BD=E5=8A=9B=E7=BB=9F=E8=AE=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=83=A8=E5=88=86=E5=90=8E=E5=8F=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV3.java | 50 +++++++++---------- .../service/impl/ResourceServiceImpl.java | 2 + .../sys/controller/SysDeptController.java | 32 +++++++++--- .../modules/sys/service/SysDeptService.java | 3 +- .../sys/service/impl/SysDeptServiceImpl.java | 16 +++--- .../resources/mapper/resource/ResourceDao.xml | 2 - 6 files changed, 60 insertions(+), 45 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java index d9f95d97..7dbb1408 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java @@ -116,7 +116,7 @@ public class CensusControllerV3 { //以下是组件服务发布情况点击详情 /** - * 组件评分情况 1 2 3 4 5评分分布 + * 发布组件评分情况 1 2 3 4 5评分分布 * @param * @return */ @@ -152,6 +152,7 @@ public class CensusControllerV3 { @LogOperation("TOP5被调用的组件和数量") @ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long") public Result>> assemblerUsedTopInfo(Long id){ + return null; } @@ -187,12 +188,21 @@ public class CensusControllerV3 { @GetMapping("/assemblerUsedInfo") @ApiOperation("算法、图层、开发、业务发布量情况分布") @LogOperation("算法、图层、开发、业务发布量情况分布") - @ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long") - public Result>> assemblerUsedInfo(Long id){ - return null; + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"), + @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") + }) + public Result>> assemblerUsedInfo(@ApiIgnore @RequestParam Map params){ + Object[] ps = {params.get("id"),params.get("resourceType")}; + List> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" + + "WHERE a.dept_id = ? and a.type = ? and b.attr_type = '组件类型'\n" + + "GROUP BY b.attr_value", ps); + + return new Result>>().ok(maps); } + //以下是组件使用情况点击详情 @GetMapping("/assemblerUseTopInfo") @@ -224,21 +234,6 @@ public class CensusControllerV3 { return null; } - @GetMapping("resourceAttrReleaseDetail") - @ApiOperation("算法、图层、开发、业务发布量情况分布") - @LogOperation("算法、图层、开发、业务发布量情况分布") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"), - @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") - }) - public Result>> resourceAttrReleaseDetail(@ApiIgnore @RequestParam Map params){ - Object[] ps = {params.get("resourceType"),params.get("id")}; - List> result = jdbcTemplate.queryForList("SELECT b.attr_value,COUNT(b.id) AS num from tb_data_resource a inner join tb_data_attr b on a.id = b.data_resource_id\n" + - "where a.type = ? and a.dept_id = ? and (INSTR( b.attr_value , '算法' ) > 0 OR INSTR( b.attr_value , '图层' ) > 0\n" + - " OR INSTR( b.attr_value , '开发' ) > 0 OR INSTR( b.attr_value , '业务' ) > 0 )\n" + - "group by b.attr_value", ps); - return new Result>>().ok(result); - } @GetMapping("applicationAreaCapabilityList") @ApiOperation("应用领域分布情况") @@ -362,12 +357,12 @@ public class CensusControllerV3 { /** * 测试获取部门树 * @param keywords - * @param deptId + * @param * @return */ @GetMapping("treeList") @ApiOperation("根据当前用户所在部门查询下属部门tree,可以根据部门名称模糊查询") - public Result> treeList(@RequestParam(required = false,value = "模糊查询,部门名称") String keywords,Long deptId){ + public Result> treeList(@RequestParam(required = false,value = "keywords") String keywords,Long deptId){ List result = new ArrayList<>(); SysDeptDTO sysDeptDTO = sysDeptService.get(deptId); @@ -375,16 +370,16 @@ public class CensusControllerV3 { if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局 List> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0"); deptMaps.forEach(dept->{ - List depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString())); - result.addAll(depts); + SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString())); + result.add(depts); }); }else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局 - List depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid()); - result.addAll(depts); + SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid()); + result.add(depts); }else{ - List deptListByPid = sysDeptService.getDeptListByPid(deptId); - result.addAll(deptListByPid); + SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId); + result.add(deptListByPid); } if(keywords != null){ treeMatch(result,keywords); @@ -393,6 +388,7 @@ public class CensusControllerV3 { return new Result>().ok(result); } + private void treeMatch(List anyLevelCategoryList, String keyword) { Iterator iter = anyLevelCategoryList.iterator(); while (iter.hasNext()) { 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 e9dd3bf4..55ba0b3e 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 @@ -33,6 +33,7 @@ import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import org.bytedeco.opencv.presets.opencv_core; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -1190,4 +1191,5 @@ public class ResourceServiceImpl extends CrudServiceImpl> treeList(@RequestParam(required = false,value = "模糊查询,部门名称") String keywords){ + public Result> treeList(@RequestParam(required = false,value = "keywords") String keywords){ Long deptId = SecurityUser.getDeptId(); - List deptListByPid = sysDeptService.getDeptListByPid(deptId); - treeMatch(deptListByPid,keywords); + List result = new ArrayList<>(); + SysDeptDTO sysDeptDTO = sysDeptService.get(deptId); - return new Result>().ok(deptListByPid); + //市大数据局展示全部部门,区大数据局展示本区所有部门,委办局展示自己部门及下级部门 + if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局 + List> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0"); + deptMaps.forEach(dept->{ + SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString())); + result.add(depts); + }); + }else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局 + + SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid()); + result.add(depts); + }else{ + SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId); + result.add(deptListByPid); + } + if(keywords != null){ + treeMatch(result,keywords); + } + System.out.println("部门树--》"+result.size()); + return new Result>().ok(result); } /** ytl 2022-06-23 新增 end **/ @GetMapping("list") diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/SysDeptService.java b/renren-admin/src/main/java/io/renren/modules/sys/service/SysDeptService.java index a9328a0a..eb38ea93 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/SysDeptService.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/SysDeptService.java @@ -31,5 +31,6 @@ public interface SysDeptService extends BaseService { SysDeptDTO getByName(String name); - List getDeptListByPid(Long id); + //List getDeptListByPid(Long id); + SysDeptDTO getDeptListByPid(Long id); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDeptServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDeptServiceImpl.java index 8fa8e429..7db5fbcf 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDeptServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDeptServiceImpl.java @@ -165,7 +165,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl getDeptListByPid(Long id) { + public SysDeptDTO getDeptListByPid(Long id) { SysDeptEntity sysDeptEntity = baseDao.getById(id);//当前部门 SysDeptDTO sysDeptDTO = ConvertUtils.sourceToTarget(sysDeptEntity, SysDeptDTO.class);//转换为DTO @@ -175,16 +175,18 @@ public class SysDeptServiceImpl extends BaseServiceImpl 0){ sysDeptList.forEach(dept->sysDeptDTOList.add(ConvertUtils.sourceToTarget(dept, SysDeptDTO.class))); for(int i = 0; i list = getDeptListByPid(sysDeptList.get(i).getId()); - sysDeptDTOList.get(i).setChildren(list); + SysDeptDTO list = getDeptListByPid(sysDeptList.get(i).getId()); + //sysDeptDTOList.get(i).setChildren(list); } sysDeptDTO.setChildren(sysDeptDTOList); - sysDeptDTOList.add(sysDeptDTO); - }else{ - sysDeptDTOList.add(sysDeptDTO); + //sysDeptDTOList.add(sysDeptDTO); } +// else{ +// sysDeptDTOList.add(sysDeptDTO); +// } - return sysDeptDTOList; + //return sysDeptDTOList; + return sysDeptDTO; } diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 2151c6ff..05221f70 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -930,9 +930,7 @@ GROUP BY type -