获取上一篇下一篇日志
This commit is contained in:
parent
9968cd58d5
commit
5a1334b165
@ -87,6 +87,15 @@ public class LogInstanceController {
|
||||
return success(logInstance);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getNextOrUp")
|
||||
@Operation(summary = "获取上一篇下一篇日志")
|
||||
public CommonResult<Long> getNextOrUp(@Parameter(description = "当前id") @RequestParam("id") Long id,
|
||||
@Parameter(description = "类型 0上一篇 1下一篇") @RequestParam("type") Integer type) {
|
||||
Long lastId = logInstanceService.getNextOrUp(id, type);
|
||||
return success(lastId);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得日志分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
|
||||
@ -159,11 +168,11 @@ public class LogInstanceController {
|
||||
@PreAuthorize("@ss.hasPermission('system:log-instance:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportLogInstanceExcel(@Valid LogInstancePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<LogInstanceRespVO> list = logInstanceService.getLogInstancePage(pageReqVO,null).getRecords();
|
||||
List<LogInstanceRespVO> list = logInstanceService.getLogInstancePage(pageReqVO, null).getRecords();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "日志实例的拓展.xls", "数据", LogInstanceRespVO.class,
|
||||
BeanUtils.toBean(list, LogInstanceRespVO.class));
|
||||
BeanUtils.toBean(list, LogInstanceRespVO.class));
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -39,12 +38,21 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
||||
.in(LogInstanceDO::getTime, dateList));
|
||||
}
|
||||
|
||||
IPage<LogInstanceRespVO> selectPageResult(@Param("page")Page<LogInstanceRespVO> page, @Param("reqVO")LogInstancePageReqVO reqVO,
|
||||
@Param("userId")Long userId, @Param("pagingType") Integer pagingType, @Param("logId")Long logId);
|
||||
IPage<LogInstanceRespVO> selectPageResult(@Param("page") Page<LogInstanceRespVO> page, @Param("reqVO") LogInstancePageReqVO reqVO,
|
||||
@Param("userId") Long userId, @Param("pagingType") Integer pagingType, @Param("logId") Long logId);
|
||||
|
||||
LogInstanceRespVO selectPageResult(@Param("reqVO")LogInstancePageReqVO reqVO, @Param("userId")Long userId,
|
||||
@Param("pagingType") Integer pagingType, @Param("logId")Long logId);
|
||||
LogInstanceRespVO selectPageResult(@Param("reqVO") LogInstancePageReqVO reqVO, @Param("userId") Long userId,
|
||||
@Param("pagingType") Integer pagingType, @Param("logId") Long logId);
|
||||
|
||||
List<LogReadUserRespDTO> selectRaedUser(Long deptId);
|
||||
|
||||
/**
|
||||
* 获取上一篇下一篇
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
Long getNextOrUp(@Param("id") Long id, @Param("userId") Long userId, @Param("type") Integer type);
|
||||
}
|
@ -84,4 +84,12 @@ public interface LogInstanceService {
|
||||
* 设置日志详情 模板内容和时间
|
||||
*/
|
||||
LogInstanceRespVO setContentFun(LogInstanceRespVO logInstanceRespVO);
|
||||
|
||||
/**
|
||||
* 获取上一篇 下一篇
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
Long getNextOrUp(Long id, Integer type);
|
||||
}
|
@ -336,6 +336,12 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
return logInstanceRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNextOrUp(Long id, Integer type) {
|
||||
//获取日志详情
|
||||
return logInstanceMapper.getNextOrUp(id, getLoginUserId(), type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<LogInstanceDO> getNeedWriteLogInstanceByTimeRange(Long fromId, List<String> time, Long userId) {
|
||||
|
@ -130,4 +130,23 @@
|
||||
GROUP BY a.id, readStatus, readCount, unReadCount, comment
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getNextOrUp" resultType="java.lang.Long">
|
||||
SELECT
|
||||
a.id
|
||||
FROM
|
||||
work_log_instance_ext AS a
|
||||
LEFT JOIN work_log_read AS e ON a.id = e.log_instance_id
|
||||
AND e.read_user_id = #{userId}
|
||||
<where>
|
||||
a.deleted = 0
|
||||
<if test="type == 0">
|
||||
and a.id < #{id}
|
||||
</if>
|
||||
<if test="type == 1">
|
||||
and a.id > #{id}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user