点赞、取消点赞、点赞排序、删除评论、后台不限时remark
This commit is contained in:
parent
7258bbafa4
commit
baeeb84cee
|
|
@ -2,6 +2,7 @@ package com.playlet.web.controller.app;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.playlet.common.core.domain.Result;
|
import com.playlet.common.core.domain.Result;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
import com.playlet.system.domain.PublicDetailComment;
|
import com.playlet.system.domain.PublicDetailComment;
|
||||||
import com.playlet.web.service.app.PublicDetailCommentAppService;
|
import com.playlet.web.service.app.PublicDetailCommentAppService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -31,6 +32,14 @@ public class PublicDetailCommentAppController {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation(value = "删除用户评论")
|
||||||
|
public Result<String> delete(@RequestBody PublicDetailComment detailComment) {
|
||||||
|
detailCommentAppService.delete(detailComment);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation(value = "更新用户评论(后续点赞使用)")
|
@ApiOperation(value = "更新用户评论(后续点赞使用)")
|
||||||
|
|
@ -49,4 +58,20 @@ public class PublicDetailCommentAppController {
|
||||||
return Result.success(detailCommentAppService.query(detailComment, pageNum, pageSize));
|
return Result.success(detailCommentAppService.query(detailComment, pageNum, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/start")
|
||||||
|
@ApiOperation(value = "点赞用户评论")
|
||||||
|
public Result<String> start(@RequestBody PublicCommentStar publicCommentStar) {
|
||||||
|
detailCommentAppService.star(publicCommentStar);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/cancelStar")
|
||||||
|
@ApiOperation(value = "取消点赞用户评论")
|
||||||
|
public Result<String> cancelStar(@RequestBody PublicCommentStar publicCommentStar) {
|
||||||
|
detailCommentAppService.cancelStar(publicCommentStar);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.playlet.web.service.app;
|
package com.playlet.web.service.app;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
import com.playlet.system.domain.PublicDetailComment;
|
import com.playlet.system.domain.PublicDetailComment;
|
||||||
|
|
||||||
public interface PublicDetailCommentAppService {
|
public interface PublicDetailCommentAppService {
|
||||||
|
|
@ -12,4 +13,10 @@ public interface PublicDetailCommentAppService {
|
||||||
|
|
||||||
PageInfo<PublicDetailComment> query(PublicDetailComment detailComment, Integer pageNum, Integer pageSize);
|
PageInfo<PublicDetailComment> query(PublicDetailComment detailComment, Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
void star(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
void cancelStar(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
void delete(PublicDetailComment detailComment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@ package com.playlet.web.service.app.impl;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.playlet.system.domain.PublicCommentResponse;
|
import com.playlet.system.domain.PublicCommentResponse;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
import com.playlet.system.domain.PublicDetailComment;
|
import com.playlet.system.domain.PublicDetailComment;
|
||||||
import com.playlet.system.service.IPublicCommentResponseService;
|
import com.playlet.system.service.IPublicCommentResponseService;
|
||||||
|
import com.playlet.system.service.IPublicCommentStarService;
|
||||||
import com.playlet.system.service.IPublicDetailCommentService;
|
import com.playlet.system.service.IPublicDetailCommentService;
|
||||||
import com.playlet.web.service.app.PublicDetailCommentAppService;
|
import com.playlet.web.service.app.PublicDetailCommentAppService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -12,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -23,6 +26,8 @@ public class PublicDetailCommentAppServiceImpl implements PublicDetailCommentApp
|
||||||
|
|
||||||
private final IPublicCommentResponseService iPublicCommentResponseService;
|
private final IPublicCommentResponseService iPublicCommentResponseService;
|
||||||
|
|
||||||
|
private final IPublicCommentStarService iPublicCommentStarService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(PublicDetailComment detailComment) {
|
public void add(PublicDetailComment detailComment) {
|
||||||
iPublicDetailCommentService.save(detailComment);
|
iPublicDetailCommentService.save(detailComment);
|
||||||
|
|
@ -36,11 +41,54 @@ public class PublicDetailCommentAppServiceImpl implements PublicDetailCommentApp
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<PublicDetailComment> query(PublicDetailComment detailComment, Integer pageNum, Integer pageSize) {
|
public PageInfo<PublicDetailComment> query(PublicDetailComment detailComment, Integer pageNum, Integer pageSize) {
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
List<PublicDetailComment> comments = iPublicDetailCommentService.selectPublicDetailCommentList(detailComment);
|
List<PublicDetailComment> comments = iPublicDetailCommentService.lambdaQuery()
|
||||||
|
.eq(PublicDetailComment::getDetailId, detailComment.getDetailId())
|
||||||
|
.orderByDesc(PublicDetailComment::getStarCount)
|
||||||
|
.orderByDesc(PublicDetailComment::getCreateTime)
|
||||||
|
.list();
|
||||||
comments.forEach(model->{
|
comments.forEach(model->{
|
||||||
model.setCommentResponse(iPublicCommentResponseService.lambdaQuery().eq(PublicCommentResponse::getCommentId, model.getId()).one());
|
model.setCommentResponse(iPublicCommentResponseService.lambdaQuery().eq(PublicCommentResponse::getCommentId, model.getId()).one());
|
||||||
|
if(model.getUserId() != null){
|
||||||
|
long star = iPublicCommentStarService.lambdaQuery()
|
||||||
|
.eq(PublicCommentStar::getCommentId, model.getId())
|
||||||
|
.eq(PublicCommentStar::getUserId, detailComment.getUserId())
|
||||||
|
.count();
|
||||||
|
if(star > 0){
|
||||||
|
model.setIsStar("02");
|
||||||
|
}else {
|
||||||
|
model.setIsStar("01");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return PageInfo.of(comments);
|
return PageInfo.of(comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void star(PublicCommentStar publicCommentStar) {
|
||||||
|
publicCommentStar.setCreateTime(new Date());
|
||||||
|
iPublicCommentStarService.insertPublicCommentStar(publicCommentStar);
|
||||||
|
// 增加点赞数
|
||||||
|
PublicDetailComment comment = iPublicDetailCommentService.getById(publicCommentStar.getCommentId());
|
||||||
|
if(comment.getStarCount() == null){
|
||||||
|
comment.setStarCount(1L);
|
||||||
|
}else {
|
||||||
|
comment.setStarCount(comment.getStarCount() + 1);
|
||||||
|
}
|
||||||
|
iPublicDetailCommentService.updateById(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelStar(PublicCommentStar publicCommentStar) {
|
||||||
|
iPublicCommentStarService.removeById(publicCommentStar.getId());
|
||||||
|
// 增加点赞数
|
||||||
|
PublicDetailComment comment = iPublicDetailCommentService.getById(publicCommentStar.getCommentId());
|
||||||
|
comment.setStarCount(comment.getStarCount() - 1);
|
||||||
|
iPublicDetailCommentService.updateById(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(PublicDetailComment detailComment) {
|
||||||
|
iPublicDetailCommentService.removeById(detailComment.getId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
title: '备注'
|
title: '备注',
|
||||||
|
visible: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.playlet.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.playlet.common.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import com.playlet.common.annotation.Excel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户评论点赞对象 public_comment_star
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName(value = "public_comment_star")
|
||||||
|
public class PublicCommentStar extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 评论id */
|
||||||
|
@Excel(name = "评论id")
|
||||||
|
private Long commentId;
|
||||||
|
|
||||||
|
/** 用户id */
|
||||||
|
@Excel(name = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -74,4 +74,8 @@ public class PublicDetailComment extends BaseEntity
|
||||||
@ApiModelProperty(value = "是否回复 01.未回复 02.已回复")
|
@ApiModelProperty(value = "是否回复 01.未回复 02.已回复")
|
||||||
private String isResponse;
|
private String isResponse;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "是否点赞 01.未点赞 02.已点赞")
|
||||||
|
private String isStar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.playlet.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户评论点赞Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
public interface PublicCommentStarMapper extends BaseMapper<PublicCommentStar>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 用户评论点赞
|
||||||
|
*/
|
||||||
|
public PublicCommentStar selectPublicCommentStarById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞列表
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 用户评论点赞集合
|
||||||
|
*/
|
||||||
|
public List<PublicCommentStar> selectPublicCommentStarList(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertPublicCommentStar(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updatePublicCommentStar(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户评论点赞
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicCommentStarById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户评论点赞
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicCommentStarByIds(String[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.playlet.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户评论点赞Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
public interface IPublicCommentStarService extends IService<PublicCommentStar>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 用户评论点赞
|
||||||
|
*/
|
||||||
|
public PublicCommentStar selectPublicCommentStarById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞列表
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 用户评论点赞集合
|
||||||
|
*/
|
||||||
|
public List<PublicCommentStar> selectPublicCommentStarList(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertPublicCommentStar(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updatePublicCommentStar(PublicCommentStar publicCommentStar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户评论点赞
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户评论点赞主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicCommentStarByIds(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户评论点赞信息
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicCommentStarById(Long id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.playlet.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.playlet.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.playlet.system.mapper.PublicCommentStarMapper;
|
||||||
|
import com.playlet.system.domain.PublicCommentStar;
|
||||||
|
import com.playlet.system.service.IPublicCommentStarService;
|
||||||
|
import com.playlet.common.core.text.Convert;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户评论点赞Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PublicCommentStarServiceImpl extends ServiceImpl<PublicCommentStarMapper, PublicCommentStar> implements IPublicCommentStarService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private PublicCommentStarMapper publicCommentStarMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 用户评论点赞
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PublicCommentStar selectPublicCommentStarById(Long id)
|
||||||
|
{
|
||||||
|
return publicCommentStarMapper.selectPublicCommentStarById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户评论点赞列表
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 用户评论点赞
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PublicCommentStar> selectPublicCommentStarList(PublicCommentStar publicCommentStar)
|
||||||
|
{
|
||||||
|
return publicCommentStarMapper.selectPublicCommentStarList(publicCommentStar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertPublicCommentStar(PublicCommentStar publicCommentStar)
|
||||||
|
{
|
||||||
|
publicCommentStar.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return publicCommentStarMapper.insertPublicCommentStar(publicCommentStar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户评论点赞
|
||||||
|
*
|
||||||
|
* @param publicCommentStar 用户评论点赞
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updatePublicCommentStar(PublicCommentStar publicCommentStar)
|
||||||
|
{
|
||||||
|
publicCommentStar.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return publicCommentStarMapper.updatePublicCommentStar(publicCommentStar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户评论点赞
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户评论点赞主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePublicCommentStarByIds(String ids)
|
||||||
|
{
|
||||||
|
return publicCommentStarMapper.deletePublicCommentStarByIds(Convert.toStrArray(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户评论点赞信息
|
||||||
|
*
|
||||||
|
* @param id 用户评论点赞主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePublicCommentStarById(Long id)
|
||||||
|
{
|
||||||
|
return publicCommentStarMapper.deletePublicCommentStarById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?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="com.playlet.system.mapper.PublicCommentStarMapper">
|
||||||
|
|
||||||
|
<resultMap type="PublicCommentStar" id="PublicCommentStarResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="commentId" column="comment_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectPublicCommentStarVo">
|
||||||
|
select id, comment_id, user_id, create_by, create_time, update_by, update_time, remark from public_comment_star
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectPublicCommentStarList" parameterType="PublicCommentStar" resultMap="PublicCommentStarResult">
|
||||||
|
<include refid="selectPublicCommentStarVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="commentId != null "> and comment_id = #{commentId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPublicCommentStarById" parameterType="Long" resultMap="PublicCommentStarResult">
|
||||||
|
<include refid="selectPublicCommentStarVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertPublicCommentStar" parameterType="PublicCommentStar" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into public_comment_star
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="commentId != null">comment_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="commentId != null">#{commentId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updatePublicCommentStar" parameterType="PublicCommentStar">
|
||||||
|
update public_comment_star
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="commentId != null">comment_id = #{commentId},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deletePublicCommentStarById" parameterType="Long">
|
||||||
|
delete from public_comment_star where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deletePublicCommentStarByIds" parameterType="String">
|
||||||
|
delete from public_comment_star where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue