[新增] 报告点赞and取消点赞
This commit is contained in:
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.adc.da.report.controller;
|
||||
|
||||
import com.adc.da.report.eo.ReportLogBook;
|
||||
import com.adc.da.report.service.IReportLogService;
|
||||
import com.adc.da.report.service.IReportLogBookService;
|
||||
import com.adc.da.report.vo.DeleteParamRequestVO;
|
||||
import com.adc.da.report.vo.ReportLogPageVO;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
public class ReportLogBookController {
|
||||
|
||||
@Autowired
|
||||
private IReportLogService reportLogService;
|
||||
private IReportLogBookService reportLogBookService;
|
||||
|
||||
/**
|
||||
* @param reportLogPageVO
|
||||
@@ -39,7 +39,7 @@ public class ReportLogBookController {
|
||||
public ResponseMessage<Page<ReportLogBook>> page(@RequestBody ReportLogPageVO reportLogPageVO){
|
||||
|
||||
//分页查询
|
||||
Page<ReportLogBook> reportLogIPage = reportLogService.selectPage(reportLogPageVO);
|
||||
Page<ReportLogBook> reportLogIPage = reportLogBookService.selectPage(reportLogPageVO);
|
||||
return Result.success(reportLogIPage);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ReportLogBookController {
|
||||
public ResponseMessage<List<ReportLogBook>> list(@RequestBody ReportLogPageVO reportLogPageVO) {
|
||||
|
||||
//列表查询
|
||||
List<ReportLogBook> reportLogBookList = reportLogService.selectList(reportLogPageVO);
|
||||
List<ReportLogBook> reportLogBookList = reportLogBookService.selectList(reportLogPageVO);
|
||||
return Result.success(reportLogBookList);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ReportLogBookController {
|
||||
public ResponseMessage<ReportLogBook> info(@PathVariable("id") String id){
|
||||
|
||||
//根据id查询
|
||||
ReportLogBook reportLogBook = reportLogService.selectById(id);
|
||||
ReportLogBook reportLogBook = reportLogBookService.selectById(id);
|
||||
return Result.success(reportLogBook);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ReportLogBookController {
|
||||
public ResponseMessage<String> saveOrUpdate(@RequestBody ReportLogBook reportLogBook){
|
||||
|
||||
//单条数据新增/更改
|
||||
reportLogService.saveOrUpdateSingle(reportLogBook);
|
||||
reportLogBookService.saveOrUpdateSingle(reportLogBook);
|
||||
return Result.success(reportLogBook.getId());
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ReportLogBookController {
|
||||
public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){
|
||||
|
||||
//单条/批量删除数据
|
||||
reportLogService.deleteById(deleteParamRequestVO);
|
||||
reportLogBookService.deleteById(deleteParamRequestVO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
+39
-4
@@ -3,7 +3,7 @@ package com.adc.da.report.controller;
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.report.annotation.ReportLog;
|
||||
import com.adc.da.report.dao.mysql.ReportDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLogDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLogBookDao;
|
||||
import com.adc.da.report.eo.FileEntity;
|
||||
import com.adc.da.report.eo.ReportEntity;
|
||||
import com.adc.da.report.eo.ReportLogBook;
|
||||
@@ -16,6 +16,7 @@ import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -78,7 +79,7 @@ public class ReportManageConroller {
|
||||
private ReportDao reportDao;
|
||||
|
||||
@Autowired
|
||||
private ReportLogDao reportLogDao;
|
||||
private ReportLogBookDao reportLogBookDao;
|
||||
/**
|
||||
* 新增或编辑报告
|
||||
* @param vo
|
||||
@@ -176,10 +177,42 @@ public class ReportManageConroller {
|
||||
reportLog.setType(1);
|
||||
reportLog.setUpdateTime(new Date());
|
||||
reportLog.setUserId(UserUtils.getUserId());
|
||||
reportLogDao.insert(reportLog);
|
||||
reportLogBookDao.insert(reportLog);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("点赞")
|
||||
@GetMapping("/praise/{reportId}")
|
||||
public ResponseMessage praise(@PathVariable("reportId") String reportId) {
|
||||
ReportLogBook reportLog = new ReportLogBook();
|
||||
reportLog.setReportId(reportId);
|
||||
reportLog.setType(3);
|
||||
reportLog.setUpdateTime(new Date());
|
||||
reportLog.setUserId(UserUtils.getUserId());
|
||||
reportLogBookDao.insert(reportLog);
|
||||
return Result.success(reportLog.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消点赞
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("取消点赞")
|
||||
@GetMapping("/delPraise/{reportId}")
|
||||
public ResponseMessage delPraise(@PathVariable("reportId") String reportId) {
|
||||
LambdaQueryWrapper<ReportLogBook> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ReportLogBook::getReportId,reportId);
|
||||
wrapper.eq(ReportLogBook::getUserId,UserUtils.getUserId());
|
||||
wrapper.eq(ReportLogBook::getType,3);
|
||||
reportLogBookDao.delete(wrapper);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
@@ -368,10 +401,12 @@ public class ReportManageConroller {
|
||||
reportLog.setType(2);
|
||||
reportLog.setUpdateTime(new Date());
|
||||
reportLog.setUserId(UserUtils.getUserId());
|
||||
reportLogDao.insert(reportLog);
|
||||
reportLogBookDao.insert(reportLog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 权限审批流程 添加报告按钮 可添加的报告
|
||||
* @return
|
||||
|
||||
+1
-2
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
* @description 报告日志 Mapper接口
|
||||
* @date 2023-05-06
|
||||
*/
|
||||
public interface ReportLogDao extends BaseMapper<ReportLogBook> {
|
||||
public interface ReportLogBookDao extends BaseMapper<ReportLogBook> {
|
||||
|
||||
/**
|
||||
* @param reportLogPageVO
|
||||
@@ -28,7 +28,6 @@ public interface ReportLogDao extends BaseMapper<ReportLogBook> {
|
||||
|
||||
/**
|
||||
* @param reportLogPageVO
|
||||
* @param page
|
||||
* @author bu
|
||||
* @date 2023-05-06
|
||||
* @description 使用分页插件进行查询总数
|
||||
@@ -15,7 +15,7 @@ import java.util.Date;
|
||||
* @date 2023-05-06
|
||||
*/
|
||||
@Data
|
||||
@TableName("report_log")
|
||||
@TableName("report_log_book")
|
||||
public class ReportLogBook {
|
||||
|
||||
@TableId("id")
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* @description 报告日志
|
||||
* @date 2023-05-06
|
||||
*/
|
||||
public interface IReportLogService {
|
||||
public interface IReportLogBookService {
|
||||
|
||||
Page<ReportLogBook> selectPage(ReportLogPageVO reportLogPageVO);
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.adc.da.report.service.impl;
|
||||
|
||||
|
||||
import com.adc.da.report.dao.mysql.ReportLogDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLogBookDao;
|
||||
import com.adc.da.report.eo.ReportLogBook;
|
||||
import com.adc.da.report.service.IReportLogService;
|
||||
import com.adc.da.report.service.IReportLogBookService;
|
||||
import com.adc.da.report.vo.DeleteParamRequestVO;
|
||||
import com.adc.da.report.vo.ReportLogPageVO;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class IReportLogServiceImpl extends ServiceImpl<ReportLogDao, ReportLogBook> implements IReportLogService {
|
||||
public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, ReportLogBook> implements IReportLogBookService {
|
||||
|
||||
/**
|
||||
* @param reportLogPageVO
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<?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.adc.da.report.dao.mysql.ReportLogDao">
|
||||
<mapper namespace="com.adc.da.report.dao.mysql.ReportLogBookDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.ReportLogBook">
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<!--表名信息-->
|
||||
<sql id="TableName">
|
||||
report_log
|
||||
report_log_book
|
||||
</sql>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
Reference in New Issue
Block a user