门户首页查询最新能力,最热能力实现修改,编目字段表新增字段,能力资源表字段修改
This commit is contained in:
parent
cd0aca28c8
commit
b5dd0c91f8
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,5 +24,5 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
|
||||
List<Map> selectTypeCount(Long deptId);
|
||||
|
||||
List<ResourceDTO> selectMostPopular();
|
||||
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);
|
||||
}
|
|
@ -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 = "创建人")
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,5 +38,5 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
|||
|
||||
Object selectMostPopular(JSONObject jsonObject);
|
||||
|
||||
void updateVisits(ResourceEntity resourceEntity);
|
||||
void updateVisits(Long id);
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -61,7 +62,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
private AttrDao attrDao;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
|
||||
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params){
|
||||
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("type", params.get("type").toString())
|
||||
.eq("del_flag", 0)
|
||||
|
@ -80,9 +81,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceEntity.setDelFlag(0);
|
||||
resourceDao.insert(resourceEntity);
|
||||
|
||||
BeanUtils.copyProperties(resourceEntity, dto); // 将entity id 写入 dto
|
||||
|
||||
List<AttrEntity> attrEntities = dto.getInfoList();
|
||||
List<AttrEntity> attrEntities= dto.getInfoList();
|
||||
attrEntities.forEach(item -> {
|
||||
item.setDelFlag(0);
|
||||
item.setDataResourceId(resourceID);
|
||||
|
@ -108,7 +107,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
ArrayList<Long> list = new ArrayList<>();
|
||||
list.add(resourceEntity.getId());
|
||||
attrDao.delete4Resource(list);
|
||||
List<AttrEntity> attrEntities = dto.getInfoList();
|
||||
List<AttrEntity> attrEntities= dto.getInfoList();
|
||||
attrEntities.forEach(item -> {
|
||||
item.setDelFlag(0);
|
||||
attrDao.insert(item);
|
||||
|
@ -143,8 +142,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
QueryWrapper<ResourceEntity> 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<ResourceEntity> entityPage = resourceDao.selectPage(page, queryWrapper);
|
||||
ArrayList<ResourceDTO> list = new ArrayList<>();
|
||||
|
@ -165,7 +164,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resultPage.setTotal(0);
|
||||
} else {
|
||||
ArrayList<ResourceDTO> 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<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
public Object selectNewest(JSONObject jsonObject) {
|
||||
IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize"));
|
||||
QueryWrapper<ResourceEntity> 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<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper);
|
||||
return entityIPage;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectMostPopular(JSONObject jsonObject) {
|
||||
resourceDao.selectMostPopular();
|
||||
return null;
|
||||
Map<String, Object> selectMap = JSON.toJavaObject(jsonObject, Map.class);
|
||||
List<ResourceDTO> 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<ResourceEntity> 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);
|
||||
}
|
||||
}
|
|
@ -33,7 +33,6 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl<ResourceScoreDao,
|
|||
public QueryWrapper<ResourceScoreEntity> getWrapper(Map<String, Object> params){
|
||||
QueryWrapper<ResourceScoreEntity> wrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
@ -52,7 +51,9 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl<ResourceScoreDao,
|
|||
.eq("del_flag", 0);
|
||||
ResourceScoreDTO scoreDTO = new ResourceScoreDTO();
|
||||
ResourceScoreEntity scoreEntity = resourceScoreDao.selectOne(queryWrapper);
|
||||
if (ObjectUtils.allNotNull(scoreEntity)) {
|
||||
BeanUtils.copyProperties(scoreEntity, scoreDTO);
|
||||
}
|
||||
return scoreDTO;
|
||||
}
|
||||
}
|
|
@ -10,12 +10,10 @@
|
|||
<result property="description" column="description"/>
|
||||
<result property="link" column="link"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="deptContacts" column="dept_contacts"/>
|
||||
<result property="deptPhone" column="dept_phone"/>
|
||||
<result property="districtId" column="district_id"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="dataVolume" column="data_volume"/>
|
||||
<result property="visits" column="visits"/>
|
||||
<result property="downloads" column="downloads"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createDate" column="create_date"/>
|
||||
|
@ -35,12 +33,10 @@
|
|||
<result property="description" column="description"/>
|
||||
<result property="link" column="link"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="deptContacts" column="dept_contacts"/>
|
||||
<result property="deptPhone" column="dept_phone"/>
|
||||
<result property="districtId" column="district_id"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="dataVolume" column="data_volume"/>
|
||||
<result property="visits" column="visits"/>
|
||||
<result property="downloads" column="downloads"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createDate" column="create_date"/>
|
||||
|
@ -135,23 +131,27 @@
|
|||
|
||||
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||
SELECT
|
||||
tdr.id,
|
||||
tdr.dept_id,
|
||||
tdr.description,
|
||||
tdr.downloads,
|
||||
tdr.visits,
|
||||
tdr.*,
|
||||
trs.score,
|
||||
taa.applyCount,
|
||||
(IFNULL(downloads, 0) + IFNULL(visits, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)) as total
|
||||
|
||||
trc.collectCount,
|
||||
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) as total
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
LEFT JOIN ( SELECT resource_id, SUM( score ) AS "score" FROM tb_resource_score WHERE 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 del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||
LEFT JOIN ( SELECT resource_id, SUM(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
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.id = trs.resource_id
|
||||
AND tdr.del_flag = 0
|
||||
ORDER BY downloads DESC
|
||||
<if test="type != null and type != ''">
|
||||
AND tdr.type = #{type}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND tdr.name LIKE CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
ORDER BY ${orderFiled} ${orderType}
|
||||
LIMIT ${pageNum}, ${pageSize}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue