update 动态消息查询标识

This commit is contained in:
liao
2023-09-27 14:17:03 +08:00
parent 7f396fb2fc
commit 4ca8a2f800
4 changed files with 12 additions and 5 deletions
@@ -3,6 +3,7 @@ package com.jero.modules.laws.standard.controller;
import java.util.*; import java.util.*;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.Translation;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.util.MessageUtils; import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon; import com.jero.modules.laws.common.constant.ResultCommon;
@@ -142,8 +143,10 @@ public class LawsNewsFeedController extends JeroController<LawsNewsFeed, ILawsNe
@AutoLog(value = "动态消息-通过id查询") @AutoLog(value = "动态消息-通过id查询")
@ApiOperation(value = "动态消息-通过id查询", notes = "动态消息-通过id查询") @ApiOperation(value = "动态消息-通过id查询", notes = "动态消息-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<LawsNewsFeed> queryById(@RequestParam(name = "id") String id) { @Translation
LawsNewsFeed lawsNewsFeed = lawsNewsFeedService.queryById(id); public Result<LawsNewsFeed> queryById(@RequestParam(name = "id") String id,
@RequestParam(name = "type") String type) {
LawsNewsFeed lawsNewsFeed = lawsNewsFeedService.queryById(id, type);
return Result.OK(lawsNewsFeed); return Result.OK(lawsNewsFeed);
} }
@@ -32,5 +32,6 @@
<if test="param.dynamicHeading != null and param.dynamicHeading != ''"> <if test="param.dynamicHeading != null and param.dynamicHeading != ''">
AND lnf.dynamic_heading LIKE CONCAT('%', #{param.dynamicHeading}, '%') AND lnf.dynamic_heading LIKE CONCAT('%', #{param.dynamicHeading}, '%')
</if> </if>
ORDER BY create_time DESC
</select> </select>
</mapper> </mapper>
@@ -62,5 +62,5 @@ public interface ILawsNewsFeedService extends IService<LawsNewsFeed> {
* @param id * @param id
* @return * @return
*/ */
LawsNewsFeed queryById(String id); LawsNewsFeed queryById(String id, String type);
} }
@@ -208,13 +208,16 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
* @return * @return
*/ */
@Override @Override
public LawsNewsFeed queryById(String id) { public LawsNewsFeed queryById(String id, String type) {
LawsNewsFeed lawsNewsFeed = getById(id); LawsNewsFeed lawsNewsFeed = getById(id);
if (Objects.isNull(lawsNewsFeed)) { if (Objects.isNull(lawsNewsFeed)) {
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND); throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
} }
// 阅读次数加1 // 阅读次数加1
lawsNewsFeed.setReadCount(lawsNewsFeed.getReadCount() + 1); if ("query".equals(type)) {
lawsNewsFeed.setReadCount(lawsNewsFeed.getReadCount() + 1);
updateById(lawsNewsFeed);
}
return lawsNewsFeed; return lawsNewsFeed;
} }
} }