...
This commit is contained in:
parent
406826f14e
commit
d1d2e5ed65
|
@ -10,6 +10,8 @@ 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.common.validator.group.UpdateGroup;
|
import io.renren.common.validator.group.UpdateGroup;
|
||||||
|
import io.renren.modules.demanData.dto.TDemandDataDTO;
|
||||||
|
import io.renren.modules.demanData.service.TDemandDataService;
|
||||||
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
||||||
import io.renren.modules.demandComment.excel.TDemandCommentExcel;
|
import io.renren.modules.demandComment.excel.TDemandCommentExcel;
|
||||||
import io.renren.modules.demandComment.service.TDemandCommentService;
|
import io.renren.modules.demandComment.service.TDemandCommentService;
|
||||||
|
@ -28,28 +30,31 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 需求评论
|
* 需求评论
|
||||||
*
|
*
|
||||||
* @author wangliwen wangliwen2@hisense.com
|
* @author wangliwen wangliwen2@hisense.com
|
||||||
* @since 1.0 2022-04-26
|
* @since 1.0 2022-04-26
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("demandComment/tdemandcomment")
|
@RequestMapping("demandComment/tdemandcomment")
|
||||||
@Api(tags="需求评论")
|
@Api(tags = "需求评论")
|
||||||
public class TDemandCommentController {
|
public class TDemandCommentController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TDemandCommentService tDemandCommentService;
|
private TDemandCommentService tDemandCommentService;
|
||||||
|
@Autowired
|
||||||
|
private TDemandDataService tDemandDataService;
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
|
@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.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
|
||||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
|
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
|
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "targetId", value = "评论主题id", paramType = "query", dataType = "Long")
|
||||||
})
|
})
|
||||||
@RequiresPermissions("demandComment:tdemandcomment:page")
|
// @RequiresPermissions("demandComment:tdemandcomment:page")
|
||||||
public Result<PageData<TDemandCommentDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
public Result<PageData<TDemandCommentDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
PageData<TDemandCommentDTO> page = tDemandCommentService.page(params);
|
PageData<TDemandCommentDTO> page = tDemandCommentService.page(params);
|
||||||
|
|
||||||
return new Result<PageData<TDemandCommentDTO>>().ok(page);
|
return new Result<PageData<TDemandCommentDTO>>().ok(page);
|
||||||
|
@ -57,8 +62,8 @@ public class TDemandCommentController {
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("信息")
|
@ApiOperation("信息")
|
||||||
@RequiresPermissions("demandComment:tdemandcomment:info")
|
// @RequiresPermissions("demandComment:tdemandcomment:info")
|
||||||
public Result<TDemandCommentDTO> get(@PathVariable("id") Long id){
|
public Result<TDemandCommentDTO> get(@PathVariable("id") Long id) {
|
||||||
TDemandCommentDTO data = tDemandCommentService.get(id);
|
TDemandCommentDTO data = tDemandCommentService.get(id);
|
||||||
|
|
||||||
return new Result<TDemandCommentDTO>().ok(data);
|
return new Result<TDemandCommentDTO>().ok(data);
|
||||||
|
@ -67,11 +72,18 @@ public class TDemandCommentController {
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@LogOperation("保存")
|
@LogOperation("保存")
|
||||||
@RequiresPermissions("demandComment:tdemandcomment:save")
|
// @RequiresPermissions("demandComment:tdemandcomment:save")
|
||||||
public Result save(@RequestBody TDemandCommentDTO dto){
|
public Result save(@RequestBody TDemandCommentDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
TDemandDataDTO dto1 =
|
||||||
|
tDemandDataService.get(dto.getTargetId());
|
||||||
|
if (dto1 == null) {
|
||||||
|
return new Result().error("该评论主题不存在!");
|
||||||
|
}
|
||||||
|
if (dto1.getFlag() != 3) {
|
||||||
|
return new Result().error("该评论主题未审批通过!");
|
||||||
|
}
|
||||||
tDemandCommentService.save(dto);
|
tDemandCommentService.save(dto);
|
||||||
|
|
||||||
return new Result();
|
return new Result();
|
||||||
|
@ -80,8 +92,8 @@ public class TDemandCommentController {
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@LogOperation("修改")
|
@LogOperation("修改")
|
||||||
@RequiresPermissions("demandComment:tdemandcomment:update")
|
// @RequiresPermissions("demandComment:tdemandcomment:update")
|
||||||
public Result update(@RequestBody TDemandCommentDTO dto){
|
public Result update(@RequestBody TDemandCommentDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
@ -93,8 +105,8 @@ public class TDemandCommentController {
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@LogOperation("删除")
|
@LogOperation("删除")
|
||||||
@RequiresPermissions("demandComment:tdemandcomment:delete")
|
// @RequiresPermissions("demandComment:tdemandcomment:delete")
|
||||||
public Result delete(@RequestBody Long[] ids){
|
public Result delete(@RequestBody Long[] ids) {
|
||||||
//效验数据
|
//效验数据
|
||||||
AssertUtils.isArrayEmpty(ids, "id");
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,10 @@ package io.renren.modules.demandComment.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import io.renren.common.service.impl.CrudServiceImpl;
|
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.dao.TDemandCommentDao;
|
||||||
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
||||||
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
|
import io.renren.modules.demandComment.entity.TDemandCommentEntity;
|
||||||
import io.renren.modules.demandComment.service.TDemandCommentService;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -23,10 +20,11 @@ import java.util.Map;
|
||||||
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
|
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<TDemandCommentEntity> getWrapper(Map<String, Object> params){
|
public QueryWrapper<TDemandCommentEntity> getWrapper(Map<String, Object> params) {
|
||||||
QueryWrapper<TDemandCommentEntity> wrapper = new QueryWrapper<>();
|
QueryWrapper<TDemandCommentEntity> wrapper = new QueryWrapper<>();
|
||||||
|
if (params.containsKey("targetId")) {
|
||||||
|
wrapper.eq("target_id", params.get("targetId"));
|
||||||
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue