加入需求评论

This commit is contained in:
wangliwen 2022-04-26 09:53:13 +08:00
parent 19f628ee58
commit 0ae65d020d
9 changed files with 350 additions and 0 deletions

View File

@ -0,0 +1,116 @@
package io.renren.modules.demandComment.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.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.excel.TDemandCommentExcel;
import io.renren.modules.demandComment.service.TDemandCommentService;
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 wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@RestController
@RequestMapping("demandComment/tdemandcomment")
@Api(tags="需求评论")
public class TDemandCommentController {
@Autowired
private TDemandCommentService tDemandCommentService;
@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("demandComment:tdemandcomment:page")
public Result<PageData<TDemandCommentDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TDemandCommentDTO> page = tDemandCommentService.page(params);
return new Result<PageData<TDemandCommentDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("demandComment:tdemandcomment:info")
public Result<TDemandCommentDTO> get(@PathVariable("id") Long id){
TDemandCommentDTO data = tDemandCommentService.get(id);
return new Result<TDemandCommentDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("demandComment:tdemandcomment:save")
public Result save(@RequestBody TDemandCommentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tDemandCommentService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("demandComment:tdemandcomment:update")
public Result update(@RequestBody TDemandCommentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tDemandCommentService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("demandComment:tdemandcomment:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tDemandCommentService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("demandComment:tdemandcomment:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TDemandCommentDTO> list = tDemandCommentService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "需求评论", list, TDemandCommentExcel.class);
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.demandComment.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 需求评论
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@Mapper
public interface TDemandCommentDao extends BaseDao<TDemandCommentEntity> {
}

View File

@ -0,0 +1,45 @@
package io.renren.modules.demandComment.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 需求评论
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@Data
@ApiModel(value = "需求评论")
public class TDemandCommentDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "评论人")
private Long creator;
@ApiModelProperty(value = "评论时间")
private Date createDate;
@ApiModelProperty(value = "评论人部门名称")
private String createDeptName;
@ApiModelProperty(value = "评论人姓名")
private String name;
@ApiModelProperty(value = "评论内容")
private String comment;
@ApiModelProperty(value = "评论主题id")
private Long targetId;
@ApiModelProperty(value = "备用字段")
private String note1;
@ApiModelProperty(value = "备用字段")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;
@ApiModelProperty(value = "备用字段")
private String note4;
@ApiModelProperty(value = "备用字段")
private String note5;
}

View File

@ -0,0 +1,57 @@
package io.renren.modules.demandComment.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 需求评论
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_demand_comment")
public class TDemandCommentEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 评论人部门名称
*/
private String createDeptName;
/**
* 评论人姓名
*/
private String name;
/**
* 评论内容
*/
private String comment;
/**
* 评论主题id
*/
private Long targetId;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
}

View File

@ -0,0 +1,45 @@
package io.renren.modules.demandComment.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 wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TDemandCommentExcel {
@ExcelProperty(value = "Long", index = 0)
private Long id;
@ExcelProperty(value = "评论人", index = 1)
private Long creator;
@ExcelProperty(value = "评论时间", index = 2)
private Date createDate;
@ExcelProperty(value = "评论人部门名称", index = 3)
private String createDeptName;
@ExcelProperty(value = "评论人姓名", index = 4)
private String name;
@ExcelProperty(value = "评论内容", index = 5)
private String comment;
@ExcelProperty(value = "评论主题id", index = 6)
private Long targetId;
@ExcelProperty(value = "备用字段", index = 7)
private String note1;
@ExcelProperty(value = "备用字段", index = 8)
private String note2;
@ExcelProperty(value = "备用字段", index = 9)
private String note3;
@ExcelProperty(value = "备用字段", index = 10)
private String note4;
@ExcelProperty(value = "备用字段", index = 11)
private String note5;
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.demandComment.service;
import io.renren.common.service.CrudService;
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
/**
* 需求评论
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
public interface TDemandCommentService extends CrudService<TDemandCommentEntity, TDemandCommentDTO> {
}

View File

@ -0,0 +1,34 @@
package io.renren.modules.demandComment.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.demandComment.dao.TDemandCommentDao;
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
import io.renren.modules.demandComment.service.TDemandCommentService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 需求评论
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26
*/
@Service
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
@Override
public QueryWrapper<TDemandCommentEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TDemandCommentEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -71,6 +71,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
default: default:
logger.info("未处理该事件:" + eventName); logger.info("未处理该事件:" + eventName);
} }
logger.error("-----------------------结束资源所有者节点---------------------------");
} }
/** /**

View File

@ -0,0 +1,21 @@
<?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.demandComment.dao.TDemandCommentDao">
<resultMap type="io.renren.modules.demandComment.entity.TDemandCommentEntity" id="tDemandCommentMap">
<result property="id" column="id"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="createDeptName" column="create_dept_name"/>
<result property="name" column="name"/>
<result property="comment" column="comment"/>
<result property="targetId" column="target_id"/>
<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>