点赞,转发,阅读数量统计,外加接口开发
This commit is contained in:
parent
9b4c488702
commit
55f335d630
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.playlet.web.controller.app;
|
||||||
|
|
||||||
|
import com.playlet.common.core.domain.Result;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.playlet.web.service.app.PublicStarRecordAppService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "公众号*用户点赞记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/app/public/star")
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class PublicStarRecordAppController {
|
||||||
|
|
||||||
|
private final PublicStarRecordAppService publicStarRecordAppService;
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation(value = "新增用户点赞记录")
|
||||||
|
public Result<String> addRecord(@RequestBody PublicStarRecord publicStarRecord) {
|
||||||
|
publicStarRecordAppService.addRecord(publicStarRecord);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/query")
|
||||||
|
@ApiOperation(value = "查询用户点赞记录")
|
||||||
|
public Result<PublicStarRecord> queryRecord(@RequestBody PublicStarRecord publicStarRecord) {
|
||||||
|
return Result.success(publicStarRecordAppService.queryRecord(publicStarRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation(value = "删除用户点赞记录")
|
||||||
|
public Result<String> deleteRecord(@RequestBody PublicStarRecord publicStarRecord) {
|
||||||
|
publicStarRecordAppService.deleteRecord(publicStarRecord);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.playlet.common.utils.StringUtils;
|
||||||
import com.playlet.system.domain.PlayletPublicAccount;
|
import com.playlet.system.domain.PlayletPublicAccount;
|
||||||
import com.playlet.system.service.IPlayletItemService;
|
import com.playlet.system.service.IPlayletItemService;
|
||||||
import com.playlet.system.service.IPlayletPublicAccountService;
|
import com.playlet.system.service.IPlayletPublicAccountService;
|
||||||
|
import com.playlet.system.service.IPublicDetailShareService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -41,6 +42,9 @@ public class PlayletPublicDetailController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPlayletItemService playletItemService;
|
private IPlayletItemService playletItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPublicDetailShareService publicDetailShareService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/wxQrcode/{id}")
|
@GetMapping("/wxQrcode/{id}")
|
||||||
public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) {
|
public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.playlet.system.domain.PlayletPublicDetail;
|
||||||
import com.playlet.system.domain.PublicCommentResponse;
|
import com.playlet.system.domain.PublicCommentResponse;
|
||||||
import com.playlet.system.service.IPlayletPublicDetailService;
|
import com.playlet.system.service.IPlayletPublicDetailService;
|
||||||
import com.playlet.system.service.IPublicCommentResponseService;
|
import com.playlet.system.service.IPublicCommentResponseService;
|
||||||
|
import com.playlet.system.service.IPublicDetailShareService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -66,6 +67,11 @@ public class PublicDetailCommentController extends BaseController
|
||||||
model.setDetailName(playletPublicDetail.getTitle());
|
model.setDetailName(playletPublicDetail.getTitle());
|
||||||
model.setAuthorAlias(playletPublicDetail.getAuthorAlias());
|
model.setAuthorAlias(playletPublicDetail.getAuthorAlias());
|
||||||
}
|
}
|
||||||
|
PublicCommentResponse publicCommentResponse = publicCommentResponseService.lambdaQuery()
|
||||||
|
.eq(PublicCommentResponse::getCommentId, model.getId()).one();
|
||||||
|
if(publicCommentResponse != null){
|
||||||
|
model.setCommentResponseContent(publicCommentResponse.getResponseContent());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.playlet.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.playlet.common.annotation.Log;
|
||||||
|
import com.playlet.common.enums.BusinessType;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.playlet.system.service.IPublicStarRecordService;
|
||||||
|
import com.playlet.common.core.controller.BaseController;
|
||||||
|
import com.playlet.common.core.domain.AjaxResult;
|
||||||
|
import com.playlet.common.utils.poi.ExcelUtil;
|
||||||
|
import com.playlet.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章点赞记录Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/public/star")
|
||||||
|
public class PublicStarRecordController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/public/star";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPublicStarRecordService publicStarRecordService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:star:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String record()
|
||||||
|
{
|
||||||
|
return prefix + "/star";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<PublicStarRecord> list = publicStarRecordService.selectPublicStarRecordList(publicStarRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出文章点赞记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:export")
|
||||||
|
@Log(title = "文章点赞记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
List<PublicStarRecord> list = publicStarRecordService.selectPublicStarRecordList(publicStarRecord);
|
||||||
|
ExcelUtil<PublicStarRecord> util = new ExcelUtil<PublicStarRecord>(PublicStarRecord.class);
|
||||||
|
return util.exportExcel(list, "文章点赞记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增文章点赞记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存文章点赞记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:add")
|
||||||
|
@Log(title = "文章点赞记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
return toAjax(publicStarRecordService.insertPublicStarRecord(publicStarRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改文章点赞记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:edit")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
PublicStarRecord publicStarRecord = publicStarRecordService.selectPublicStarRecordById(id);
|
||||||
|
mmap.put("publicStarRecord", publicStarRecord);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存文章点赞记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:edit")
|
||||||
|
@Log(title = "文章点赞记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
return toAjax(publicStarRecordService.updatePublicStarRecord(publicStarRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章点赞记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("public:star:remove")
|
||||||
|
@Log(title = "文章点赞记录", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(publicStarRecordService.deletePublicStarRecordByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.playlet.web.service.app;
|
||||||
|
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
|
||||||
|
public interface PublicStarRecordAppService {
|
||||||
|
void addRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
PublicStarRecord queryRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
void deleteRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -39,7 +39,16 @@ public class PublicDetailShareAppServiceImpl implements PublicDetailShareAppServ
|
||||||
// 添加浏览记录时,同时需要增加一下文章表上面的阅读次数
|
// 添加浏览记录时,同时需要增加一下文章表上面的阅读次数
|
||||||
PlayletPublicDetail playletPublicDetail = iPlayletPublicDetailService.getById(publicDetailShare.getDetailId());
|
PlayletPublicDetail playletPublicDetail = iPlayletPublicDetailService.getById(publicDetailShare.getDetailId());
|
||||||
if(playletPublicDetail != null){
|
if(playletPublicDetail != null){
|
||||||
playletPublicDetail.setReadCount(playletPublicDetail.getReadCount() + 1);
|
if(playletPublicDetail.getTransmitCount() == null){
|
||||||
|
playletPublicDetail.setTransmitCount(1L);
|
||||||
|
}else {
|
||||||
|
playletPublicDetail.setTransmitCount(playletPublicDetail.getTransmitCount() + 1);
|
||||||
|
}
|
||||||
|
if(playletPublicDetail.getReadCount() == null){
|
||||||
|
playletPublicDetail.setReadCount(1L);
|
||||||
|
}else {
|
||||||
|
playletPublicDetail.setReadCount(playletPublicDetail.getReadCount() + 1);
|
||||||
|
}
|
||||||
iPlayletPublicDetailService.updateById(playletPublicDetail);
|
iPlayletPublicDetailService.updateById(playletPublicDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.playlet.web.service.app.impl;
|
||||||
|
|
||||||
|
import com.playlet.system.domain.PlayletPublicDetail;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.playlet.system.service.IPlayletPublicDetailService;
|
||||||
|
import com.playlet.system.service.IPublicStarRecordService;
|
||||||
|
import com.playlet.web.service.app.PublicStarRecordAppService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class PublicStarRecordAppServiceImpl implements PublicStarRecordAppService {
|
||||||
|
|
||||||
|
private final IPublicStarRecordService iPublicStarRecordService;
|
||||||
|
|
||||||
|
private final IPlayletPublicDetailService iPlayletPublicDetailService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecord(PublicStarRecord publicStarRecord) {
|
||||||
|
publicStarRecord.setCreateTime(new Date());
|
||||||
|
iPublicStarRecordService.insertPublicStarRecord(publicStarRecord);
|
||||||
|
// 增加文章点赞数量
|
||||||
|
PlayletPublicDetail detail = iPlayletPublicDetailService.getById(publicStarRecord.getDetailId());
|
||||||
|
if(detail != null){
|
||||||
|
if(detail.getStarCount() == null){
|
||||||
|
detail.setStarCount("1");
|
||||||
|
}else {
|
||||||
|
detail.setStarCount(String.valueOf(Long.parseLong(detail.getStarCount()) + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iPlayletPublicDetailService.updateById(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PublicStarRecord queryRecord(PublicStarRecord publicStarRecord) {
|
||||||
|
return iPublicStarRecordService
|
||||||
|
.lambdaQuery()
|
||||||
|
.eq(PublicStarRecord::getDetailId, publicStarRecord.getDetailId())
|
||||||
|
.eq(PublicStarRecord::getUserId, publicStarRecord.getUserId())
|
||||||
|
.one();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteRecord(PublicStarRecord publicStarRecord) {
|
||||||
|
PublicStarRecord record = iPublicStarRecordService
|
||||||
|
.lambdaQuery()
|
||||||
|
.eq(PublicStarRecord::getDetailId, publicStarRecord.getDetailId())
|
||||||
|
.eq(PublicStarRecord::getUserId, publicStarRecord.getUserId())
|
||||||
|
.one();
|
||||||
|
if(record != null){
|
||||||
|
iPublicStarRecordService.removeById(record.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -69,6 +69,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">所在地:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="address" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">简介:</label>
|
<label class="col-sm-3 control-label">简介:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">所在地:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="address" th:field="*{address}" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">简介:</label>
|
<label class="col-sm-3 control-label">简介:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'authorAlias',
|
field: 'authorAlias',
|
||||||
title: '作者花名'
|
title: '作者花名',
|
||||||
|
visible: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userId',
|
field: 'userId',
|
||||||
|
|
@ -91,9 +92,12 @@
|
||||||
title: '评论内容'
|
title: '评论内容'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'starCount',
|
field: 'createTime',
|
||||||
title: '点赞数',
|
title: '评论时间'
|
||||||
visible: false
|
},
|
||||||
|
{
|
||||||
|
field: 'commentResponseContent',
|
||||||
|
title: "回复内容"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,12 @@ public class PlayletPublicDetail extends BaseEntity
|
||||||
@ApiModelProperty(value = "阅读人数")
|
@ApiModelProperty(value = "阅读人数")
|
||||||
private Long readCount;
|
private Long readCount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "转发人数")
|
||||||
|
private Long transmitCount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "点赞数")
|
||||||
|
private String starCount;
|
||||||
|
|
||||||
/** 详情(富文本) */
|
/** 详情(富文本) */
|
||||||
@Excel(name = "详情(富文本)")
|
@Excel(name = "详情(富文本)")
|
||||||
@ApiModelProperty(value = "详情(富文本)")
|
@ApiModelProperty(value = "详情(富文本)")
|
||||||
|
|
@ -56,6 +62,9 @@ public class PlayletPublicDetail extends BaseEntity
|
||||||
@ApiModelProperty(value = "标题")
|
@ApiModelProperty(value = "标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在地")
|
||||||
|
private String address;
|
||||||
|
|
||||||
@ApiModelProperty(value = "作者花名")
|
@ApiModelProperty(value = "作者花名")
|
||||||
private String authorAlias;
|
private String authorAlias;
|
||||||
|
|
||||||
|
|
@ -68,9 +77,6 @@ public class PlayletPublicDetail extends BaseEntity
|
||||||
@ApiModelProperty(value = "文章标签")
|
@ApiModelProperty(value = "文章标签")
|
||||||
private String detailTag;
|
private String detailTag;
|
||||||
|
|
||||||
@ApiModelProperty(value = "点赞数")
|
|
||||||
private String starCount;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "剧集1")
|
@ApiModelProperty(value = "剧集1")
|
||||||
private Integer itemOne;
|
private Integer itemOne;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,7 @@ public class PublicDetailComment extends BaseEntity
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private PublicCommentResponse commentResponse;
|
private PublicCommentResponse commentResponse;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String commentResponseContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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_star_record
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName(value = "public_star_record")
|
||||||
|
public class PublicStarRecord extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 文章id */
|
||||||
|
@Excel(name = "文章id")
|
||||||
|
private Long detailId;
|
||||||
|
|
||||||
|
/** 用户id */
|
||||||
|
@Excel(name = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.playlet.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章点赞记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-24
|
||||||
|
*/
|
||||||
|
public interface PublicStarRecordMapper extends BaseMapper<PublicStarRecord>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 文章点赞记录
|
||||||
|
*/
|
||||||
|
public PublicStarRecord selectPublicStarRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录列表
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 文章点赞记录集合
|
||||||
|
*/
|
||||||
|
public List<PublicStarRecord> selectPublicStarRecordList(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertPublicStarRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updatePublicStarRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章点赞记录
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicStarRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文章点赞记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicStarRecordByIds(String[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.playlet.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章点赞记录Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-24
|
||||||
|
*/
|
||||||
|
public interface IPublicStarRecordService extends IService<PublicStarRecord>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 文章点赞记录
|
||||||
|
*/
|
||||||
|
public PublicStarRecord selectPublicStarRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录列表
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 文章点赞记录集合
|
||||||
|
*/
|
||||||
|
public List<PublicStarRecord> selectPublicStarRecordList(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertPublicStarRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updatePublicStarRecord(PublicStarRecord publicStarRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文章点赞记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的文章点赞记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicStarRecordByIds(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章点赞记录信息
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deletePublicStarRecordById(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.PublicStarRecordMapper;
|
||||||
|
import com.playlet.system.domain.PublicStarRecord;
|
||||||
|
import com.playlet.system.service.IPublicStarRecordService;
|
||||||
|
import com.playlet.common.core.text.Convert;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章点赞记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-06-24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PublicStarRecordServiceImpl extends ServiceImpl<PublicStarRecordMapper, PublicStarRecord> implements IPublicStarRecordService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private PublicStarRecordMapper publicStarRecordMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 文章点赞记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PublicStarRecord selectPublicStarRecordById(Long id)
|
||||||
|
{
|
||||||
|
return publicStarRecordMapper.selectPublicStarRecordById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文章点赞记录列表
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 文章点赞记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PublicStarRecord> selectPublicStarRecordList(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
return publicStarRecordMapper.selectPublicStarRecordList(publicStarRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertPublicStarRecord(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
publicStarRecord.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return publicStarRecordMapper.insertPublicStarRecord(publicStarRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改文章点赞记录
|
||||||
|
*
|
||||||
|
* @param publicStarRecord 文章点赞记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updatePublicStarRecord(PublicStarRecord publicStarRecord)
|
||||||
|
{
|
||||||
|
publicStarRecord.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return publicStarRecordMapper.updatePublicStarRecord(publicStarRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文章点赞记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的文章点赞记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePublicStarRecordByIds(String ids)
|
||||||
|
{
|
||||||
|
return publicStarRecordMapper.deletePublicStarRecordByIds(Convert.toStrArray(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章点赞记录信息
|
||||||
|
*
|
||||||
|
* @param id 文章点赞记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePublicStarRecordById(Long id)
|
||||||
|
{
|
||||||
|
return publicStarRecordMapper.deletePublicStarRecordById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
<result property="itemId" column="item_id" />
|
<result property="itemId" column="item_id" />
|
||||||
<result property="detailTag" column="detail_tag" />
|
<result property="detailTag" column="detail_tag" />
|
||||||
<result property="readCount" column="read_count" />
|
<result property="readCount" column="read_count" />
|
||||||
|
<result property="transmitCount" column="transmit_count" />
|
||||||
<result property="content" column="content" />
|
<result property="content" column="content" />
|
||||||
|
<result property="address" column="address" />
|
||||||
<result property="starCount" column="star_count" />
|
<result property="starCount" column="star_count" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="itemOne" column="item_one" />
|
<result property="itemOne" column="item_one" />
|
||||||
|
|
@ -38,7 +40,7 @@
|
||||||
item_one,item_two,item_three,item_four,item_five,
|
item_one,item_two,item_three,item_four,item_five,
|
||||||
item_six,item_seven,item_eight,item_nine,item_ten,
|
item_six,item_seven,item_eight,item_nine,item_ten,
|
||||||
title,type,author_alias,img_url, content, create_by, create_time,
|
title,type,author_alias,img_url, content, create_by, create_time,
|
||||||
update_by, update_time, detail_tag, remark from playlet_public_detail
|
update_by, update_time, detail_tag, remark, address, transmit_count from playlet_public_detail
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPlayletPublicDetailList" parameterType="PlayletPublicDetail" resultMap="PlayletPublicDetailResult">
|
<select id="selectPlayletPublicDetailList" parameterType="PlayletPublicDetail" resultMap="PlayletPublicDetailResult">
|
||||||
|
|
@ -63,7 +65,9 @@
|
||||||
<if test="publicId != null">public_id,</if>
|
<if test="publicId != null">public_id,</if>
|
||||||
<if test="itemId != null">item_id,</if>
|
<if test="itemId != null">item_id,</if>
|
||||||
<if test="readCount != null">read_count,</if>
|
<if test="readCount != null">read_count,</if>
|
||||||
|
<if test="transmitCount != null">transmit_count,</if>
|
||||||
<if test="content != null">content,</if>
|
<if test="content != null">content,</if>
|
||||||
|
<if test="address != null">address,</if>
|
||||||
<if test="title != null">title,</if>
|
<if test="title != null">title,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="type != null">type,</if>
|
||||||
<if test="authorAlias != null">author_alias,</if>
|
<if test="authorAlias != null">author_alias,</if>
|
||||||
|
|
@ -90,7 +94,9 @@
|
||||||
<if test="publicId != null">#{publicId},</if>
|
<if test="publicId != null">#{publicId},</if>
|
||||||
<if test="itemId != null">#{itemId},</if>
|
<if test="itemId != null">#{itemId},</if>
|
||||||
<if test="readCount != null">#{readCount},</if>
|
<if test="readCount != null">#{readCount},</if>
|
||||||
|
<if test="transmitCount != null">#{transmitCount},</if>
|
||||||
<if test="content != null">#{content},</if>
|
<if test="content != null">#{content},</if>
|
||||||
|
<if test="address != null">#{address},</if>
|
||||||
<if test="title != null">#{title},</if>
|
<if test="title != null">#{title},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="type != null">#{type},</if>
|
||||||
<if test="authorAlias != null">#{authorAlias},</if>
|
<if test="authorAlias != null">#{authorAlias},</if>
|
||||||
|
|
@ -121,7 +127,9 @@
|
||||||
<if test="publicId != null">public_id = #{publicId},</if>
|
<if test="publicId != null">public_id = #{publicId},</if>
|
||||||
<if test="itemId != null">#{itemId},</if>
|
<if test="itemId != null">#{itemId},</if>
|
||||||
<if test="readCount != null">read_count = #{readCount},</if>
|
<if test="readCount != null">read_count = #{readCount},</if>
|
||||||
|
<if test="transmitCount != null">transmit_count = #{transmitCount},</if>
|
||||||
<if test="content != null">content = #{content},</if>
|
<if test="content != null">content = #{content},</if>
|
||||||
|
<if test="address != null">address = #{address},</if>
|
||||||
<if test="title != null">title = #{title},</if>
|
<if test="title != null">title = #{title},</if>
|
||||||
<if test="type != null">type = #{type},</if>
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="authorAlias != null">author_alias = #{authorAlias},</if>
|
<if test="authorAlias != null">author_alias = #{authorAlias},</if>
|
||||||
|
|
|
||||||
|
|
@ -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.PublicStarRecordMapper">
|
||||||
|
|
||||||
|
<resultMap type="PublicStarRecord" id="PublicStarRecordResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="detailId" column="detail_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectPublicStarRecordVo">
|
||||||
|
select id, detail_id, user_id, create_time, create_by, update_time, update_by, remark from public_star_record
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectPublicStarRecordList" parameterType="PublicStarRecord" resultMap="PublicStarRecordResult">
|
||||||
|
<include refid="selectPublicStarRecordVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="detailId != null "> and detail_id = #{detailId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPublicStarRecordById" parameterType="Long" resultMap="PublicStarRecordResult">
|
||||||
|
<include refid="selectPublicStarRecordVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertPublicStarRecord" parameterType="PublicStarRecord" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into public_star_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="detailId != null">detail_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="detailId != null">#{detailId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updatePublicStarRecord" parameterType="PublicStarRecord">
|
||||||
|
update public_star_record
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="detailId != null">detail_id = #{detailId},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deletePublicStarRecordById" parameterType="Long">
|
||||||
|
delete from public_star_record where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deletePublicStarRecordByIds" parameterType="String">
|
||||||
|
delete from public_star_record where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue