diff --git a/renren-admin/src/main/java/io/renren/modules/category/dto/CategoryDTO.java b/renren-admin/src/main/java/io/renren/modules/category/dto/CategoryDTO.java index e17655ac..dd13763b 100644 --- a/renren-admin/src/main/java/io/renren/modules/category/dto/CategoryDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/category/dto/CategoryDTO.java @@ -28,6 +28,8 @@ public class CategoryDTO implements Serializable { private Long pid; @ApiModelProperty(value = "是否为属性字段,true/false") private String isAttr; + @ApiModelProperty(value = "输入类型:input/单行文本,textArea/多行文本,select/下拉选择,img/图片,video/视频,file/文件") + private String type; @ApiModelProperty(value = "是否作为筛选条件,true/false") private String isFilterCriteria; @ApiModelProperty(value = "是否和字典表关联,true/false") diff --git a/renren-admin/src/main/java/io/renren/modules/category/entity/Category.java b/renren-admin/src/main/java/io/renren/modules/category/entity/Category.java index d294c5be..d083698e 100644 --- a/renren-admin/src/main/java/io/renren/modules/category/entity/Category.java +++ b/renren-admin/src/main/java/io/renren/modules/category/entity/Category.java @@ -42,6 +42,10 @@ public class Category implements Serializable { * 是否为属性字段,true/false */ private String isAttr; + /** + * 输入类型:input/单行文本,textArea/多行文本,select/下拉选择,img/图片,video/视频,file/文件 + */ + private String type; /** * 是否作为筛选条件,true/false */ 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 83a3ea64..b246c08d 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 @@ -93,14 +93,14 @@ public class ResourceController { return new Result<>().ok(resourceService.selectTotal()); } - @GetMapping("/selectNewest") + @PostMapping("/selectNewest") @ApiOperation("查询最新上架能力") @LogOperation("查询最新上架能力") public Result selectNewest(@RequestBody JSONObject jsonObject) { return new Result<>().ok(resourceService.selectNewest(jsonObject)); } - @GetMapping("/selectMostPopular") + @PostMapping("/selectMostPopular") @ApiOperation("查询热门能力") @LogOperation("查询热门能力") public Result selectMostPopular(@RequestBody JSONObject jsonObject) { @@ -110,11 +110,8 @@ public class ResourceController { @GetMapping("/updateVisits") @ApiOperation("更新能力访问量") @LogOperation("更新能力访问量") - public Result updateVisits(@RequestBody ResourceEntity resourceEntity) { - if (ObjectUtils.isEmpty(resourceEntity.getId()) || ObjectUtils.isEmpty(resourceEntity.getVisits())) { - return new Result().error(); - } - resourceService.updateVisits(resourceEntity); + public Result updateVisits(@RequestParam Long id) { + resourceService.updateVisits(id); return new Result(); } 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 7a8c8e1d..d01db9c4 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 @@ -24,5 +24,5 @@ public interface ResourceDao extends BaseDao { List selectTypeCount(Long deptId); - List selectMostPopular(); + List selectMostPopular(Map selectMap); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index 5092fdaa..4c7734a8 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -20,7 +20,7 @@ import java.util.List; public class ResourceDTO implements Serializable { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "主键") + @ApiModelProperty(value = "主键ID") private Long id; @ApiModelProperty(value = "类型:基础设施,数据资源等") private String type; @@ -30,20 +30,20 @@ public class ResourceDTO implements Serializable { private String description; @ApiModelProperty(value = "链接URL") private String link; + @ApiModelProperty(value = "apiURL") + private String apiUrl; + @ApiModelProperty(value = "groupID") + private String groupId; @ApiModelProperty(value = "所属部门") private Long deptId; + @ApiModelProperty(value = "部门联系人") + private String deptContacts; + @ApiModelProperty(value = "联系电话") + private String deptPhone; @ApiModelProperty(value = "地区编码") private Long districtId; - @ApiModelProperty(value = "图片保存地址") - private String image; - @ApiModelProperty(value = "数据量") - private String dataVolume; @ApiModelProperty(value = "访问量") private Long visits; - @ApiModelProperty(value = "下载量") - private Long downloads; - @ApiModelProperty(value = "评分") - private String score; @ApiModelProperty(value = "删除标志:0:正常;1:已删除;9其他") private Integer delFlag; @ApiModelProperty(value = "创建人") diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 87ce50f2..d249e22d 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -3,6 +3,8 @@ package io.renren.modules.resource.entity; import lombok.Data; import lombok.EqualsAndHashCode; import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; import java.util.Date; /** @@ -39,34 +41,34 @@ public class ResourceEntity { */ private String link; /** + * apiURL + */ + private String apiUrl; + /** + * groupID + */ + private String groupId; + /** * 所属部门 */ private Long deptId; /** + * 部门联系人 + */ + private String deptContacts; + /** + * 联系电话 + */ + private String deptPhone; + /** * 地区编码 */ private Long districtId; /** - * 图片保存地址 - */ - private String image; - /** - * 数据量 - */ - private String dataVolume; - /** * 访问量 */ private Long visits; /** - * 下载量 - */ - private Long downloads; - /** - * 评分 - */ - private String score; - /** * 删除标志:0:正常;1:已删除;9其他 */ private Integer delFlag; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index 46ab971b..8c2f954a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -38,5 +38,5 @@ public interface ResourceService extends CrudService getWrapper(Map params) { + public QueryWrapper getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("type", params.get("type").toString()) .eq("del_flag", 0) @@ -80,9 +81,7 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); + List attrEntities= dto.getInfoList(); attrEntities.forEach(item -> { item.setDelFlag(0); item.setDataResourceId(resourceID); @@ -108,7 +107,7 @@ public class ResourceServiceImpl extends CrudServiceImpl list = new ArrayList<>(); list.add(resourceEntity.getId()); attrDao.delete4Resource(list); - List attrEntities = dto.getInfoList(); + List attrEntities= dto.getInfoList(); attrEntities.forEach(item -> { item.setDelFlag(0); attrDao.insert(item); @@ -143,8 +142,8 @@ public class ResourceServiceImpl extends CrudServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("del_flag", 0) .like(StringUtils.isNotBlank(resourceDTO.getName()), "name", resourceDTO.getName()) - .eq(ObjectUtil.isNotNull(resourceDTO.getDistrictId()), "district_id", resourceDTO.getDistrictId()) - .eq(ObjectUtil.isNotNull(resourceDTO.getDeptId()), "dept_id", resourceDTO.getDeptId()) + .eq(ObjectUtil.isNotNull(resourceDTO.getDistrictId()),"district_id", resourceDTO.getDistrictId()) + .eq(ObjectUtil.isNotNull(resourceDTO.getDeptId()),"dept_id", resourceDTO.getDeptId()) .eq("type", resourceDTO.getType()); Page entityPage = resourceDao.selectPage(page, queryWrapper); ArrayList list = new ArrayList<>(); @@ -165,7 +164,7 @@ public class ResourceServiceImpl extends CrudServiceImpl recordLists = new ArrayList<>(); - for (int i = (pageNum - 1) * pageSize; i < j; i++) { + for (int i = (pageNum - 1 ) * pageSize; i < j; i++) { recordLists.add(resourceDTOS.get(i)); } resultPage.setRecords(recordLists); @@ -237,26 +236,32 @@ public class ResourceServiceImpl extends CrudServiceImpl page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize")); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("create_date") - .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")); - return resourceDao.selectList(queryWrapper); + .eq(StringUtils.isNotBlank(jsonObject.getString("type")),"type", jsonObject.getString("type")) + .eq("del_flag", 0); + IPage entityIPage = resourceDao.selectPage(page, queryWrapper); + return entityIPage; } @Override public Object selectMostPopular(JSONObject jsonObject) { - resourceDao.selectMostPopular(); - return null; + Map selectMap = JSON.toJavaObject(jsonObject, Map.class); + List resourceDTOS = resourceDao.selectMostPopular(selectMap); + return resourceDTOS; } @Override - public void updateVisits(ResourceEntity resourceEntity) { + public void updateVisits(Long id) { + ResourceEntity resourceEntity = resourceDao.selectById(id); + ResourceEntity entity = new ResourceEntity(); + entity.setVisits(resourceEntity.getVisits() + 1); UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() - .set(ResourceEntity::getVisits, resourceEntity.getVisits() + 1L) .eq(ResourceEntity::getId, resourceEntity.getId()) .eq(ResourceEntity::getDelFlag, 0); - resourceDao.update(null, updateWrapper); + resourceDao.update(entity, updateWrapper); } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceScore/service/impl/ResourceScoreServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceScore/service/impl/ResourceScoreServiceImpl.java index edf71798..aa96003c 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceScore/service/impl/ResourceScoreServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceScore/service/impl/ResourceScoreServiceImpl.java @@ -33,7 +33,6 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); - return wrapper; } @@ -52,7 +51,9 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl + + - - - - @@ -35,12 +33,10 @@ + + - - - - @@ -135,23 +131,27 @@ \ No newline at end of file