[新增] 报告点赞and取消点赞

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