|
@@ -7,9 +7,12 @@ import com.gis.domain.dto.PageDto;
|
|
|
import com.gis.service.CommentService;
|
|
|
import com.gis.service.util.CommentTree;
|
|
|
import com.gis.service.util.CommentTreeUtil;
|
|
|
+import com.gis.web.aop.WebControllerLog;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.shiro.authz.annotation.Logical;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -44,34 +47,42 @@ public class CommentController extends BaseController {
|
|
|
return Result.success(page);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("新增/修改部信息")
|
|
|
+ @ApiOperation("新增/修改")
|
|
|
@PostMapping("save")
|
|
|
public Result save(@Valid @RequestBody CommentRequest param) {
|
|
|
|
|
|
|
|
|
- CommentEntity entity = null;
|
|
|
- if (param.getId() == null) {
|
|
|
- entity = new CommentEntity();
|
|
|
- BeanUtils.copyProperties(param, entity);
|
|
|
- entity.setUserId(getTokenUserId());
|
|
|
- entity.setRealName(getSysUser().getRealName());
|
|
|
- commentService.save(entity);
|
|
|
- } else {
|
|
|
- entity = commentService.findById(param.getId());
|
|
|
- if (entity == null) {
|
|
|
- return Result.failure("对象id不存在");
|
|
|
- }
|
|
|
-
|
|
|
- BeanUtils.copyProperties(param, entity);
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- commentService.update(entity);
|
|
|
-
|
|
|
- }
|
|
|
+// CommentEntity entity = null;
|
|
|
+// if (param.getId() == null) {
|
|
|
+// entity = new CommentEntity();
|
|
|
+// BeanUtils.copyProperties(param, entity);
|
|
|
+// entity.setUserId(getTokenUserId());
|
|
|
+// entity.setRealName(getSysUser().getRealName());
|
|
|
+// commentService.save(entity);
|
|
|
+// } else {
|
|
|
+// entity = commentService.findById(param.getId());
|
|
|
+// if (entity == null) {
|
|
|
+// return Result.failure("对象id不存在");
|
|
|
+// }
|
|
|
+//
|
|
|
+// BeanUtils.copyProperties(param, entity);
|
|
|
+// entity.setUpdateTime(new Date());
|
|
|
+// commentService.update(entity);
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ CommentEntity entity = new CommentEntity();
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
+ entity.setUserId(getTokenUserId());
|
|
|
+ entity.setRealName(getSysUser().getRealName());
|
|
|
+ commentService.save(entity);
|
|
|
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @WebControllerLog(description = "留言管理-删除留言")
|
|
|
+ @RequiresRoles(value = {"sys_admin", "sys_high", "sys_normal"}, logical = Logical.OR)
|
|
|
@ApiOperation("删除")
|
|
|
@GetMapping("removes/{ids}")
|
|
|
public Result detail(@PathVariable String ids) {
|