Commit 91009d8626f1cdbc9e051caf8f7c2a6de009b223

Authored by shiyang
1 parent 62bb3de996
Exists in master

小程序用户端-根据患者获取推送的文章

Showing 6 changed files with 166 additions and 21 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java View file @ 91009d8
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.talkonlineweb.domain.*;
7 7 import com.lyms.talkonlineweb.result.BaseResponse;
8 8 import com.lyms.talkonlineweb.service.ArticleInfoService;
  9 +import com.lyms.talkonlineweb.service.GetpushartInfoService;
9 10 import com.lyms.talkonlineweb.service.LymsArticleService;
10 11 import com.lyms.talkonlineweb.service.LymsPushedartService;
11 12 import com.lyms.talkonlineweb.service.impl.PushedartlogsInfoServiceImpl;
... ... @@ -41,6 +42,9 @@
41 42  
42 43 @Autowired
43 44 private PushedartlogsInfoServiceImpl pushedartlogsInfoService;
  45 +
  46 + @Autowired
  47 + private GetpushartInfoService getpushartInfoService;//小程序用户端-根据患者获取推送的文章-视图
44 48 /**
45 49 * 上传文件
46 50 *
47 51  
... ... @@ -126,28 +130,33 @@
126 130 * 根据患者获取推送的文章
127 131 */
128 132 @GetMapping("getPushArt")
129   - public BaseResponse getPushArt(LymsPushedart pushedart) {
  133 +// public BaseResponse getPushArt(LymsPushedart pushedart) {
  134 +// BaseResponse baseResponse = new BaseResponse();
  135 +// List<LymsPushedart> pLst = lymsPushedartService.list(Wrappers.query(pushedart).orderByDesc("createdtime"));
  136 +// List idLst = new ArrayList();
  137 +// pLst.forEach(e -> {
  138 +// idLst.add(e.getAid());
  139 +// });
  140 +// if (idLst.size() > 0) {
  141 +// List<LymsArticle> aLst = lymsArticleService.listByIds(idLst);
  142 +//
  143 +// //赋值已读未读
  144 +// pLst.forEach(p->{
  145 +// aLst.forEach(a->{
  146 +// if(p.getAid()==a.getAid()){
  147 +// a.setStat(p.getIsread());
  148 +// }
  149 +// });
  150 +// });
  151 +//
  152 +// baseResponse.setObject(aLst);
  153 +// }
  154 +// return baseResponse;
  155 +// }
  156 + public BaseResponse getPushArt(@RequestBody GetpushartInfo getpushartInfo) {
130 157 BaseResponse baseResponse = new BaseResponse();
131   - List<LymsPushedart> pLst = lymsPushedartService.list(Wrappers.query(pushedart).orderByDesc("createdtime"));
132   - List idLst = new ArrayList();
133   - pLst.forEach(e -> {
134   - idLst.add(e.getAid());
135   - });
136   - if (idLst.size() > 0) {
137   - List<LymsArticle> aLst = lymsArticleService.listByIds(idLst);
138   -
139   -// 赋值已读未读
140   - pLst.forEach(p->{
141   - aLst.forEach(a->{
142   - if(p.getAid()==a.getAid()){
143   - a.setStat(p.getIsread());
144   - }
145   - });
146   - });
147   -
148   - baseResponse.setObject(aLst);
149   -
150   - }
  158 + List<GetpushartInfo> getpushartInfoList= getpushartInfoService.list(Wrappers.query(getpushartInfo).orderByDesc("createdtime"));
  159 + baseResponse.setObject(getpushartInfoList);
151 160 return baseResponse;
152 161 }
153 162  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/GetpushartInfo.java View file @ 91009d8
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import java.io.Serializable;
  8 +import java.util.Date;
  9 +import lombok.Data;
  10 +
  11 +/**
  12 + * 小程序用户端-根据患者获取推送的文章-视图
  13 + * @TableName getPushArt_info
  14 + */
  15 +@TableName(value ="getPushArt_info")
  16 +@Data
  17 +public class GetpushartInfo implements Serializable {
  18 + /**
  19 + * 用户id
  20 + */
  21 + @TableField(value = "pid")
  22 + private Integer pid;
  23 +
  24 + /**
  25 + * 问诊标题
  26 + */
  27 + @TableField(value = "title")
  28 + private String title;
  29 +
  30 + /**
  31 + * 文章内容
  32 + */
  33 + @TableField(value = "content")
  34 + private String content;
  35 +
  36 + /**
  37 + * 文章创建时间
  38 + */
  39 + @TableField(value = "createdtime")
  40 + private Date createdtime;
  41 +
  42 + /**
  43 + * 是否已读
  44 + */
  45 + @TableField(value = "isread")
  46 + private Byte isread;
  47 +
  48 + /**
  49 + * 文章id
  50 + */
  51 + @TableField(value = "aid")
  52 + private Integer aid;
  53 +
  54 + /**
  55 + * 阅读次数
  56 + */
  57 + @TableField(value = "count")
  58 + private Long count;
  59 +
  60 + @TableField(exist = false)
  61 + private static final long serialVersionUID = 1L;
  62 +
  63 +
  64 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/GetpushartInfoMapper.java View file @ 91009d8
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.GetpushartInfo;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.GetpushartInfo
  8 + */
  9 +public interface GetpushartInfoMapper extends BaseMapper<GetpushartInfo> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/GetpushartInfoService.java View file @ 91009d8
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4 +import com.lyms.talkonlineweb.domain.GetpushartInfo;
  5 +import com.baomidou.mybatisplus.extension.service.IService;
  6 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + *
  12 + */
  13 +public interface GetpushartInfoService extends IService<GetpushartInfo> {
  14 +
  15 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/GetpushartInfoServiceImpl.java View file @ 91009d8
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.GetpushartInfo;
  5 +import com.lyms.talkonlineweb.service.GetpushartInfoService;
  6 +import com.lyms.talkonlineweb.mapper.GetpushartInfoMapper;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class GetpushartInfoServiceImpl extends ServiceImpl<GetpushartInfoMapper, GetpushartInfo>
  14 + implements GetpushartInfoService{
  15 +
  16 +}
talkonlineweb/src/main/resources/mapper/GetpushartInfoMapper.xml View file @ 91009d8
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper
  3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.lyms.talkonlineweb.mapper.GetpushartInfoMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.GetpushartInfo">
  8 + <result property="pid" column="pid" jdbcType="INTEGER"/>
  9 + <result property="title" column="title" jdbcType="VARCHAR"/>
  10 + <result property="content" column="content" jdbcType="VARCHAR"/>
  11 + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
  12 + <result property="isread" column="isread" jdbcType="TINYINT"/>
  13 + <result property="aid" column="aid" jdbcType="INTEGER"/>
  14 + <result property="count" column="count" jdbcType="BIGINT"/>
  15 + </resultMap>
  16 +
  17 + <sql id="Base_Column_List">
  18 + pid,title,content,
  19 + createdtime,isread,aid,
  20 + count
  21 + </sql>
  22 +</mapper>