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