Commit 563bf52e by wangming

Merge branch 'wangming' into '105'

banner

See merge request !10
2 parents a0cc495d aac8ef8b
package com.server.web.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.server.shiro.persistent.bean.SysUser;
import com.server.utils.DateUtils;
import com.server.web.common.mapper.TBaseSecondClassMapper;
import com.server.web.common.mapper.TKzyCommentMapper;
import com.server.web.common.mapper.TKzyCourseMapper;
import com.server.web.common.model.PageModel;
import com.server.web.common.model.TBaseSecondClass;
import com.server.web.common.model.TKzyComment;
import com.server.web.common.model.TKzyCourse;
import com.server.web.common.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 评论管理
*/
@RestController
@RequestMapping(BaseController.OSS_NAMESPACE + "/comment")
public class CommentController extends BaseController {
@Autowired
private TKzyCommentMapper commentMapper;
/**
* 课程评论列表
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping(path = "/commentCourseList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map commentList(Long id,@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize) {
try {
Map paramMap = new HashMap<>();
paramMap.put("id",id);
PageHelper.startPage(pageNo,pageSize,true,false);
List list = openSqlRingsService.selectList_Rings("com.mapping.queryModel.commentCourseList",paramMap);
PageInfo pageInfo = new PageInfo(list);
PageModel model = new PageModel();
model.setTotal(pageInfo.getTotal());
model.setList(list);
return success(model);
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
/**
* 资讯评论列表
* @param id
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping(path = "/commentInformationList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map commentInformationList(Long id,@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize) {
try {
Map paramMap = new HashMap<>();
paramMap.put("id",id);
PageHelper.startPage(pageNo,pageSize,true,false);
List list = openSqlRingsService.selectList_Rings("com.mapping.queryModel.commentInformationList",paramMap);
PageInfo pageInfo = new PageInfo(list);
PageModel model = new PageModel();
model.setTotal(pageInfo.getTotal());
model.setList(list);
return success(model);
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
/**
* 删除评论
* @param id
* @return
*/
@ResponseBody
@RequestMapping(path = "/deleteComment", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map deleteComment(@RequestParam long id) {
try {
TKzyComment comment = new TKzyComment();
comment.setId(id);
comment.setIsDelete(1);
commentMapper.updateByPrimaryKeySelective(comment);
return success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
/**
* 审核评论
* @param id
* @param status
* @return
*/
@ResponseBody
@RequestMapping(path = "/authComment", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map authComment(@RequestParam long id,Integer status) {
try {
TKzyComment comment = commentMapper.selectByPrimaryKey(id);
if(comment.getAuthStatus()!=1){
return error("0","评论已审核","评论已审核");
}
comment.setId(id);
comment.setAuthDt(new Date());
comment.setAuthStatus(status);
commentMapper.updateByPrimaryKeySelective(comment);
return success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
}
...@@ -219,7 +219,8 @@ public class CourseController extends BaseController { ...@@ -219,7 +219,8 @@ public class CourseController extends BaseController {
@ResponseBody @ResponseBody
@RequestMapping(path = "/saveLbCourse", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @RequestMapping(path = "/saveLbCourse", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map saveLbCourse(@RequestParam(defaultValue = "-1") long id,@RequestParam String courseName, public Map saveLbCourse(@RequestParam(defaultValue = "-1") long id,@RequestParam String courseName,
@RequestParam String picUrl,@RequestParam String courseIntroduce,@RequestParam(defaultValue = "") String liveUrl,@RequestParam(defaultValue = "") String classIds) { @RequestParam String picUrl,@RequestParam String courseIntroduce,@RequestParam(defaultValue = "") String liveUrl,@RequestParam(defaultValue = "") String classIds,
@RequestParam Integer weight) {
try { try {
String [] ids = classIds.split(","); String [] ids = classIds.split(",");
boolean flag = true; boolean flag = true;
...@@ -241,6 +242,7 @@ public class CourseController extends BaseController { ...@@ -241,6 +242,7 @@ public class CourseController extends BaseController {
if(!("").equals(liveUrl)) { if(!("").equals(liveUrl)) {
course.setLiveUrl(liveUrl); course.setLiveUrl(liveUrl);
} }
course.setWeight(weight);
course.setEditorId(user.getId()); course.setEditorId(user.getId());
course.setEditorName(user.getRealname()); course.setEditorName(user.getRealname());
if(id != -1){ //修改 if(id != -1){ //修改
......
...@@ -45,8 +45,8 @@ public class InformationController extends BaseController { ...@@ -45,8 +45,8 @@ public class InformationController extends BaseController {
* @return * @return
*/ */
@ResponseBody @ResponseBody
@RequestMapping(path = "/zbList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @RequestMapping(path = "/informationList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map zbList(@RequestParam(defaultValue = "") String title public Map informationList(@RequestParam(defaultValue = "") String title
,@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize) { ,@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize) {
try { try {
Map paramMap = new HashMap<>(); Map paramMap = new HashMap<>();
......
...@@ -223,7 +223,6 @@ ...@@ -223,7 +223,6 @@
ORDER BY c.create_dt DESC ORDER BY c.create_dt DESC
</select> </select>
<select id="queryInformationInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="queryInformationInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT SELECT
c.id, c.id,
...@@ -237,4 +236,40 @@ ...@@ -237,4 +236,40 @@
WHERE c.id = #{id,jdbcType=BIGINT} WHERE c.id = #{id,jdbcType=BIGINT}
</select> </select>
<select id="commentCourseList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT
c.id,
c.reply_content as replyContent,
c1.course_name as replyName,
u.full_name as fullName,
u.phone,
c.auth_status as authStatus,
date_format(c.auth_dt,'%Y-%m-%d %H:%i:%S') authDt,
date_format(c.create_dt,'%Y-%m-%d %H:%i:%S') createDt
FROM
t_kzy_comment c
LEFT JOIN t_kzy_course c1 ON c.relation_id =c1.id
LEFT JOIN t_kzy_user u ON c.user_id=u.id
WHERE c.is_delete=0 AND
c.type=2 AND c.relation_id = #{id,jdbcType=BIGINT}
</select>
<select id="commentInformationList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT
c.id,
c.reply_content as replyContent,
c1.title as replyName,
u.full_name as fullName,
u.phone,
c.auth_status as authStatus,
date_format(c.auth_dt,'%Y-%m-%d %H:%i:%S') authDt,
date_format(c.create_dt,'%Y-%m-%d %H:%i:%S') createDt
FROM
t_kzy_comment c
LEFT JOIN t_kzy_information c1 ON c.relation_id =c1.id
LEFT JOIN t_kzy_user u ON c.user_id=u.id
WHERE c.is_delete=0 AND
c.type=1 AND c.relation_id = #{id,jdbcType=BIGINT}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!