diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java index bfc30dc..27f15b1 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.lyms.talkonlineweb.domain.*; import com.lyms.talkonlineweb.result.BaseResponse; import com.lyms.talkonlineweb.service.ArticleInfoService; +import com.lyms.talkonlineweb.service.GetpushartInfoService; import com.lyms.talkonlineweb.service.LymsArticleService; import com.lyms.talkonlineweb.service.LymsPushedartService; import com.lyms.talkonlineweb.service.impl.PushedartlogsInfoServiceImpl; @@ -41,6 +42,9 @@ public class ArticleController { @Autowired private PushedartlogsInfoServiceImpl pushedartlogsInfoService; + + @Autowired + private GetpushartInfoService getpushartInfoService;//小程序用户端-根据患者获取推送的文章-视图 /** * 上传文件 * @@ -126,28 +130,33 @@ public class ArticleController { * 根据患者获取推送的文章 */ @GetMapping("getPushArt") - public BaseResponse getPushArt(LymsPushedart pushedart) { +// public BaseResponse getPushArt(LymsPushedart pushedart) { +// BaseResponse baseResponse = new BaseResponse(); +// List pLst = lymsPushedartService.list(Wrappers.query(pushedart).orderByDesc("createdtime")); +// List idLst = new ArrayList(); +// pLst.forEach(e -> { +// idLst.add(e.getAid()); +// }); +// if (idLst.size() > 0) { +// List aLst = lymsArticleService.listByIds(idLst); +// +// //赋值已读未读 +// pLst.forEach(p->{ +// aLst.forEach(a->{ +// if(p.getAid()==a.getAid()){ +// a.setStat(p.getIsread()); +// } +// }); +// }); +// +// baseResponse.setObject(aLst); +// } +// return baseResponse; +// } + public BaseResponse getPushArt(@RequestBody GetpushartInfo getpushartInfo) { BaseResponse baseResponse = new BaseResponse(); - List pLst = lymsPushedartService.list(Wrappers.query(pushedart).orderByDesc("createdtime")); - List idLst = new ArrayList(); - pLst.forEach(e -> { - idLst.add(e.getAid()); - }); - if (idLst.size() > 0) { - List aLst = lymsArticleService.listByIds(idLst); - -// 赋值已读未读 - pLst.forEach(p->{ - aLst.forEach(a->{ - if(p.getAid()==a.getAid()){ - a.setStat(p.getIsread()); - } - }); - }); - - baseResponse.setObject(aLst); - - } + List getpushartInfoList= getpushartInfoService.list(Wrappers.query(getpushartInfo).orderByDesc("createdtime")); + baseResponse.setObject(getpushartInfoList); return baseResponse; } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/GetpushartInfo.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/GetpushartInfo.java new file mode 100644 index 0000000..e33b3ff --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/GetpushartInfo.java @@ -0,0 +1,64 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 小程序用户端-根据患者获取推送的文章-视图 + * @TableName getPushArt_info + */ +@TableName(value ="getPushArt_info") +@Data +public class GetpushartInfo implements Serializable { + /** + * 用户id + */ + @TableField(value = "pid") + private Integer pid; + + /** + * 问诊标题 + */ + @TableField(value = "title") + private String title; + + /** + * 文章内容 + */ + @TableField(value = "content") + private String content; + + /** + * 文章创建时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + /** + * 是否已读 + */ + @TableField(value = "isread") + private Byte isread; + + /** + * 文章id + */ + @TableField(value = "aid") + private Integer aid; + + /** + * 阅读次数 + */ + @TableField(value = "count") + private Long count; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/GetpushartInfoMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/GetpushartInfoMapper.java new file mode 100644 index 0000000..4d15597 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/GetpushartInfoMapper.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.GetpushartInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Entity com.lyms.talkonlineweb.domain.GetpushartInfo + */ +public interface GetpushartInfoMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/GetpushartInfoService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/GetpushartInfoService.java new file mode 100644 index 0000000..60c6264 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/GetpushartInfoService.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.lyms.talkonlineweb.domain.GetpushartInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.lyms.talkonlineweb.domain.LymsPushedart; + +import java.util.List; + +/** + * + */ +public interface GetpushartInfoService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/GetpushartInfoServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/GetpushartInfoServiceImpl.java new file mode 100644 index 0000000..c009ce7 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/GetpushartInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.GetpushartInfo; +import com.lyms.talkonlineweb.service.GetpushartInfoService; +import com.lyms.talkonlineweb.mapper.GetpushartInfoMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class GetpushartInfoServiceImpl extends ServiceImpl + implements GetpushartInfoService{ + +} + + + + diff --git a/talkonlineweb/src/main/resources/mapper/GetpushartInfoMapper.xml b/talkonlineweb/src/main/resources/mapper/GetpushartInfoMapper.xml new file mode 100644 index 0000000..f476cce --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/GetpushartInfoMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + pid,title,content, + createdtime,isread,aid, + count + +