Commit 6ef8c136 by 阳浪

投稿管理

parent 7f013b60
package com.yizhi.site.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.site.application.vo.domain.PublicationVo;
import com.yizhi.site.application.vo.domain.PublicationVo;
import com.yizhi.site.application.vo.site.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "portal", contextId = "PublicationManageFeignClients")
public interface PublicationManageFeignClients {
/**
* 查看资讯
*/
@PostMapping("/manage/site/classify/publication/list")
public Page<PublicationVo> list(@RequestBody PublicationParamVO vo);
@ApiOperation(value = "查询发布的新闻列表")
@PostMapping("/manage/site/classify/publication/release/list")
public Page<PublicationVo> releaseList(@RequestBody PublicationParamReleaseVO vo);
/**
* 保存资料分类
*/
@PostMapping("/manage/site/classify/publication/insert")
public Long insert(@RequestBody PublicationVo publicationVo);
/**
* 修改资料分类
*/
@PostMapping("/manage/site/classify/publication/update")
public Boolean update(@RequestBody PublicationVo publicationVo);
/**
* 删除资讯
*/
@PostMapping("/manage/site/classify/publication/delete")
Boolean deleteById(@RequestBody IdOneVO vo);
/**
* 资讯发布
*/
@PostMapping("/manage/site/classify/publication/releases")
boolean releases(@RequestBody ParamVO vo);
/**
* 资讯取消发布
*/
@PostMapping("/manage/site/classify/publication/unreleases")
boolean unreleases(@RequestBody ParamVO vo);
/**
* 资讯预览
*/
@GetMapping(value = "/manage/site/classify/publication/view/{id}")
PublicationVo publicationView(@RequestParam(name = "id") Long id);
/**
* 搜索资讯
*/
@GetMapping(value = "/manage/site/classify/publication/listbyName")
List<PublicationVo> listbyName(@RequestParam(name = "name") String name, @RequestParam(name = "siteId") Long siteId);
/**
* 新闻资讯公告上架
* @param id 新闻公告id
* @return
*/
@GetMapping("/manage/site/classify/publication/upPublication")
public boolean upPublication(@RequestParam(value = "id") Long id);
/**
* 新闻资讯pdf转图片需要
* @return
*/
@PostMapping(value = "/manage/site/classify/publication/updateContent")
public boolean updateContent(@RequestBody PublicationVo publicationVo);
}
...@@ -97,6 +97,8 @@ public class InformationVo{ ...@@ -97,6 +97,8 @@ public class InformationVo{
@ApiModelProperty(value = "文章第三层类型") @ApiModelProperty(value = "文章第三层类型")
private Long typeThree; private Long typeThree;
private String typeThreeName;
@ApiModelProperty(value = "资讯分类") @ApiModelProperty(value = "资讯分类")
private List<InformationClassify> informationClassify; private List<InformationClassify> informationClassify;
......
package com.yizhi.site.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author yanglang
* @since 2024-12-17
*/
@ApiModel(value = "PublicationVo", description = "投稿")
@Data
public class PublicationVo {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主鍵")
private Long id;
@ApiModelProperty(value = "封面logo")
private String logoPath;
@ApiModelProperty(value = "编号")
private String number;
@ApiModelProperty(value = "投稿标题")
private String fileName;
@ApiModelProperty(value = "投稿父类型 1: 新闻 2: 公告")
private Long typeOne;
private String typeOneName;
@ApiModelProperty(value = "投稿子类型")
private Long typeTwo;
private String typeTwoName;
@ApiModelProperty(value = "作者")
private String author;
@ApiModelProperty(value = "发布时间")
private Date releaseTime;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "原文链接")
private String linkUrl;
@ApiModelProperty(value = "审核时间")
private Date approveTime;
@ApiModelProperty(value = "审批人")
private Long approveById;
@ApiModelProperty(value = "状态 0 删除 1 草稿 2 待审核 3 待发布 4 已发布 5 不通过")
private Integer state;
@ApiModelProperty(value = "站点ID")
private Long siteId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建人")
private Long createById;
@ApiModelProperty(value = "创建人姓名")
private String createByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "修改人")
private Long updateById;
@ApiModelProperty(value = "修改人姓名")
private String updateByName;
@ApiModelProperty(value = "图片或视频链接地址")
private String ossUrl;
@ApiModelProperty(value = "支部或部室")
private String deptName;
@ApiModelProperty(value = "投稿第三层类型")
private Long typeThree;
private String typeThreeName;
@ApiModelProperty(value = "投稿时间")
private Date submitTime;
@ApiModelProperty(value = "资讯分类")
private List<InformationClassify> informationClassify;
protected Serializable pkVal() {
return this.id;
}
}
\ No newline at end of file
...@@ -29,6 +29,8 @@ public class InformationStudentVO { ...@@ -29,6 +29,8 @@ public class InformationStudentVO {
@ApiModelProperty(value = "子章父类型") @ApiModelProperty(value = "子章父类型")
private Long typeTwo; private Long typeTwo;
private Long typeThree;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
private Date releaseTime; private Date releaseTime;
......
package com.yizhi.site.application.vo.site;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@ApiModel(value="PublicationParamReleaseVO", description="查看投稿参数VO")
public class PublicationParamReleaseVO extends ContextVO {
@ApiModelProperty(value="标题")
private String fileName;
@ApiModelProperty(value="当前页")
private Integer pageNo;
@ApiModelProperty(value="每页的个数")
private Integer pageSize;
@ApiModelProperty(value="类型")
private Long typeId;
@ApiModelProperty(value="发布时间的起点")
private Date start;
@ApiModelProperty(value="发布时间的终点")
private Date end;
private Long siteId;
@ApiModelProperty(value = "状态 0 删除 1 草稿 2 待审核 3 待发布 4 已发布 5 不通过")
private Integer state;
private Long companyId;
private String companyCode;
private String companyName;
private String siteCode;
private String siteName;
private Integer siteType;
private Long siteMember;
private Long orgId;
private String orgName;
private Long accountId;
private String accountName;
private String accountFullName;
private String headPortrait;
private String requestId;
private boolean admin;
private List<Long> orgIds;
private String authCode;
private List<Long> relationIds;
private List<Long> managerIds;
}
package com.yizhi.site.application.vo.site;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* com.yizhi.site.application.vo.site
*
* @author yanglang
* @create 2024-12-17 14:53:19
*/
@Data
@ApiModel(value="InfomationParamVO", description="查看投稿参数VO")
public class PublicationParamVO extends ContextVO {
@ApiModelProperty(value="标题")
private String fileName;
@ApiModelProperty(value="当前页")
private Integer pageNo;
@ApiModelProperty(value="每页的个数")
private Integer pageSize;
@ApiModelProperty(value="类型")
private Long typeId;
@ApiModelProperty(value="发布时间的起点")
private Date start;
@ApiModelProperty(value="发布时间的终点")
private Date end;
private Long siteId;
@ApiModelProperty(value = "状态 0 删除 1 草稿 2 待审核 3 待发布 4 已发布 5 不通过")
private Integer state;
}
package com.yizhi.site.application.vo.site;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel(value = "PublicationStudentVO", description = "学员端资讯详情")
@Data
public class PublicationStudentVO {
@ApiModelProperty(value = "主鍵")
private Long id;
@ApiModelProperty(value = "封面logo")
private String logoPath;
@ApiModelProperty(value = "文章名称")
private String fileName;
@ApiModelProperty(value = "文章概要")
private String content;
@ApiModelProperty(value = "文章父类型")
private Long typeOne;
@ApiModelProperty(value = "子章父类型")
private Long typeTwo;
private Long typeThree;
@ApiModelProperty(value = "发布时间")
private Date releaseTime;
@ApiModelProperty(value = "投稿时间")
private Date submitTime;
@ApiModelProperty(value = "原文链接")
private String linkUrl;
@ApiModelProperty(value = "阅读次数")
private String number;
@ApiModelProperty(value = "类型名称")
private String name;
@ApiModelProperty(value = "作者")
private String author;
@ApiModelProperty(value = "状态 0 删除 1 草稿 2 待审核 3 待发布 4 已发布 5 不通过")
private Integer state;
@ApiModelProperty(value = "当前信息在当前列表的索引")
private Integer listNo;
}
package com.yizhi.site.application.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.comment.application.vo.PdfVO;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.site.application.constant.SiteConstant;
import com.yizhi.site.application.domain.Information;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.service.InformationService;
import com.yizhi.site.application.service.PortalBannerService;
import com.yizhi.site.application.service.PublicationService;
import com.yizhi.site.application.vo.site.*;
import com.yizhi.util.application.constant.TpActivityType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* <p>
* 投稿管理,前端控制器
* </p>
*
* @author yanglang
* @since 2024-12-17
*/
@Api(tags = "管理端-投稿管理", description = "投稿管理")
@RestController
@RequestMapping("/manage/site/classify/publication")
public class PublicationManageController {
@Autowired
private PublicationService publicationService;
@Autowired
PortalBannerService portalBannerService;
private static final Logger LOGGER = LoggerFactory.getLogger(PublicationManageController.class);
@PostMapping("/list")
public Page<Publication> list(@RequestBody PublicationParamVO vo) {
return publicationService.publicationList(vo);
}
@ApiOperation(value = "查询发布的新闻列表")
@PostMapping("/release/list")
public Page<Publication> releaseList(@RequestBody PublicationParamReleaseVO vo) {
return publicationService.publicationReleaseList(vo);
}
@PostMapping("/insert")
public Long insert(@RequestBody Publication publication) {
return publicationService.insertPublication(publication);
}
@PostMapping("/update")
public Boolean update(@RequestBody Publication publication) {
publication.setState(SiteConstant.THREE);
publicationService.updateById(publication);
return true;
}
@PostMapping("/delete")
public boolean deleteById(@RequestBody IdOneVO vo) {
return publicationService.deleteById(vo.getId());
}
@PostMapping("/releases")
public boolean releases(@RequestBody ParamVO vo) {
return publicationService.releases(vo);
}
@PostMapping("/unreleases")
public boolean unreleases(@RequestBody ParamVO vo) {
return publicationService.unreleases(vo);
}
@GetMapping("/view/{id}")
public Publication publicationView(@RequestParam(name = "id") Long id) {
return publicationService.publicationView(id);
}
@GetMapping(value = "/listbyName")
public List<Publication> listbyName(@RequestParam(name = "name")String name, @RequestParam(name = "siteId")Long siteId){
return publicationService.listbyName(name, siteId);
}
/**
* 新闻资讯公告上架
* @param id 新闻公告id
* @return
*/
@GetMapping(value = "/upPublication")
public boolean upPublication(@RequestParam(value = "id") Long id) {
return publicationService.releasePublication(id);
}
@PostMapping(value = "/timeUp")
public boolean upState(@RequestParam(value = "id") Long id){
try {
// 添加定时上架
publicationService.timeUpInfomation(id);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/**
* 新闻资讯pdf转图片需要
* @return
*/
@PostMapping(value = "/updateContent")
public boolean updateContent(@RequestBody Publication publication) {
if (publication.getId() == null) {
LOGGER.error("异常处理新闻pdf转图片,id为空!");
return false;
}
return this.publicationService.updateById(publication);
}
}
...@@ -120,6 +120,9 @@ public class Information extends Model<Information> { ...@@ -120,6 +120,9 @@ public class Information extends Model<Information> {
@ApiModelProperty(value = "文章子类型(三级)") @ApiModelProperty(value = "文章子类型(三级)")
@TableField("type_three") @TableField("type_three")
private Long typeThree; private Long typeThree;
@TableField(exist = false)
private String typeThreeName;
@ApiModelProperty(value = "资讯分类") @ApiModelProperty(value = "资讯分类")
@TableField(exist = false) @TableField(exist = false)
......
package com.yizhi.site.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.yizhi.site.application.vo.domain.InformationClassify;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* com.yizhi.site.application.domain
*
* @author yanglang
* @create 2024-12-17 13:14:46
*/
@ApiModel(value = "PublicationEntityVo", description = "投稿")
@Data
@TableName("publication")
public class Publication {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主鍵")
private Long id;
@ApiModelProperty(value = "封面logo")
private String logoPath;
@ApiModelProperty(value = "编号")
private String number;
@ApiModelProperty(value = "投稿标题")
private String fileName;
@ApiModelProperty(value = "投稿父类型 1: 新闻 2: 公告")
private Long typeOne;
@TableField(exist = false)
private String typeOneName;
@ApiModelProperty(value = "投稿子类型")
private Long typeTwo;
@TableField(exist = false)
private String typeTwoName;
@ApiModelProperty(value = "作者")
private String author;
@ApiModelProperty(value = "发布时间")
private Date releaseTime;
@ApiModelProperty(value = "投稿时间")
private Date submitTime;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "原文链接")
private String linkUrl;
@ApiModelProperty(value = "审核时间")
private Date approveTime;
@ApiModelProperty(value = "审批人")
private Long approveById;
@ApiModelProperty(value = "状态 0 删除 1 草稿 2 待审核 3 待发布 4 已发布 5 不通过")
private Integer state;
@ApiModelProperty(value = "站点ID")
private Long siteId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建人")
private Long createById;
@ApiModelProperty(value = "创建人姓名")
private String createByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "修改人")
private Long updateById;
@ApiModelProperty(value = "修改人姓名")
private String updateByName;
@ApiModelProperty(value = "图片或视频链接地址")
private String ossUrl;
@ApiModelProperty(value = "支部或部室")
private String deptName;
@ApiModelProperty(value = "投稿第三层类型")
private Long typeThree;
@TableField(exist = false)
private String typeThreeName;
@ApiModelProperty(value = "资讯分类")
@TableField(exist = false)
private List<InformationClassify> informationClassify;
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.site.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.vo.site.AnnouncementVO;
import com.yizhi.site.application.vo.site.InfomationParamVO;
import com.yizhi.site.application.vo.site.PublicationParamVO;
import com.yizhi.site.application.vo.site.PublicationStudentVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yanglang
* @since 2024-12-17
*/
public interface PublicationMapper extends BaseMapper<Publication> {
List<Publication> publicationTwoList(InfomationParamVO vo, Page<Publication> page);
List<AnnouncementVO> selectAnnouncement(Page<AnnouncementVO> page, Map<String, Object> map);
List<PublicationStudentVO> publicationPageList(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeOne") Long typeOne, Page<PublicationStudentVO> page);
/**
* 版本2 修改 :去掉置顶排序
*/
List<PublicationStudentVO> publicationPageListV2(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeOne") Long typeOne, Page<PublicationStudentVO> page);
List<PublicationStudentVO> publicationPageOtherList(@Param("typeOne") Long typeOne, @Param("typeTwo") Long typeTwo, @Param("siteId") Long siteId, Page<PublicationStudentVO> page);
List<PublicationStudentVO> selectpublicationVO(@Param("typeOne") Long typeOne, @Param("siteId") Long siteId,
@Param("state") Integer state, Page<PublicationStudentVO> page);
List<Publication> searchpublication(Page<Publication> page, Publication info);
List<Publication> searchpublication(Publication info);
/**
* 查询新闻数量
*
* @param id
* @return
*/
Integer querypublicationByTypeTwo(@Param("id") Long id);
/**
* ---------------------分割线---------------
*/
List<Publication> getRelationAnnouncementPC(@Param("terminalId") Long terminalId);
List<PublicationStudentVO> publicationPcPageList(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeOne") Long typeOne, Page<PublicationStudentVO> page);
List<PublicationStudentVO> publicationClassifyPcPageList(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeTwo") Long typeTwo, @Param("level") Integer level, Page<PublicationStudentVO> page);
Long publicationRelationGetpublicationIds(@Param("terminalId") Long terminalId);
List<Long> getRelationpublicationIds(@Param("templateId") Long templateId);
String getType(@Param("id") Long id, @Param("siteId") Long siteId);
/**
* 获取相关的新闻id
*
* @param terminalId
* @return
*/
List<Long> selectRelationIds(@Param("terminalId") Long terminalId);
/**
* 获取置顶的公告
*/
List<PublicationStudentVO> publicationTopList(@Param("typeName") String typeName, @Param("siteId") Long siteId,@Param("typeOne") Long typeOne);
/**
* 获取首页置顶新闻
*/
List<PublicationStudentVO> publicationIndexTopList(@Param("siteId") Long siteId);
List<Publication> publicationFirstList(PublicationParamVO publicationParamVO, Page<Publication> page);
}
\ No newline at end of file
package com.yizhi.site.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.vo.site.*;
import java.util.List;
/**
* com.yizhi.site.application.service
*
* @author yanglang
* @create 2024-12-17 14:34:33
*/
public interface PublicationService extends IService<Publication> {
/**
* 根据分类id查询资讯
*/
List<Publication> selectPublication(Long typeTwo);
Page<Publication> publicationList(PublicationParamVO vo);
Long insertPublication(Publication publication);
/**
* 资讯发布(批量)
*/
boolean releases(ParamVO vo);
/**
* 新闻资讯上架
*
* @param id 新闻公告id
* @return
*/
boolean releasePublication(Long id );
/**
* 资讯取消发布(批量)
*/
boolean unreleases(ParamVO vo);
/**
* 根据新闻,公告查询资讯
*/
Page<PublicationStudentVO> publicationList(Long typeOne, Integer pageNo, Integer pageSize, Long siteId);
/**
* 根据id查询资讯
*/
Publication getPublication(Long id, Long siteId);
/**
* 首页 搜索新闻公告
*/
List<Publication> searchPublication(Page<Publication> page, Publication info);
/**
* 轮播图 类型 新闻模糊搜索
*/
List<Publication> listbyName(String name, Long siteId);
Publication publicationView(Long id);
public boolean timeUpInfomation( Long id);
/**
* ----------------------华丽的分割线---------------------------------
*/
List<Publication> getRelationAnnouncementPC(Long terminalId);
Page<Publication> getPublicationByTypeOne(Long typeOne,Integer pageNo,Integer pageSize,Long siteId,List<Long> listIds);
Page<Publication> getAllAnnouncementPC(Long terminalId,Integer pageNo,Integer pageSize);
Page<Publication> getAllNewsPC(Long terminalId,Integer pageNo,Integer pageSize);
List<Publication> getRelationPublication(Long id);
List<Publication> listSupplyPublication(Long siteId,List<Long> ids);
Page<Publication> publicationReleaseList(PublicationParamReleaseVO vo);
}
...@@ -929,6 +929,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -929,6 +929,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
} }
} }
page.setRecords(list); page.setRecords(list);
...@@ -986,6 +989,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -986,6 +989,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
} }
} }
page.setRecords(list); page.setRecords(list);
...@@ -1004,6 +1010,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1004,6 +1010,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
//设置资讯分类 //设置资讯分类
InformationClassify classify = new InformationClassify(); InformationClassify classify = new InformationClassify();
......
package com.yizhi.site.application.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.site.application.constant.SiteConstant;
import com.yizhi.site.application.domain.DataClassification;
import com.yizhi.site.application.domain.ProtalPlate;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.mapper.*;
import com.yizhi.site.application.service.*;
import com.yizhi.site.application.vo.domain.InformationClassify;
import com.yizhi.site.application.vo.site.*;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* com.yizhi.site.application.service.impl
*
* @author yanglang
* @create 2024-12-17 14:38:56
*/
@Log4j2
@Service
public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publication> implements PublicationService {
private static final Logger LOGGER = LoggerFactory.getLogger(PublicationServiceImpl.class);
private static final String jobGroup = "publication";
@Autowired
private IdGenerator idGenerator;
@Autowired
private PublicationMapper publicationMapper;
@Autowired
private PortalBannerService portalBannerService;
@Autowired
private DataClassificationService dataClassificationService;
@Autowired
private ProtalPlateService protalPlateService;
@Autowired
private PortalTerminalMapper portalTerminalMapper;
@Autowired
private HomeAnnouncementMapper homeAnnouncementMapper;
@Autowired
private CloudEventPublisher cloudEventPublisher;
@Autowired
private PdfPagesClient pdfPagesClient;
@Autowired
private ITrInformationReadNumberService informationReadNumberService;
@Autowired
private InformationClassifyMapper informationClassifyMapper;
@Override
public List<Publication> selectPublication(Long typeTwo) {
Publication publication = new Publication();
publication.setTypeTwo(typeTwo);
EntityWrapper<Publication> wrapper = new EntityWrapper<Publication>(publication);
return this.selectList(wrapper);
}
@Override
public Page<Publication> publicationList(PublicationParamVO vo) {
// modify by lingye
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
try {
if (vo.getStart() != null) {
Date startTime = sdf.parse(sdf.format(vo.getStart()));
Date endTime = sdf.parse(sdf.format(vo.getEnd()));
// 查询结束时间 加一天
Calendar c = Calendar.getInstance();
c.setTime(endTime);
c.add(Calendar.DAY_OF_MONTH, 1);
Date end = c.getTime();
log.info("开始时间:" + startTime + ";结束时间:" + end);
vo.setStart(sdf.parse(sdf.format(vo.getStart())));
vo.setEnd(end);
}
} catch (ParseException e) {
e.printStackTrace();
}
Page<Publication> page = new Page<Publication>(vo.getPageNo(), vo.getPageSize());
List<Publication> list = null;
DataClassification selectById = dataClassificationService.selectById(vo.getTypeId());
if (selectById == null) {
return null;
}
if (selectById.getName().equals(SiteConstant.ANNOUNCEMENT) && selectById.getParentId() == 0) { //公告
list = publicationMapper.publicationFirstList(vo, page);
} else if (selectById.getParentId() == 0) {//新闻所有列表
list = publicationMapper.publicationFirstList(vo, page);
} else {
list = publicationMapper.publicationFirstList(vo, page);//新闻分类列表
}
if (list.size() > 0 && list != null) {
for (Publication info : list) {
if (info.getTypeOne() != null || info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne()));
}
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo()));
}
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
}
}
page.setRecords(list);
return page;
}
@Override
public Long insertPublication(Publication publication) {
Long id = idGenerator.generate();
publication.setId(id);
publication.setSubmitTime(new Date());
publication.setState(SiteConstant.TWO);
this.insert(publication);
return id;
}
@Override
public boolean releases(ParamVO vo) {
List<Long> ids = vo.getIds();
List<Publication> list = new ArrayList<Publication>();
Publication selectById = null;
for (Long id : ids) {
selectById = this.selectById(id);
selectById.setState(SiteConstant.FOUR);
list.add(selectById);
}
if (list.size() > 0) {
this.updateBatchById(list);
}
return true;
}
@Override
public boolean releasePublication(Long id) {
Publication publication = this.selectById(id);
publication.setState(SiteConstant.FOUR);
// 新闻公告上架操作
this.updateById(publication);
return true;
}
@Override
public boolean unreleases(ParamVO vo) {
List<Long> ids = vo.getIds();
List<Publication> list = new ArrayList<Publication>();
Publication selectById = null;
for (Long id : ids) {
selectById = this.selectById(id);
selectById.setState(SiteConstant.THREE);
list.add(selectById);
}
if (list.size() > 0) {
this.updateBatchById(list);
}
return true;
}
@Override
public Page<PublicationStudentVO> publicationList(Long typeOne, Integer pageNo, Integer pageSize, Long siteId) {
Page<PublicationStudentVO> page = new Page<PublicationStudentVO>(pageNo, pageSize);
Integer state = 2;
List<PublicationStudentVO> list = publicationMapper.selectpublicationVO(typeOne, siteId, state, page);
page.setRecords(list);
return page;
}
@Override
public Publication getPublication(Long id, Long siteId) {
Publication publication = new Publication();
publication.setSiteId(siteId);
publication.setId(id);
publication.setState(2);
EntityWrapper<Publication> wrapper = new EntityWrapper<Publication>(publication);
return this.selectOne(wrapper);
}
@Override
public List<Publication> searchPublication(Page<Publication> page, Publication info) {
return publicationMapper.searchpublication(page, info);
}
@Override
public List<Publication> listbyName(String name, Long siteId) {
Publication info = new Publication();
info.setFileName(name);
info.setSiteId(siteId);
info.setState(SiteConstant.FOUR);
return publicationMapper.searchpublication(info);
}
@Override
public Publication publicationView(Long id) {
Publication info = this.selectById(id);
if (info == null) {
return null;
}
if (info.getTypeOne() != null || info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne()));
}
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo()));
}
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
//设置资讯分类
InformationClassify classify = new InformationClassify();
classify.setInformationId(id);
EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify);
List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper);
info.setInformationClassify(informationClassify);
return info;
}
@Override
public boolean timeUpInfomation(Long id) {
Publication publication = this.selectById(id);
try {
publication.setApproveTime(new Date());
publication.setState(SiteConstant.THREE);
publication.setApproveById(ContextHolder.get().getAccountId());
return this.updateById(publication);
} catch (Exception e) {
log.error("审批失败,id=" + id + "错误消息={}", e);
}
return true;
}
@Override
public List<Publication> getRelationAnnouncementPC(Long terminalId) {
return publicationMapper.getRelationAnnouncementPC(terminalId);
}
@Override
public Page<Publication> getPublicationByTypeOne(Long typeOne, Integer pageNo, Integer pageSize, Long siteId, List<Long> listIds) {
LOGGER.info("参数:"+listIds);
Page<Publication> page = new Page<Publication>(pageNo, pageSize);
Publication publication = new Publication();
publication.setTypeOne(typeOne);
publication.setState(2);
publication.setSiteId(siteId);
EntityWrapper<Publication> wrapper = new EntityWrapper<Publication>(publication);
if (null!=listIds&&listIds.size()>0) {
LOGGER.info("参数长度大于0");
wrapper.notIn("id", listIds);
}
return this.selectPage(page, wrapper);
}
@Override
public Page<Publication> getAllAnnouncementPC(Long terminalId, Integer pageNo, Integer pageSize) {
// TODO Auto-generated method stub
Long siteId = ContextHolder.get().getSiteId();
DataClassification dataClassification = new DataClassification();
dataClassification.setSiteId(siteId);
dataClassification.setParentId(0L);
dataClassification.setName("公告");
dataClassification.setState(1);
EntityWrapper<DataClassification> wrapper = new EntityWrapper<DataClassification>(dataClassification);
//公告的一级信息 公告没有二级标题
DataClassification dataClassification2 = dataClassificationService.selectOne(wrapper);
//已经关联的公告具体信息
List<Publication> listInformations = publicationMapper.getRelationAnnouncementPC(terminalId);
List<Long> listIds = null;
if (CollectionUtils.isNotEmpty(listInformations)) {
listIds = new ArrayList<Long>();
for (int i = 0; i < listInformations.size(); i++) {
listIds.add(listInformations.get(i).getId());
}
}
if (dataClassification2 != null) {
//一级分类ID
Long id = dataClassification2.getId();
return getPublicationByTypeOne(id, pageNo, pageSize, siteId, listIds);
}
return null;
}
@Override
public Page<Publication> getAllNewsPC(Long terminalId, Integer pageNo, Integer pageSize) {
// TODO Auto-generated method stub
Long siteId = ContextHolder.get().getSiteId();
DataClassification dataClassification = new DataClassification();
dataClassification.setSiteId(siteId);
dataClassification.setParentId(0L);
dataClassification.setName("新闻");
dataClassification.setState(1);
EntityWrapper<DataClassification> wrapper = new EntityWrapper<DataClassification>(dataClassification);
DataClassification dataClassification2 = dataClassificationService.selectOne(wrapper);
if (dataClassification2 != null) {
//一级分类ID
Long id = dataClassification2.getId();
//已经关联的新闻除外
// Long templateId = informationMapper.informationRelationGetInformationIds(terminalId);
List<Long> relationNnews = publicationMapper.selectRelationIds(terminalId);
// if (templateId != null) {
// relationNnews = informationMapper.getRelationInformationIds(templateId);
// }
return getPublicationByTypeOne(id, pageNo, pageSize, siteId, relationNnews);
}
return null;
}
@Override
public List<Publication> getRelationPublication(Long id) {
// TODO Auto-generated method stub
ProtalPlate plate = new ProtalPlate();
plate.setTemplateId(id);
plate.setState(1);//未删除
EntityWrapper<ProtalPlate> wrapper = new EntityWrapper<ProtalPlate>(plate);
List<ProtalPlate> listProtalPlate = protalPlateService.selectList(wrapper);
List<Long> listInformationIds = null;
if (CollectionUtils.isNotEmpty(listProtalPlate)) {
listInformationIds = new ArrayList<Long>();
for (int i = 0; i < listProtalPlate.size(); i++) {
listInformationIds.add(listProtalPlate.get(i).getLinkContent());
}
if (CollectionUtils.isNotEmpty(listInformationIds)) {
return this.selectBatchIds(listInformationIds);
}
}
return null;
}
@Override
public List<Publication> listSupplyPublication(Long siteId, List<Long> ids) {
// TODO Auto-generated method stub
DataClassification dataClassification = new DataClassification();
dataClassification.setSiteId(siteId);
dataClassification.setParentId(0L);
dataClassification.setName("新闻");
dataClassification.setState(1);
EntityWrapper<DataClassification> wrapper = new EntityWrapper<DataClassification>(dataClassification);
DataClassification dataClassification2 = dataClassificationService.selectOne(wrapper);
if (dataClassification2 != null) {
//一级分类ID
Long id = dataClassification2.getId();
Publication publication = new Publication();
publication.setTypeOne(id);
publication.setState(2);
EntityWrapper<Publication> wrapperPublication = new EntityWrapper<Publication>(publication);
wrapperPublication.notIn("id", ids);
wrapperPublication.orderBy("release_time", false);
wrapperPublication.orderBy("submit_time", false);
return this.selectList(wrapperPublication);
}
return null;
}
@Override
public Page<Publication> publicationReleaseList(PublicationParamReleaseVO vo) {
//查找分类;获取分类下
SiteComponyIdVO siteComponyIdVO = new SiteComponyIdVO();
siteComponyIdVO.setCompanyId(vo.getCompanyId());
siteComponyIdVO.setSiteId(vo.getSiteId());
siteComponyIdVO.setCreateById(vo.getAccountId());
siteComponyIdVO.setCreateByName(vo.getAccountName());
siteComponyIdVO.setOrgId(vo.getOrgId());
siteComponyIdVO.setSiteId(vo.getSiteId());
List<ClassificationVO> classificationVOList = dataClassificationService.getClassification(siteComponyIdVO);
Long typeOne = null;
for (ClassificationVO classificationVO :
classificationVOList) {
if (SiteConstant.PORTALNEWS.equals(classificationVO.getName())) {
typeOne = classificationVO.getId();
log.info("typeOne值为:" + typeOne);
break;
}
}
vo.setTypeId(typeOne);
DataClassification selectById = dataClassificationService.selectById(vo.getTypeId());
if (selectById == null) {
return null;
}
//获取所有上架新闻列表
PublicationParamVO publicationParamVO = new PublicationParamVO();
BeanUtils.copyProperties(vo,publicationParamVO);
publicationParamVO.setState(4);
Page<Publication> page = new Page<Publication>(vo.getPageNo(), vo.getPageSize());
List<Publication> list = publicationMapper.publicationFirstList(publicationParamVO, page);
if (list.size() > 0 && list != null) {
for (Publication info : list) {
if (info.getTypeOne() != null || info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne()));
}
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo()));
}
if (info.getTypeThree() != null || info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree()));
}
}
}
page.setRecords(list);
return page;
}
private String findNameById(Long id) {
DataClassification selectById = dataClassificationService.selectById(id);
if (selectById != null) {
return selectById.getName();
}
return null;
}
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="file_name" property="fileName"/> <result column="file_name" property="fileName"/>
<result column="type_one" property="typeOne"/> <result column="type_one" property="typeOne"/>
<result column="type_two" property="typeTwo"/> <result column="type_two" property="typeTwo"/>
<result column="type_three" property="typeThree"/>
<result column="author" property="author"/> <result column="author" property="author"/>
<result column="release_time" property="releaseTime"/> <result column="release_time" property="releaseTime"/>
<result column="content" property="content"/> <result column="content" property="content"/>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, logo_path, number, file_name, type_one, type_two, author, release_time, id, logo_path, number, file_name, type_one, type_two,type_three, author, release_time,
content, link_url, key_words, is_top, state, create_time, create_by_id, content, link_url, key_words, is_top, state, create_time, create_by_id,
create_by_name, update_time, update_by_id, update_by_name, site_id create_by_name, update_time, update_by_id, update_by_name, site_id
</sql> </sql>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.site.application.mapper.PublicationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.site.application.domain.Publication">
<id column="id" property="id"/>
<result column="logo_path" property="logoPath"/>
<result column="number" property="number"/>
<result column="file_name" property="fileName"/>
<result column="type_one" property="typeOne"/>
<result column="type_two" property="typeTwo"/>
<result column="type_three" property="typeThree"/>
<result column="author" property="author"/>
<result column="release_time" property="releaseTime"/>
<result column="submit_time" property="submitTime"/>
<result column="content" property="content"/>
<result column="link_url" property="linkUrl"/>
<result column="dept_name" property="deptName"/>
<result column="approve_time" property="approveTime"/>
<result column="approve_by_id" property="approveById"/>
<result column="state" property="state"/>
<result column="oss_url" property="ossUrl"/>
<result column="create_time" property="createTime"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="update_time" property="updateTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="site_id" property="siteId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, logo_path, number, file_name, type_one, type_two,type_three, author, release_time,
content, link_url,state, create_time, create_by_id,dept_name,oss_url,
create_by_name, update_time, update_by_id, update_by_name, site_id,approve_time,approve_by_id
</sql>
<select id="selectAnnouncement" resultType="com.yizhi.site.application.vo.site.AnnouncementVO">
select a.id, a.file_name AS fileName from publication a where 1=1 and
a.state=2 and a.site_id=#{siteId} and a.type_one in (select id from data_classification
where name=#{name} and site_id=#{siteId})
</select>
<select id="publicationFirstList" resultType="com.yizhi.site.application.domain.Publication">
select a.* from publication a where 1=1 and a.site_id=#{siteId} and a.type_one=#{typeId}
<if test="fileName != null and fileName != ''">
and a.file_name like CONCAT('%', '${fileName}', '%' )
</if>
<if test="start != null">
and a.release_time >= #{start}
</if>
<if test="end != null">
and #{end} >= a.release_time
</if>
<if test="null != state">
and a.state = #{state}
</if>
order by a.submit_time DESC
</select>
<select id="publicationTwoList" resultType="com.yizhi.site.application.domain.Publication">
<!-- select a.* from publication a left join data_classification b on a.type_two=b.id
where 1=1 and a.site_id=#{siteId} and b.site_id=#{siteId} and b.name=#{name} -->
select a.* from publication a where 1=1 and a.site_id=#{siteId} and a.type_two=#{typeId}
<if test="fileName != null and fileName != ''">
and a.file_name like CONCAT('%', '${fileName}', '%' )
</if>
<if test="start != null">
and a.release_time >= #{start}
</if>
<if test="end != null">
and #{end} >= a.release_time
</if>
order by a.submit_time DESC
</select>
<select id="publicationPageList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.content as content,
a.file_Name AS fileName,
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.site_id = #{siteId}
and a.state=2
and c.name=#{typeName}
and a.type_one=#{typeOne}
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="publicationPageListV2" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.content as content,
a.file_Name AS fileName,
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.site_id = #{siteId}
and a.state=2
and c.name=#{typeName}
and a.type_one=#{typeOne}
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="publicationPageOtherList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.file_Name AS fileName,
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_two = c.id
WHERE
a.site_id = #{siteId} and a.state=2 and a.type_one=#{typeOne} and a.type_two=#{typeTwo}
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="selectpublicationVO" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
select publication.id as id,publication.logo_path as logoPath,
publication.file_Name as fileName,publication.type_one as typeOne,
publication.release_time as releaseTime,publication.link_url as linkUrl,
readNumber.number as number
from publication as publication
inner join tr_publication_read_number as readNumber
on readNumber.publication_id=publication.id
where publication.site_id=#{siteId} and publication.state=#{state}
and publication.type_one=#{typeOne}
order by publication.release_time desc,
publication.submit_time DESC
</select>
<select id="searchpublication" parameterType="com.yizhi.site.application.domain.Publication" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from publication where 1=1 and site_id=#{siteId} and state=#{state}
<if test="fileName != null || fileName != ''">
and file_name like CONCAT('%', '${fileName}', '%' )
</if>
</select>
<select id="querypublicationByTypeTwo" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
publication i
WHERE
i.state != 0
AND i.type_two = #{id}
</select>
<select id="getRelationAnnouncementPC" resultType="com.yizhi.site.application.domain.Publication">
SELECT a.id AS id,a.file_name AS fileName,a.release_time AS releaseTime FROM tr_portal_home c LEFT JOIN tr_home_announcement b ON b.home_id=c.id LEFT JOIN publication a ON a.id=b.`publication_id` WHERE c.terminal_id=#{terminalId} and b.state=1 AND a.state=2 order by b.sort
</select>
<select id="publicationPcPageList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.file_Name AS fileName,
<!-- a.content as content, -->
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.site_id = #{siteId}
and a.state=2
<!-- and c.name=#{typeName} -->
<if test="typeOne != null and typeOne != 0">
and a.type_one=#{typeOne}
</if>
<!--and a.type_two in-->
<!--<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">-->
<!--#{item}-->
<!--</foreach>-->
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="publicationClassifyPcPageList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
<!-- a.content as content, -->
a.file_Name AS fileName,
a.type_one AS typeOne,
a.type_two AS typeTwo,
a.type_three AS typeThree,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.site_id = #{siteId}
and a.state=2
<!-- and c.name=#{typeName} -->
<if test="level == null or level == 1">
and a.type_one=#{typeTwo}
</if>
<if test="level != null and level == 2">
and a.type_two=#{typeTwo}
</if>
<if test="level != null and level == 3">
and a.type_three=#{typeTwo}
</if>
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="publicationRelationGetpublicationIds" resultType="java.lang.Long">
SELECT
b.id
FROM
`tr_portal_home` a
LEFT JOIN `tr_portal_template` b
ON a.id = b.home_id
WHERE terminal_id = #{terminalId}
AND b.`module_type` = 5 AND b.state=1
</select>
<select id="getRelationpublicationIds" resultType="java.lang.Long">
select link_content from tr_protal_plate where template_id=#{templateId} and state=1
</select>
<select id="getType" resultType="java.lang.String">
SELECT
CASE WHEN b.`name` = "新闻" THEN "news"
WHEN b.`name` = "公告" THEN "notices"
END AS typeName
FROM
publication a
LEFT JOIN data_classification b ON b.id = a.type_one
WHERE a.id = #{id}
AND a.site_id = #{siteId}
</select>
<select id="selectRelationIds" resultType="java.lang.Long">
SELECT
p.link_content
FROM
`tr_portal_template` b
LEFT JOIN `tr_portal_home` a ON a.id = b.home_id
LEFT JOIN tr_protal_plate p ON b.id = p.template_id
WHERE
terminal_id = #{terminalId}
AND p.link_content IS NOT NULL
AND b.`module_type` = 5
AND b.state = 1 AND p.state =1
</select>
<select id="publicationTopList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.content as content,
a.file_Name AS fileName,
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.state=2
and a.site_id = #{siteId}
and c.name=#{typeName}
and a.type_one=#{typeOne}
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
<select id="publicationIndexTopList" resultType="com.yizhi.site.application.vo.site.PublicationStudentVO">
SELECT
c. NAME AS NAME,
a.id AS id,
a.file_Name AS fileName,
a.type_one AS typeOne,
a.release_time AS releaseTime,
a.link_url AS linkUrl,
a.logo_path as logoPath,
(
SELECT
COUNT(1)
FROM
tr_publication_read_number rn
WHERE
rn.publication_id = a.id
) number,
a.author,
a.info_source
FROM
publication AS a
LEFT JOIN data_classification c ON a.type_one = c.id
WHERE
a.state=2
and a.site_id = #{siteId}
ORDER BY
a.release_time DESC,
a.submit_time DESC,
a.id
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment