项目使用能力和贡献能力明细接口修改

This commit is contained in:
liyongbo2 2022-06-27 09:12:06 +08:00
parent f5cc6c10b0
commit 1127c066ce
18 changed files with 288 additions and 18 deletions

View File

@ -52,8 +52,8 @@ public class TbProjectContribController {
}) })
// @RequiresPermissions("project:tbprojectcontrib:page") // @RequiresPermissions("project:tbprojectcontrib:page")
public Result<PageData<TbProjectContribDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbProjectContribDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectContribDTO> page = tbProjectContribService.page(params); // PageData<TbProjectContribDTO> page = tbProjectContribService.page(params);
PageData<TbProjectContribDTO> page = tbProjectContribService.queryList(params);
return new Result<PageData<TbProjectContribDTO>>().ok(page); return new Result<PageData<TbProjectContribDTO>>().ok(page);
} }

View File

@ -52,8 +52,8 @@ public class TbProjectUseController {
}) })
// @RequiresPermissions("project:tbprojectuse:page") // @RequiresPermissions("project:tbprojectuse:page")
public Result<PageData<TbProjectUseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbProjectUseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectUseDTO> page = tbProjectUseService.page(params); // PageData<TbProjectUseDTO> page = tbProjectUseService.page(params);
PageData<TbProjectUseDTO> page = tbProjectUseService.queryList(params);
return new Result<PageData<TbProjectUseDTO>>().ok(page); return new Result<PageData<TbProjectUseDTO>>().ok(page);
} }

View File

@ -1,8 +1,13 @@
package io.renren.modules.project.dao; package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao; import io.renren.common.dao.BaseDao;
import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.entity.TbProjectContribEntity; import io.renren.modules.project.entity.TbProjectContribEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import java.util.List;
/** /**
* 项目贡献表 * 项目贡献表
@ -13,4 +18,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TbProjectContribDao extends BaseDao<TbProjectContribEntity> { public interface TbProjectContribDao extends BaseDao<TbProjectContribEntity> {
int queryCount(@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
List<TbProjectContribDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSize,
@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
} }

View File

@ -1,8 +1,12 @@
package io.renren.modules.project.dao; package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao; import io.renren.common.dao.BaseDao;
import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.entity.TbProjectUseEntity; import io.renren.modules.project.entity.TbProjectUseEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 项目使用表 * 项目使用表
@ -13,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TbProjectUseDao extends BaseDao<TbProjectUseEntity> { public interface TbProjectUseDao extends BaseDao<TbProjectUseEntity> {
int queryCount(@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
List<TbProjectUseDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSize,
@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
} }

View File

@ -42,9 +42,9 @@ public class TbProjectContribDTO implements Serializable {
private Long updater; private Long updater;
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateDate; private Date updateDate;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "项目id")
private String note1; private String note1;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "应用资源id")
private String note2; private String note2;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "备用字段")
private String note3; private String note3;

View File

@ -42,9 +42,9 @@ public class TbProjectUseDTO implements Serializable {
private Long updater; private Long updater;
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateDate; private Date updateDate;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "项目id")
private String note1; private String note1;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "应用资源id")
private String note2; private String note2;
@ApiModelProperty(value = "备用字段") @ApiModelProperty(value = "备用字段")
private String note3; private String note3;

View File

@ -57,11 +57,11 @@ public class TbProjectContribEntity extends BaseEntity {
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate; private Date updateDate;
/** /**
* 备用字段 * 项目id
*/ */
private String note1; private String note1;
/** /**
* 备用字段 * 应用资源id
*/ */
private String note2; private String note2;
/** /**

View File

@ -57,11 +57,11 @@ public class TbProjectUseEntity extends BaseEntity {
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate; private Date updateDate;
/** /**
* 备用字段 * 项目id
*/ */
private String note1; private String note1;
/** /**
* 备用字段 * 应用资源id
*/ */
private String note2; private String note2;
/** /**

View File

@ -42,9 +42,9 @@ public class TbProjectContribExcel {
private Long updater; private Long updater;
@ExcelProperty(value = "修改时间", index = 11) @ExcelProperty(value = "修改时间", index = 11)
private Date updateDate; private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12) @ExcelProperty(value = "项目id", index = 12)
private String note1; private String note1;
@ExcelProperty(value = "备用字段", index = 13) @ExcelProperty(value = "应用资源id", index = 13)
private String note2; private String note2;
@ExcelProperty(value = "备用字段", index = 14) @ExcelProperty(value = "备用字段", index = 14)
private String note3; private String note3;

View File

@ -42,9 +42,9 @@ public class TbProjectUseExcel {
private Long updater; private Long updater;
@ExcelProperty(value = "修改时间", index = 11) @ExcelProperty(value = "修改时间", index = 11)
private Date updateDate; private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12) @ExcelProperty(value = "项目id", index = 12)
private String note1; private String note1;
@ExcelProperty(value = "备用字段", index = 13) @ExcelProperty(value = "应用资源id", index = 13)
private String note2; private String note2;
@ExcelProperty(value = "备用字段", index = 14) @ExcelProperty(value = "备用字段", index = 14)
private String note3; private String note3;

View File

@ -1,9 +1,12 @@
package io.renren.modules.project.service; package io.renren.modules.project.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService; import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectContribDTO; import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.entity.TbProjectContribEntity; 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<TbProjectContribEntity, TbProjectContribDTO> { public interface TbProjectContribService extends CrudService<TbProjectContribEntity, TbProjectContribDTO> {
PageData<TbProjectContribDTO> queryList(Map<String, Object> params);
} }

View File

@ -1,9 +1,12 @@
package io.renren.modules.project.service; package io.renren.modules.project.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService; import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectUseDTO; import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.entity.TbProjectUseEntity; 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<TbProjectUseEntity, TbProjectUseDTO> { public interface TbProjectUseService extends CrudService<TbProjectUseEntity, TbProjectUseDTO> {
PageData<TbProjectUseDTO> queryList(Map<String, Object> params);
} }

View File

@ -1,6 +1,7 @@
package io.renren.modules.project.service.impl; package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectContribDao; 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.project.service.TbProjectContribService;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -22,6 +25,9 @@ import java.util.Map;
@Service @Service
public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContribDao, TbProjectContribEntity, TbProjectContribDTO> implements TbProjectContribService { public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContribDao, TbProjectContribEntity, TbProjectContribDTO> implements TbProjectContribService {
@Autowired
private TbProjectContribDao tbProjectContribDao;
@Override @Override
public QueryWrapper<TbProjectContribEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<TbProjectContribEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectContribEntity> wrapper = new QueryWrapper<>(); QueryWrapper<TbProjectContribEntity> wrapper = new QueryWrapper<>();
@ -36,5 +42,32 @@ public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContri
return wrapper; return wrapper;
} }
@Override
public PageData<TbProjectContribDTO> queryList(Map<String, Object> 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<TbProjectContribDTO> list = tbProjectContribDao.queryList(currentNum,pageSize,projectName,resourceName);
return new PageData<>(list,count);
}
} }

View File

@ -1,6 +1,7 @@
package io.renren.modules.project.service.impl; package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectUseDao; 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.project.service.TbProjectUseService;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -22,6 +25,9 @@ import java.util.Map;
@Service @Service
public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, TbProjectUseEntity, TbProjectUseDTO> implements TbProjectUseService { public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, TbProjectUseEntity, TbProjectUseDTO> implements TbProjectUseService {
@Autowired
private TbProjectUseDao tbProjectUseDao;
@Override @Override
public QueryWrapper<TbProjectUseEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<TbProjectUseEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectUseEntity> wrapper = new QueryWrapper<>(); QueryWrapper<TbProjectUseEntity> wrapper = new QueryWrapper<>();
@ -37,4 +43,32 @@ public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, Tb
} }
@Override
public PageData<TbProjectUseDTO> queryList(Map<String, Object> 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<TbProjectUseDTO> list = tbProjectUseDao.queryList(currentNum,pageSize,projectName,resourceName);
return new PageData<>(list,count);
}
} }

View File

@ -0,0 +1,7 @@
ALTER TABLE `tb_project_contrib`
MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目idtb_project主键',
MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用idtb_data_resource中类型为应用资源的主键id';
ALTER TABLE `tb_project_use`
MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目idtb_project主键',
MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用idtb_data_resource中类型为应用资源的主键id';

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectContribDao">
<resultMap type="io.renren.modules.project.entity.TbProjectContribEntity" id="tbProjectContribMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="resourceName" column="resource_name"/>
<result property="abilityName" column="ability_name"/>
<result property="abilityType" column="ability_type"/>
<result property="applyTime" column="apply_time"/>
<result property="applyNum" column="apply_num"/>
<result property="browseNum" column="browse_num"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
<select id="queryCount" resultType="java.lang.Integer">
SELECT
count(*)
FROM tb_project_contrib tpc
left join tb_project tp on tpc.note1 = tp.id
left join tb_data_resource tdrapp on tpc.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpc.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
</select>
<select id="queryList" resultMap="tbProjectContribMap">
SELECT
tp.project_name,
tdrapp.name as resource_name,
tdrother.name as ability_name,
tdrother.type as ability_type,
tdrother.create_date as apply_time,
IFNULL(applynum.num,0)as apply_num,
tdrother.visits as browse_num
FROM tb_project_contrib tpc
left join tb_project tp on tpc.note1 = tp.id
left join tb_data_resource tdrapp on tpc.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpc.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
ORDER BY tdrother.create_date desc
limit #{currentNum},#{pageSize}
</select>
</mapper>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectDao">
<resultMap type="io.renren.modules.project.entity.TbProjectEntity" id="tbProjectMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="applyDep" column="apply_dep"/>
<result property="applyUser" column="apply_user"/>
<result property="applyTime" column="apply_time"/>
<result property="regionName" column="region_name"/>
<result property="respDep" column="resp_dep"/>
<result property="businessUser" column="business_user"/>
<result property="businessPhone" column="business_phone"/>
<result property="techUser" column="tech_user"/>
<result property="techPhone" column="tech_phone"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectUseDao">
<resultMap type="io.renren.modules.project.entity.TbProjectUseEntity" id="tbProjectUseMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="resourceName" column="resource_name"/>
<result property="abilityName" column="ability_name"/>
<result property="abilityType" column="ability_type"/>
<result property="applyTime" column="apply_time"/>
<result property="applyNum" column="apply_num"/>
<result property="browseNum" column="browse_num"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
<select id="queryCount" resultType="java.lang.Integer">
SELECT
count(*)
FROM tb_project_use tpu
left join tb_project tp on tpu.note1 = tp.id
left join tb_data_resource tdrapp on tpu.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpu.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
</select>
<select id="queryList" resultMap="tbProjectUseMap">
SELECT
tp.project_name,
tdrapp.name as resource_name,
tdrother.name as ability_name,
tdrother.type as ability_type,
tdrother.create_date as apply_time,
IFNULL(applynum.num,0)as apply_num,
tdrother.visits as browse_num
FROM tb_project_use tpu
left join tb_project tp on tpu.note1 = tp.id
left join tb_data_resource tdrapp on tpu.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpu.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
ORDER BY tdrother.create_date desc
limit #{currentNum},#{pageSize}
</select>
</mapper>