门户首页各种条件查询能力,新增我的收藏和评分功能

This commit is contained in:
dinggang 2022-04-24 16:30:15 +08:00
parent 0d1036c3d7
commit 8dab238003
21 changed files with 943 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.DefaultGroup;
import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.ResourceEntity;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -18,6 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -84,7 +86,6 @@ public class ResourceController {
return new Result<ResourceDTO>().ok(data); return new Result<ResourceDTO>().ok(data);
} }
@GetMapping("/selectTotal") @GetMapping("/selectTotal")
@ApiOperation("查询系统及本部门已汇聚能力") @ApiOperation("查询系统及本部门已汇聚能力")
@LogOperation("查询系统及本部门已汇聚能力") @LogOperation("查询系统及本部门已汇聚能力")
@ -99,7 +100,6 @@ public class ResourceController {
return new Result<>().ok(resourceService.selectNewest(jsonObject)); return new Result<>().ok(resourceService.selectNewest(jsonObject));
} }
@GetMapping("/selectMostPopular") @GetMapping("/selectMostPopular")
@ApiOperation("查询热门能力") @ApiOperation("查询热门能力")
@LogOperation("查询热门能力") @LogOperation("查询热门能力")
@ -107,6 +107,16 @@ public class ResourceController {
return new Result<>().ok(resourceService.selectMostPopular(jsonObject)); return new Result<>().ok(resourceService.selectMostPopular(jsonObject));
} }
@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);
return new Result();
}
@PostMapping("/insert") @PostMapping("/insert")
@ApiOperation("保存") @ApiOperation("保存")

View File

@ -37,4 +37,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectNewest(JSONObject jsonObject); Object selectNewest(JSONObject jsonObject);
Object selectMostPopular(JSONObject jsonObject); Object selectMostPopular(JSONObject jsonObject);
void updateVisits(ResourceEntity resourceEntity);
} }

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -246,4 +247,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceDao.selectMostPopular(); resourceDao.selectMostPopular();
return null; return null;
} }
@Override
public void updateVisits(ResourceEntity resourceEntity) {
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);
}
} }

View File

@ -0,0 +1,110 @@
package io.renren.modules.resourceCollection.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.common.annotation.LogOperation;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
import io.renren.modules.resourceCollection.excel.ResourceCollectionExcel;
import io.renren.modules.resourceCollection.service.ResourceCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@RestController
@RequestMapping("/resourcecollection")
@Api(tags="能力收藏表")
public class ResourceCollectionController {
@Autowired
private ResourceCollectionService resourceCollectionService;
@GetMapping("/page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "当前页码从1开始", paramType = "body", required = true, dataType="int") ,
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "body",required = true, dataType="int") ,
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "body", dataType="String"),
@ApiImplicitParam(name = "name", value = "资源名称", paramType = "body", dataType="String")
})
//@RequiresPermissions("resourceCar:resourcecar:page")
public Result<IPage<ResourceCollectionDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
return new Result<IPage<ResourceCollectionDTO>>().ok(resourceCollectionService.selectPage(params));
}
@GetMapping("/select/{id}")
@ApiOperation("信息")
//@RequiresPermissions("resourceCollection:resourcecollection:info")
public Result<ResourceCollectionDTO> get(@PathVariable("id") Long id){
ResourceCollectionDTO data = resourceCollectionService.get(id);
return new Result<ResourceCollectionDTO>().ok(data);
}
@PostMapping("/insert")
@ApiOperation("保存")
@LogOperation("保存")
//@RequiresPermissions("resourceCollection:resourcecollection:save")
public Result save(@RequestBody List<ResourceCollectionEntity> list){
//效验数据
//ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resourceCollectionService.insertList(list);
return new Result();
}
@PutMapping("/update")
@ApiOperation("修改")
@LogOperation("修改")
//@RequiresPermissions("resourceCollection:resourcecollection:update")
public Result update(@RequestBody ResourceCollectionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resourceCollectionService.update(dto);
return new Result();
}
@DeleteMapping("/delete")
@ApiOperation("删除")
@LogOperation("删除")
//@RequiresPermissions("resourceCollection:resourcecollection:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
//AssertUtils.isArrayEmpty(ids, "id");
resourceCollectionService.deleteByIds(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
//@RequiresPermissions("resourceCollection:resourcecollection:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ResourceCollectionDTO> list = resourceCollectionService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "能力收藏表", list, ResourceCollectionExcel.class);
}
}

View File

@ -0,0 +1,26 @@
package io.renren.modules.resourceCollection.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@Mapper
public interface ResourceCollectionDao extends BaseDao<ResourceCollectionEntity> {
Integer deleteByIds(@Param("ids") Long[] ids);
List<ResourceCollectionDTO> selectPageWithResource(@Param("params") Map<String, Object> params,
@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize);
}

View File

@ -0,0 +1,50 @@
package io.renren.modules.resourceCollection.dto;
import io.renren.modules.resource.dto.ResourceDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@Data
@ApiModel(value = "能力收藏表")
public class ResourceCollectionDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "能力ID")
private Long resourceId;
@ApiModelProperty(value = "删除标志0:正常1:已删除9:其他")
private Integer delFlag;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段1")
private String note1;
@ApiModelProperty(value = "备用字段2")
private String note2;
@ApiModelProperty(value = "备用字段3")
private String note3;
@ApiModelProperty(value = "备用字段4")
private String note4;
@ApiModelProperty(value = "备用字段5")
private String note5;
@ApiModelProperty(value = "资源信息")
private ResourceDTO resourceDTO;
}

View File

@ -0,0 +1,74 @@
package io.renren.modules.resourceCollection.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_resource_collection")
public class ResourceCollectionEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 能力ID
*/
private Long resourceId;
/**
* 删除标志0:正常1:已删除9:其他
*/
private Integer delFlag;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段1
*/
private String note1;
/**
* 备用字段2
*/
private String note2;
/**
* 备用字段3
*/
private String note3;
/**
* 备用字段4
*/
private String note4;
/**
* 备用字段5
*/
private String note5;
}

View File

@ -0,0 +1,47 @@
package io.renren.modules.resourceCollection.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class ResourceCollectionExcel {
@ExcelProperty(value = "Long", index = 0)
private Long id;
@ExcelProperty(value = "用户ID", index = 1)
private Long userId;
@ExcelProperty(value = "能力ID", index = 2)
private Long resourceId;
@ExcelProperty(value = "删除标志0:正常1:已删除9:其他", index = 3)
private Integer delFlag;
@ExcelProperty(value = "创建人", index = 4)
private Object creator;
@ExcelProperty(value = "创建时间", index = 5)
private Date createDate;
@ExcelProperty(value = "修改人", index = 6)
private Long updater;
@ExcelProperty(value = "修改时间", index = 7)
private Date updateDate;
@ExcelProperty(value = "备用字段1", index = 8)
private String note1;
@ExcelProperty(value = "备用字段2", index = 9)
private String note2;
@ExcelProperty(value = "备用字段3", index = 10)
private String note3;
@ExcelProperty(value = "备用字段4", index = 11)
private String note4;
@ExcelProperty(value = "备用字段5", index = 12)
private String note5;
}

View File

@ -0,0 +1,25 @@
package io.renren.modules.resourceCollection.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.common.service.CrudService;
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
import java.util.List;
import java.util.Map;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
public interface ResourceCollectionService extends CrudService<ResourceCollectionEntity, ResourceCollectionDTO> {
void insertList(List<ResourceCollectionEntity> list);
void deleteByIds(Long[] ids);
IPage<ResourceCollectionDTO> selectPage(Map<String, Object> params);
}

View File

@ -0,0 +1,88 @@
package io.renren.modules.resourceCollection.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
import io.renren.modules.resourceCollection.entity.ResourceCollectionEntity;
import io.renren.modules.resourceCollection.service.ResourceCollectionService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 能力收藏表
*
* @author dg
* @since 1.0 2022-04-22
*/
@Service
public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceCollectionDao, ResourceCollectionEntity, ResourceCollectionDTO> implements ResourceCollectionService {
@Autowired
private ResourceCollectionDao resourceCollectionDao;
@Autowired
private ResourceService resourceService;
@Override
public QueryWrapper<ResourceCollectionEntity> getWrapper(Map<String, Object> params){
QueryWrapper<ResourceCollectionEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
@Override
public IPage<ResourceCollectionDTO> selectPage(Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
int pageNum = Integer.parseInt(params.get("pageNum").toString());
int pageSize = Integer.parseInt(params.get("pageSize").toString());
Page<ResourceCollectionDTO> page = new Page(pageNum, pageSize);
params.put("userId", user.getId());
List<ResourceCollectionDTO> resourceCollectionDTOS = resourceCollectionDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize);
resourceCollectionDTOS.forEach(item -> {
item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId()));
});
List<ResourceCollectionDTO> resourceCollectionDTOSs = resourceCollectionDao.selectPageWithResource(params, 0, 100000);
page.setRecords(resourceCollectionDTOS);
page.setTotal(resourceCollectionDTOSs.size());
return page;
}
@Override
@Transactional
public void insertList(List<ResourceCollectionEntity> list) {
UserDetail user = SecurityUser.getUser();
list.forEach(item -> {
item.setUserId(user.getId());
item.setDelFlag(0);
HashMap<String, Object> selectMap = new HashMap<>();
selectMap.put("resource_id", item.getResourceId());
selectMap.put("user_id", user.getId());
selectMap.put("del_flag", 0);
List<ResourceCollectionEntity> collectionEntities = resourceCollectionDao.selectByMap(selectMap);
if (collectionEntities.isEmpty()) {
resourceCollectionDao.insert(item);
}
});
}
@Override
public void deleteByIds(Long[] ids) {
resourceCollectionDao.deleteByIds(ids);
}
}

