3 changed files with 289 additions and 0 deletions
@ -0,0 +1,70 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.comment.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "comment") |
|||
public class AppTopicCommentController { |
|||
|
|||
@Autowired |
|||
private TopicCommentService topicCommentService; |
|||
|
|||
@Autowired |
|||
private TopicCommentUserAttitudeService topicCommentUserAttitudeService; |
|||
|
|||
/** |
|||
* 提交评论或回复接口 |
|||
*/ |
|||
@PostMapping("submit") |
|||
public Result submit(@RequestBody TopicCommentFormDTO commentFormDTO){ |
|||
ValidatorUtils.validateEntity(commentFormDTO); |
|||
return topicCommentService.submit(commentFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* 评论列表 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<TopicCommentsResultDTO> listOfComments(@RequestBody TopicCommentsFormDTO formDto) { |
|||
return topicCommentService.listOfComments(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 评论(赞/踩)接口 |
|||
* @param formDto |
|||
* @return |
|||
*/ |
|||
@PostMapping("statement") |
|||
public Result statement(@RequestBody TopicCommentStatementFormDTO formDto) { |
|||
topicCommentUserAttitudeService.statement(formDto); |
|||
return new Result(); |
|||
} |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.comment.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentListDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicDeleteCommentsFormDTO; |
|||
import com.elink.esua.epdc.modules.comment.excel.TopicCommentExcel; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("topiccomment") |
|||
public class TopicCommentController { |
|||
|
|||
@Autowired |
|||
private TopicCommentService topicCommentService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<TopicCommentDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<TopicCommentDTO> page = topicCommentService.page(params); |
|||
return new Result<PageData<TopicCommentDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<TopicCommentDTO> get(@PathVariable("id") String id){ |
|||
TopicCommentDTO data = topicCommentService.get(id); |
|||
return new Result<TopicCommentDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody TopicCommentDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
topicCommentService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody TopicCommentDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
topicCommentService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
topicCommentService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<TopicCommentDTO> list = topicCommentService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* 评论列表 |
|||
* |
|||
* @params [params] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.comment.TopicCommentDTO>> |
|||
* @author liuchuang |
|||
* @since 2019/11/12 10:37 |
|||
*/ |
|||
@GetMapping("comments") |
|||
public Result<PageData<TopicCommentListDTO>> commentsList(@RequestParam Map<String, Object> params) { |
|||
PageData<TopicCommentListDTO> page = topicCommentService.listComments(params); |
|||
return new Result<PageData<TopicCommentListDTO>>().ok(page); |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* 屏蔽评论 |
|||
* |
|||
* @params [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author liuchuang |
|||
* @since 2019/11/12 11:07 |
|||
*/ |
|||
@PostMapping("deleteComment") |
|||
public Result deleteComment(@RequestBody TopicDeleteCommentsFormDTO formDto) { |
|||
return topicCommentService.modifyCommentById(formDto.getCommentIds()); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.comment.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentUserAttitudeDTO; |
|||
import com.elink.esua.epdc.modules.comment.excel.TopicCommentUserAttitudeExcel; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 话题评论用户表态表 话题评论用户表态表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("topiccommentuserattitude") |
|||
public class TopicCommentUserAttitudeController { |
|||
|
|||
@Autowired |
|||
private TopicCommentUserAttitudeService topicCommentUserAttitudeService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<TopicCommentUserAttitudeDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<TopicCommentUserAttitudeDTO> page = topicCommentUserAttitudeService.page(params); |
|||
return new Result<PageData<TopicCommentUserAttitudeDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<TopicCommentUserAttitudeDTO> get(@PathVariable("id") String id){ |
|||
TopicCommentUserAttitudeDTO data = topicCommentUserAttitudeService.get(id); |
|||
return new Result<TopicCommentUserAttitudeDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody TopicCommentUserAttitudeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
topicCommentUserAttitudeService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody TopicCommentUserAttitudeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
topicCommentUserAttitudeService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
topicCommentUserAttitudeService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<TopicCommentUserAttitudeDTO> list = topicCommentUserAttitudeService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentUserAttitudeExcel.class); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue