Compare commits
2 Commits
173b482b3a
...
e1abcbef16
Author | SHA1 | Date |
---|---|---|
BLRTTX | e1abcbef16 | |
BLRTTX | b889206ab4 |
|
@ -3,7 +3,7 @@ package com.atjy.model.entity;
|
|||
import com.atjy.model.enums.ArticleItemType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class ArticleInfo extends BaseEntity {
|
|||
|
||||
@Schema(description = "发布时间")
|
||||
@TableField(value = "publish_time")
|
||||
@JsonIgnore
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date publishTime;
|
||||
|
||||
@Schema(description = "医生id")
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.atjy.web.admin.service.impl;
|
|||
import com.atjy.model.entity.AppointmentInfo;
|
||||
import com.atjy.model.entity.ArticleInfo;
|
||||
import com.atjy.model.entity.GraphInfo;
|
||||
import com.atjy.model.enums.ArticleItemType;
|
||||
import com.atjy.model.enums.BaseStatus;
|
||||
import com.atjy.model.enums.GraphItemType;
|
||||
import com.atjy.web.admin.mapper.ArticleInfoMapper;
|
||||
|
@ -13,6 +14,7 @@ import com.atjy.web.admin.vo.article.ArticleListVo;
|
|||
import com.baomidou.mybatisplus.core.conditions.interfaces.Func;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, ArticleInfo> implements ArticleInfoService {
|
||||
|
@ -45,14 +48,25 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
|
|||
@Override
|
||||
public void saveOrUpdateArticle(ArticleInfoVo articleInfoVo) {
|
||||
ArticleInfo articleInfo = new ArticleInfo();
|
||||
if (articleInfoVo.getId() != null) {
|
||||
articleInfo.setId(articleInfoVo.getId());
|
||||
}
|
||||
articleInfo.setPublishTime(new Date());
|
||||
articleInfo.setIsDeleted((byte) 0);
|
||||
articleInfo.setType(articleInfoVo.getType());
|
||||
articleInfo.setTitleBig(articleInfoVo.getTitleBig());
|
||||
articleInfo.setTitleSmall(articleInfoVo.getTitleSmall());
|
||||
articleInfo.setContent(articleInfoVo.getContent());
|
||||
articleInfo.setDoctorId(articleInfoVo.getDoctorId());
|
||||
articleInfo.setNumber(articleInfoVo.getNumber());
|
||||
if (ArticleItemType.FIGHT_EPIDEMIC.getName().equals(articleInfoVo.getTypeName())) {
|
||||
articleInfo.setType(ArticleItemType.FIGHT_EPIDEMIC);
|
||||
} else if (ArticleItemType.HEALTH.getName().equals(articleInfoVo.getTypeName())) {
|
||||
articleInfo.setType(ArticleItemType.HEALTH);
|
||||
} else if (ArticleItemType.MEDICAL.getName().equals(articleInfoVo.getTypeName())) {
|
||||
articleInfo.setType(ArticleItemType.MEDICAL);
|
||||
} else {
|
||||
articleInfo.setType(ArticleItemType.PARENTING);
|
||||
}
|
||||
|
||||
articleInfoMapper.insertOrUpdate(articleInfo);
|
||||
|
||||
|
@ -62,8 +76,16 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
|
|||
graphInfo.setUrl(articleInfoVo.getUrl());
|
||||
graphInfo.setItemId(articleInfo.getId());
|
||||
graphInfo.setName(articleInfoVo.getName());
|
||||
|
||||
if (articleInfoVo.getUrlId() != null) {
|
||||
graphInfo.setId(articleInfoVo.getUrlId());
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
} else {
|
||||
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, articleInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.ARTICLE)) != null) {
|
||||
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.ARTICLE).eq("item_id", articleInfoVo.getId()).set("name", articleInfoVo.getName()).set("url", articleInfoVo.getUrl()));
|
||||
} else {
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.atjy.web.admin.mapper.*;
|
|||
import com.atjy.web.admin.service.DoctorInfoService;
|
||||
import com.atjy.web.admin.vo.doctor.DoctorInfoVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -54,10 +55,13 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
|
|||
@Override
|
||||
public void saveOrUpdateDoctor(DoctorInfoVo doctorInfoVo) {
|
||||
DoctorInfo doctorInfo = new DoctorInfo();
|
||||
if (doctorInfoVo.getId() != null) {
|
||||
doctorInfo.setId(doctorInfoVo.getId());
|
||||
}
|
||||
doctorInfo.setDepartmentId(departmentInfoMapper.selectOne(new LambdaQueryWrapper<DepartmentInfo>().eq(DepartmentInfo::getName, doctorInfoVo.getDepartmentName())).getId());
|
||||
doctorInfo.setHospitalId(hospitalInfoMapper.selectOne(new LambdaQueryWrapper<HospitalInfo>().eq(HospitalInfo::getHospitalName, doctorInfoVo.getHospitalName())).getId());
|
||||
doctorInfo.setIsDeleted((byte) 0);
|
||||
doctorInfo.setDoctorName(doctorInfo.getDoctorName());
|
||||
doctorInfo.setDoctorName(doctorInfoVo.getDoctorName());
|
||||
doctorInfo.setBriefly(doctorInfoVo.getBriefly());
|
||||
doctorInfo.setSource(doctorInfoVo.getSource());
|
||||
doctorInfo.setLevel(doctorInfoVo.getLevel());
|
||||
|
@ -73,7 +77,16 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
|
|||
graphInfo.setItemId(doctorInfo.getId());
|
||||
graphInfo.setName(doctorInfoVo.getGraphName());
|
||||
|
||||
if (doctorInfoVo.getUrlId() != null) {
|
||||
graphInfo.setId(doctorInfoVo.getUrlId());
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
} else {
|
||||
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, doctorInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.DOCTOR)) != null) {
|
||||
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.DOCTOR).eq("item_id", doctorInfo.getId()).set("name", doctorInfoVo.getGraphName()).set("url", doctorInfoVo.getUrl()));
|
||||
} else {
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.atjy.web.admin.mapper.*;
|
|||
import com.atjy.web.admin.service.HospitalInfoService;
|
||||
import com.atjy.web.admin.vo.hospital.HospitalInfoVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -80,6 +81,17 @@ public class HospitalInfoServiceImpl extends ServiceImpl<HospitalInfoMapper, Hos
|
|||
graphInfo.setItemId(hospitalInfo.getId());
|
||||
graphInfo.setName(hospitalInfoVo.getGraphName());
|
||||
|
||||
if (hospitalInfoVo.getUrlId() != null) {
|
||||
graphInfo.setId(hospitalInfoVo.getUrlId());
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
} else {
|
||||
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, hospitalInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.DOCTOR)) != null) {
|
||||
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.HOSPITAL).eq("item_id", hospitalInfo.getId()).set("name", hospitalInfoVo.getGraphName()).set("url", hospitalInfoVo.getUrl()));
|
||||
} else {
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
}
|
||||
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.atjy.web.admin.vo.article;
|
||||
|
||||
import com.atjy.model.entity.ArticleInfo;
|
||||
import com.atjy.model.enums.ArticleItemType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -12,4 +14,10 @@ public class ArticleInfoVo extends ArticleInfo {
|
|||
|
||||
@Schema(description = "图片名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "医说所属类型")
|
||||
private String typeName;
|
||||
|
||||
@Schema(description = "图片id")
|
||||
private Long urlId;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.atjy.web.admin.vo.article;
|
||||
|
||||
import com.atjy.web.admin.vo.doctor.DoctorVo;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ArticleListVo {
|
|||
private Long id;
|
||||
|
||||
@Schema(description = "发布时间")
|
||||
@JsonIgnore
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date publishTime;
|
||||
|
||||
@Schema(description = "医生详情")
|
||||
|
@ -34,11 +34,14 @@ public class ArticleListVo {
|
|||
private String content;
|
||||
|
||||
@Schema(description = "医说所属类型")
|
||||
private String type;
|
||||
private String typeName;
|
||||
|
||||
@Schema(description = "图片地址")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "图片名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图片id")
|
||||
private Long urlId;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.atjy.web.admin.vo.doctor;
|
||||
|
||||
import com.atjy.model.entity.DoctorInfo;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -10,6 +11,9 @@ import java.util.List;
|
|||
@Schema(description = "医生信息实体")
|
||||
public class DoctorInfoVo extends DoctorInfo {
|
||||
|
||||
@Schema(description = "图片id")
|
||||
private Long urlId;
|
||||
|
||||
@Schema(description = "图片名称")
|
||||
private String graphName;
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ import lombok.Data;
|
|||
@Schema(description = "文件实体")
|
||||
public class FileVo {
|
||||
|
||||
@Schema(description = "图片id")
|
||||
private Long urlId;
|
||||
|
||||
@Schema(description = "图片url")
|
||||
private String url;
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ import lombok.Data;
|
|||
@Schema(description = "医院信息实体")
|
||||
public class HospitalInfoVo extends HospitalInfo {
|
||||
|
||||
@Schema(description = "图片id")
|
||||
private Long urlId;
|
||||
|
||||
@Schema(description = "图片名称")
|
||||
private String graphName;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
ai.content,
|
||||
di.id doctor_id,
|
||||
di.doctor_name,
|
||||
gi.id url_id,
|
||||
gi.url,
|
||||
gi.name,
|
||||
case
|
||||
|
@ -28,7 +29,7 @@
|
|||
when ai.type = 2 then "健康养生"
|
||||
when ai.type = 3 then "医疗动态"
|
||||
when ai.type = 4 then "育儿专区"
|
||||
end as type
|
||||
end as type_name
|
||||
from article_info ai
|
||||
join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0
|
||||
join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0
|
||||
|
@ -44,6 +45,7 @@
|
|||
ai.content,
|
||||
di.id doctor_id,
|
||||
di.doctor_name,
|
||||
gi.id url_id,
|
||||
gi.url,
|
||||
gi.name,
|
||||
case
|
||||
|
@ -51,7 +53,7 @@
|
|||
when ai.type = 2 then "健康养生"
|
||||
when ai.type = 3 then "医疗动态"
|
||||
when ai.type = 4 then "育儿专区"
|
||||
end as type
|
||||
end as type_name
|
||||
from article_info ai
|
||||
join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0
|
||||
join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
di.briefly,
|
||||
hi.hospital_name,
|
||||
d.name department_name,
|
||||
gi.id url_id,
|
||||
gi.url,
|
||||
gi.name
|
||||
gi.name graph_name
|
||||
from doctor_info di
|
||||
join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0
|
||||
join department_info d on di.department_id = d.id and d.is_deleted = 0
|
||||
|
@ -34,7 +35,8 @@
|
|||
di.briefly,
|
||||
hi.hospital_name,
|
||||
d.name department_name,
|
||||
gi.name,
|
||||
gi.id url_id,
|
||||
gi.name graph_name,
|
||||
gi.url
|
||||
from doctor_info di
|
||||
join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0
|
||||
|
|
Loading…
Reference in New Issue