View File

@ -0,0 +1,121 @@
package io.renren.modules.resourceScore.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.resourceScore.dto.ResourceScoreDTO;
import io.renren.modules.resourceScore.excel.ResourceScoreExcel;
import io.renren.modules.resourceScore.service.ResourceScoreService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@RestController
@RequestMapping("/resourcescore")
@Api(tags="能力评分表")
public class ResourceScoreController {
@Autowired
private ResourceScoreService resourceScoreService;
@GetMapping("/page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
//@RequiresPermissions("resourceScore:resourcescore:page")
public Result<PageData<ResourceScoreDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ResourceScoreDTO> page = resourceScoreService.page(params);
return new Result<PageData<ResourceScoreDTO>>().ok(page);
}
@GetMapping("/select/{resourceId}")
@ApiOperation("查询个人评价信息")
//@RequiresPermissions("resourceScore:resourcescore:info")
public Result<ResourceScoreDTO> get(@PathVariable("resourceId") Long resourceId){
ResourceScoreDTO data = resourceScoreService.selectByRidAndUid(resourceId);
return new Result<ResourceScoreDTO>().ok(data);
}
@PostMapping("/insert")
@ApiOperation("保存")
@LogOperation("保存")
//@RequiresPermissions("resourceScore:resourcescore:save")
public Result save(@RequestBody ResourceScoreDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
UserDetail user = SecurityUser.getUser();
dto.setUserId(user.getId());
dto.setDelFlag(0);
resourceScoreService.save(dto);
return new Result();
}
@PutMapping("/update")
@ApiOperation("修改")
@LogOperation("修改")
//@RequiresPermissions("resourceScore:resourcescore:update")
public Result update(@RequestBody ResourceScoreDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
resourceScoreService.update(dto);
return new Result();
}
@DeleteMapping("/delete")
@ApiOperation("删除")
@LogOperation("删除")
//@RequiresPermissions("resourceScore:resourcescore:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
//AssertUtils.isArrayEmpty(ids, "id");
resourceScoreService.deleteByIds(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
//@RequiresPermissions("resourceScore:resourcescore:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ResourceScoreDTO> list = resourceScoreService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "能力评分表", list, ResourceScoreExcel.class);
}
}

View File

@ -0,0 +1,18 @@
package io.renren.modules.resourceScore.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.resourceScore.entity.ResourceScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@Mapper
public interface ResourceScoreDao extends BaseDao<ResourceScoreEntity> {
Integer deleteByIds(@Param("ids") Long[] ids);
}

View File

@ -0,0 +1,56 @@
package io.renren.modules.resourceScore.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@Data
@ApiModel(value = "能力评分表")
public class ResourceScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "用户姓名")
private String userName;
@ApiModelProperty(value = "用户所属部门")
private String userDept;
@ApiModelProperty(value = "能力ID")
private Long resourceId;
@ApiModelProperty(value = "评分1-5分1分差评5分好评")
private Integer score;
@ApiModelProperty(value = "评论内容")
private String comment;
@ApiModelProperty(value = "删除标志0:正常1:已删除")
private Integer delFlag;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段1")
private String note1;
@ApiModelProperty(value = "备用字段2")
private String note2;
@ApiModelProperty(value = "备用字段3")
private String note3;
@ApiModelProperty(value = "备用字段4")
private String note4;
@ApiModelProperty(value = "备用字段5")
private String note5;
}

View File

@ -0,0 +1,85 @@
package io.renren.modules.resourceScore.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_resource_score")
public class ResourceScoreEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 能力ID
*/
private Long resourceId;
/**
* 评分1-5分1分差评5分好评
*/
private Integer score;
/**
* 评论内容
*/
private String comment;
/**
* 删除标志0:正常1:已删除
*/
private Integer delFlag;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段1
*/
private String note1;
/**
* 备用字段2
*/
private String note2;
/**
* 备用字段3
*/
private String note3;
/**
* 备用字段4
*/
private String note4;
/**
* 备用字段5
*/
private String note5;
}

View File

@ -0,0 +1,51 @@
package io.renren.modules.resourceScore.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class ResourceScoreExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "用户ID", index = 1)
private Long userId;
@ExcelProperty(value = "能力ID", index = 2)
private Long resourceId;
@ExcelProperty(value = "评分1-5分1分差评5分好评", index = 3)
private Integer score;
@ExcelProperty(value = "评论内容", index = 4)
private String comment;
@ExcelProperty(value = "删除标志0:正常1:已删除", index = 5)
private Integer delFlag;
@ExcelProperty(value = "创建人", index = 6)
private Long creator;
@ExcelProperty(value = "创建时间", index = 7)
private Date createDate;
@ExcelProperty(value = "修改人", index = 8)
private Long updater;
@ExcelProperty(value = "修改时间", index = 9)
private Date updateDate;
@ExcelProperty(value = "备用字段1", index = 10)
private String note1;
@ExcelProperty(value = "备用字段2", index = 11)
private String note2;
@ExcelProperty(value = "备用字段3", index = 12)
private String note3;
@ExcelProperty(value = "备用字段4", index = 13)
private String note4;
@ExcelProperty(value = "备用字段5", index = 14)
private String note5;
}

View File

@ -0,0 +1,18 @@
package io.renren.modules.resourceScore.service;
import io.renren.common.service.CrudService;
import io.renren.modules.resourceScore.dto.ResourceScoreDTO;
import io.renren.modules.resourceScore.entity.ResourceScoreEntity;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
public interface ResourceScoreService extends CrudService<ResourceScoreEntity, ResourceScoreDTO> {
void deleteByIds(Long[] ids);
ResourceScoreDTO selectByRidAndUid(Long resourceId);
}

View File

@ -0,0 +1,58 @@
package io.renren.modules.resourceScore.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.resourceScore.dto.ResourceScoreDTO;
import io.renren.modules.resourceScore.entity.ResourceScoreEntity;
import io.renren.modules.resourceScore.service.ResourceScoreService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 能力评分表
*
* @author dg
* @since 1.0 2022-04-24
*/
@Service
public class ResourceScoreServiceImpl extends CrudServiceImpl<ResourceScoreDao, ResourceScoreEntity, ResourceScoreDTO> implements ResourceScoreService {
@Autowired
private ResourceScoreDao resourceScoreDao;
@Override
public QueryWrapper<ResourceScoreEntity> getWrapper(Map<String, Object> params){
QueryWrapper<ResourceScoreEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
@Override
public void deleteByIds(Long[] ids) {
resourceScoreDao.deleteByIds(ids);
}
@Override
public ResourceScoreDTO selectByRidAndUid(Long resourceId) {
UserDetail user = SecurityUser.getUser();
QueryWrapper<ResourceScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(ObjectUtils.anyNotNull(resourceId), "resource_id", resourceId)
.eq("user_id", user.getId())
.eq("del_flag", 0);
ResourceScoreDTO scoreDTO = new ResourceScoreDTO();
ResourceScoreEntity scoreEntity = resourceScoreDao.selectOne(queryWrapper);
BeanUtils.copyProperties(scoreEntity, scoreDTO);
return scoreDTO;
}
}

View File

@ -5,9 +5,9 @@ spring:
druid: druid:
#MySQL #MySQL
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: renren username: root
password: 123456 password: Hisense2019
initial-size: 10 initial-size: 10
max-active: 100 max-active: 100
min-idle: 10 min-idle: 10

View File

@ -122,7 +122,7 @@
</select> </select>
<select id="selectTypeCount" resultType="java.util.Map"> <select id="selectTypeCount" resultType="java.util.Map">
select type, count(id) select type, count(id) as "count"
from tb_data_resource from tb_data_resource
where 1 = 1 where 1 = 1
and del_flag = 0 and del_flag = 0

View File

@ -0,0 +1,52 @@
<?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.resourceCollection.dao.ResourceCollectionDao">
<resultMap type="io.renren.modules.resourceCollection.entity.ResourceCollectionEntity" id="resourceCollectionMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="resourceId" column="resource_id"/>
<result property="delFlag" column="del_flag"/>
<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>
<update id="deleteByIds">
update tb_resource_collection
set del_flag = 1,
update_date = now()
where 1 = 1
and id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
select trc.*
from tb_resource_collection trc
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag = 0
</if>
where 1 = 1
and trc.del_flag = 0
and user_id = #{params.userId}
<if test="params.name != null and params.name != ''" >
and tdr.name like CONCAT('%',#{params.name},'%')
</if>
<if test="params.type != null and params.type != ''">
and tdr.type = #{params.type}
</if>
order by trc.update_date desc, trc.create_date desc
limit ${pageNum}, ${pageSize}
</select>
</mapper>

View File

@ -0,0 +1,35 @@
<?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.resourceScore.dao.ResourceScoreDao">
<resultMap type="io.renren.modules.resourceScore.entity.ResourceScoreEntity" id="resourceScoreMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="resourceId" column="resource_id"/>
<result property="score" column="score"/>
<result property="comment" column="comment"/>
<result property="delFlag" column="del_flag"/>
<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>
<update id="deleteByIds">
update tb_resource_score
set del_flag = 1,
update_date = now()
where 1 = 1
and id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>