前台页面功能接口增加完善

master
rong.liu 2 years ago
parent dbc5e46f7e
commit 062509c54e
  1. 68
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  2. 6
      src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java
  3. 35
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  4. 5
      src/main/java/com/huoran/iasf/entity/SysContent.java
  5. 4
      src/main/java/com/huoran/iasf/entity/SysContentClassification.java
  6. 20
      src/main/java/com/huoran/iasf/entity/SysTemplateStyleConfiguration.java
  7. 5
      src/main/java/com/huoran/iasf/mapper/SysContentFileMapper.java
  8. 5
      src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
  9. 9
      src/main/java/com/huoran/iasf/mapper/xml/SysContentFileMapper.xml
  10. 38
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  11. 4
      src/main/java/com/huoran/iasf/service/SysColumnService.java
  12. 3
      src/main/java/com/huoran/iasf/service/SysContentFileService.java
  13. 2
      src/main/java/com/huoran/iasf/service/SysContentService.java
  14. 5
      src/main/java/com/huoran/iasf/service/impl/SysContentFileServiceImpl.java
  15. 16
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java
  16. 8
      src/main/java/com/huoran/iasf/vo/req/PageContentReqVO.java
  17. 81
      src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java

@ -6,7 +6,8 @@ import com.huoran.iasf.common.utils.Constant;
import com.huoran.iasf.entity.ColumnEntity;
import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.entity.SysContent;
import com.huoran.iasf.service.SysContentService;
import com.huoran.iasf.entity.SysTemplateStyle;
import com.huoran.iasf.service.*;
import com.huoran.iasf.vo.req.ColumnWeightReqVO;
import com.huoran.iasf.vo.req.PaginationColumnReqVO;
import com.huoran.iasf.vo.resp.SortColumnRespVO;
@ -22,12 +23,13 @@ import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.ApiOperation;
import com.huoran.iasf.service.SysColumnService;
import javax.validation.Valid;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
@ -46,6 +48,13 @@ public class SysColumnController {
@Autowired
public SysContentService contentService;
@Autowired
public SysTemplateService templateService;
@Autowired
public SysTemplateStyleService styleService;
@Autowired
public SysTemplateStyleConfigurationService templateStyleConfigurationService;
@PostMapping("/listWithTree")
@ApiOperation(value = "栏目树结构", response = SysColumn.class)
@ -64,6 +73,12 @@ public class SysColumnController {
@ApiOperation(value = "查询详情", response = SysColumn.class)
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) {
SysColumn sysColumn = service.getById(id);
SysTemplateStyle sysTemplateStyle = styleService.getById(sysColumn.getListStyleId());
if (sysTemplateStyle.getPath() != null) {
sysColumn.setPath(sysTemplateStyle.getPath());
}
return R.success(sysColumn);
}
@ -74,7 +89,7 @@ public class SysColumnController {
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>();
queryWrapper.eq("father_id", sysColumn.getFatherId());
Integer count = service.count(queryWrapper);
sysColumn.setSort(count+1);
sysColumn.setSort(count + 1);
boolean addState = service.save(sysColumn);
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败");
}
@ -124,18 +139,6 @@ public class SysColumnController {
SysColumn sysColumn = new SysColumn();
BeanUtils.copyProperties(sort, sysColumn);
service.updateById(sysColumn);
//依据当前循环获取的栏目id,查询到引用当前栏目的文章对其进行修改栏目id
/*QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("column_id", sysColumn.getId());
List<SysContent> contentList = contentService.list(queryWrapper);
if (contentList.size() > 0) {
for (SysContent content : contentList) {
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("column_id", sysColumn.getId());
contentService.update(content, updateWrapper);
}
}*/
}
return R.success();
@ -145,6 +148,14 @@ public class SysColumnController {
@PostMapping("/getsTheSubColumn")
public R getsTheSubColumn(Integer id) {
String ids = this.getIds(id);
return service.getsTheSubColumn(id, ids);
}
public String getIds(Integer id) {
//1 创建list集合,用于封装所有删除菜单id值
List<Integer> idList = new ArrayList<>();
//2 向idList集合设置删除菜单id
@ -156,9 +167,7 @@ public class SysColumnController {
str += idstr + ",";
}
String ids = str.substring(0, str.length() - 1);
return service.getsTheSubColumn(id, ids);
return ids;
}
public void selectCategoryChildById(String id, List<Integer> idList) {
@ -178,5 +187,28 @@ public class SysColumnController {
}
@ApiOperation("获取一级下的子级栏目以及下的全部文章标签")
@PostMapping("/getTheFullArticleByColumn")
public R getTheFullArticleByColumn(@ApiParam(name = "id", value = "一级栏目id", required = true) @RequestParam Integer id) {
String ids = this.getIds(id);
return contentService.getTheFullArticleByColumn(ids);
}
@ApiOperation("获取子级栏目id")
@PostMapping("/getsTheChildColumnId")
public R getsTheSublevelColumnIdOfTheNextLevel(@ApiParam(name = "id", value = "一级栏目id", required = true) @RequestParam Integer id) {
//1 创建list集合,用于封装所有删除菜单id值
List<Integer> idList = new ArrayList<>();
//2 向idList集合设置删除菜单id
this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去
//把当前id封装到list里面
idList.add(id);//现在把当前id封装进去 之前都是子菜单的id
return R.success(idList);
}
}

@ -38,8 +38,10 @@ public class SysContentClassificationController {
@PostMapping("/allTheQuery")
@ApiOperation(value = "查询全部文章所属分类", response = SysContentClassification.class)
public R allTheQuery(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) {
List<SysContentClassification> list = service.list(new QueryWrapper<SysContentClassification>().eq("site_id", siteId));
public R allTheQuery(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId,
@ApiParam(name = "templateId", value = "模板id", required = true) @RequestParam Integer templateId) {
List<SysContentClassification> list = service.list(new QueryWrapper<SysContentClassification>()
.eq("site_id", siteId).eq("template_id",templateId));
return R.success(list);
}

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.entity.SysContentFile;
import com.huoran.iasf.service.SysColumnService;
import com.huoran.iasf.service.SysContentFileService;
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO;
import com.huoran.iasf.vo.req.ContentReq;
import com.huoran.iasf.vo.req.PageContentReqVO;
@ -44,6 +45,10 @@ public class SysContentController {
@Autowired
public SysColumnService columnService;
@Autowired
public SysContentFileService fileService;
@PostMapping("/pagingQuery")
@ApiOperation(value = "分页查询", response = PageContentRespVO.class)
public R pagingQuery(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) PageContentReqVO sysContent) {
@ -51,19 +56,17 @@ public class SysContentController {
}
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = SysContent.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
SysContent sysContent = service.getById(id);
SysColumn sysColumn = columnService.getById(sysContent.getColumnId());
if (sysColumn.getColumnName()!=null){
if (sysColumn.getColumnName() != null) {
sysContent.setColumnName(sysColumn.getColumnName());
}
List<SysContentFile> fileList = fileService.getFileByContentId(id);
sysContent.setFileList(fileList);
return R.success(sysContent);
}
@ -92,7 +95,6 @@ public class SysContentController {
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除文章", response = SysContent.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
@ -123,30 +125,29 @@ public class SysContentController {
/**
* 获取栏目下的文章
*
* @param pageReq
* @return
*/
@PostMapping("/getColumnArticles")
@ApiOperation(value = "获取栏目下的文章",response = SysContent.class)
@ApiOperation(value = "获取栏目下的文章", response = SysContent.class)
public R getColumnArticles(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) ContentReq pageReq) {
IPage page = new Page(pageReq.getPageNum(), pageReq.getPageSize());
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.in("column_id",pageReq.getColumnIds());
IPage<SysContent> iPage = service.page(page,queryWrapper);
queryWrapper.in("column_id", pageReq.getColumnIds());
IPage<SysContent> iPage = service.page(page, queryWrapper);
return R.success(iPage);
}
@PostMapping("/articleEnableOrDisable")
@ApiOperation(value = "文章启用禁用",response = SysContent.class)
public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id,
@ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
@ApiOperation(value = "文章启用禁用", response = SysContent.class)
public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("is_disable",isDisable);
updateWrapper.eq("id",id);
boolean ret = service.update(updateWrapper);
return ret?R.success():R.fail("禁用/启用失败");
updateWrapper.set("is_disable", isDisable);
updateWrapper.eq("id", id);
boolean ret = service.update(updateWrapper);
return ret ? R.success() : R.fail("禁用/启用失败");
}
}

@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -154,4 +155,8 @@ public class SysContent implements Serializable {
@ApiModelProperty(value = "栏目名称")
@TableField(exist = false)
private String columnName;
@ApiModelProperty(value = "文章附件")
@TableField(exist = false)
List<SysContentFile> fileList;
}

@ -53,5 +53,9 @@ public class SysContentClassification implements Serializable {
@NotNull(message = "站点id不能为空!")
private Integer siteId;
@ApiModelProperty(value = "模板id(用于区分哪个模板下的分类)")
@NotNull(message = "模板id不能为空!")
private Integer templateId;
}

@ -2,7 +2,9 @@ package com.huoran.iasf.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -17,21 +19,21 @@ import lombok.EqualsAndHashCode;
* @since 2022-11-24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="SysTemplateStyleConfiguration对象", description="栏目样式、列表样式、详情样式配置表")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "SysTemplateStyleConfiguration对象", description = "栏目样式、列表样式、详情样式配置表")
public class SysTemplateStyleConfiguration implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "栏目id")
private Integer templateId;
@ApiModelProperty(value = "模板id")
private Integer templateId;
@ApiModelProperty(value = "样式id")
private Integer styleId;
@ApiModelProperty(value = "样式id")
private Integer styleId;
}

@ -3,6 +3,9 @@ package com.huoran.iasf.mapper;
import com.huoran.iasf.entity.SysContentFile;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @描述文章附件管理表 Mapper 接口
@ -11,5 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
@Mapper
public interface SysContentFileMapper extends BaseMapper<SysContentFile> {
List<SysContentFile> getFileByContentId(@Param("contentId") Integer contentId);
}

@ -2,7 +2,10 @@ package com.huoran.iasf.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysContent;
import com.huoran.iasf.entity.SysContentClassification;
import com.huoran.iasf.entity.SysContentLabel;
import com.huoran.iasf.vo.req.PageContentReqVO;
import com.huoran.iasf.vo.resp.PageContentRespVO;
import org.apache.ibatis.annotations.Mapper;
@ -21,4 +24,6 @@ public interface SysContentMapper extends BaseMapper<SysContent> {
IPage<PageContentRespVO> articlePaginationList(Page<PageContentRespVO> page, @Param("req") PageContentReqVO req);
IPage<PageContentRespVO> getPublishedArticles(Page<PageContentRespVO> page, @Param("req") PageContentReqVO req);
List<SysContentClassification> useTheColumnToGetTagsForTheFullArticle(String ids);
}

@ -16,5 +16,14 @@
<result column="create_time" property="createTime"/>
<result column="deleted" property="deleted"/>
</resultMap>
<select id="getFileByContentId" resultType="com.huoran.iasf.entity.SysContentFile">
SELECT
*
FROM
sys_content_file
WHERE
deleted = 1
AND content_id = #{contentId}
</select>
</mapper>

@ -39,9 +39,11 @@
ORDER BY c.create_time desc
</select>
<select id="getPublishedArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT
t.*
t.*,(SELECT cl.list_style_id from sys_column cl WHERE cl.id = t.column_id) as listStyleId
FROM
(
SELECT
@ -58,8 +60,13 @@
) t
WHERE
t.site_id = 1
<if test="req.lableId != null and req.lableId != ''">
AND FIND_IN_SET( #{req.lableId}, t.lable_id )
<if test="req.labelName != null and req.labelName.size() > 0 ">
and
<foreach collection="req.labelName" item="item" index="index" open="(" separator="or" close=")">
t.labelName LIKE CONCAT('%',#{item},'%')
</foreach>
</if>
<if test="req.classificationId != null">
@ -79,9 +86,34 @@
#{item}
</foreach>
</if>
<if test="req.convokeType == 2">
and unix_timestamp(activity_start_time) <![CDATA[ >= ]]> unix_timestamp(NOW())
</if>
<if test="req.convokeType == 1">
and unix_timestamp(activity_start_time) <![CDATA[ <= ]]> unix_timestamp(NOW())
</if>
ORDER BY
t.create_time DESC
</select>
<select id="useTheColumnToGetTagsForTheFullArticle" resultType="com.huoran.iasf.entity.SysContentClassification">
SELECT *
FROM sys_content_classification c
WHERE c.deleted = 1
AND FIND_IN_SET(
c.id,
(SELECT GROUP_CONCAT(s.classification_id)
FROM sys_content s
INNER JOIN sys_content_classification c ON c.id = s.classification_id
WHERE s.deleted = 1
AND c.deleted = 1
AND FIND_IN_SET(s.column_id, #{ids}))
)
</select>
</mapper>

@ -32,4 +32,8 @@ public interface SysColumnService extends IService<SysColumn> {
R getsTheSubColumn(Integer parentId,String ids);
}

@ -3,6 +3,8 @@ package com.huoran.iasf.service;
import com.huoran.iasf.entity.SysContentFile;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @描述文章附件管理表 service接口
* @作者: Rong
@ -10,5 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SysContentFileService extends IService<SysContentFile> {
List<SysContentFile> getFileByContentId(Integer contentId);
}

@ -22,4 +22,6 @@ public interface SysContentService extends IService<SysContent> {
//查询已发布的、启用了的文章列表
R publishedEnabledArticles();
R getTheFullArticleByColumn(String ids);
}

@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.List;
/**
* @描述文章附件管理表 服务类
@ -20,6 +21,10 @@ public class SysContentFileServiceImpl extends ServiceImpl<SysContentFileMapper,
@Autowired
private SysContentFileMapper mapper;
@Override
public List<SysContentFile> getFileByContentId(Integer contentId) {
return baseMapper.getFileByContentId(contentId);
}
}

@ -15,7 +15,7 @@ import com.huoran.iasf.vo.resp.PageContentRespVO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.*;
/**
* @描述文章管理 服务类
@ -62,7 +62,7 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
queryWrapper.eq("site_id", reqVO.getSiteId());
queryWrapper.eq("is_release", Constant.ARTICLE_PUBLISHED).orderByDesc("create_time");*/
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize());
IPage<PageContentRespVO> pageList = baseMapper.getPublishedArticles(page,reqVO);
IPage<PageContentRespVO> pageList = baseMapper.getPublishedArticles(page, reqVO);
return R.success(pageList);
}
@ -71,13 +71,23 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
//查询已发布的、启用了的文章列表接
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_release", Constant.ARTICLE_PUBLISHED);
queryWrapper.eq("template_status",Constant.TEMPLATE_STATUS_ENABLED);
queryWrapper.eq("template_status", Constant.TEMPLATE_STATUS_ENABLED);
List<SysContent> sysContentList = mapper.selectList(queryWrapper);
return R.success(sysContentList);
}
@Override
public R getTheFullArticleByColumn(String ids) {
return R.success(mapper.useTheColumnToGetTagsForTheFullArticle(ids));
}
}

@ -41,4 +41,12 @@ public class PageContentReqVO extends PageReqVO {
@ApiModelProperty(value = "分类id")
private Integer classificationId;
@ApiModelProperty(value = "标签名称")
private List<String> labelName;
@ApiModelProperty(value = "召开类型(1.即将召开 2.已经召开)")
private Integer convokeType;
}

@ -103,4 +103,85 @@ public class PageContentRespVO {
@ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)")
private String classificationName;
@ApiModelProperty(value = "创建人id")
private Integer founderId;
@ApiModelProperty(value = "编辑人id")
private Integer editorId;
@ApiModelProperty(value = "是否在新窗口打开(0:否 1:是)")
private Integer isOpen;
@ApiModelProperty(value = "是否删除(1未删除;0已删除)")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "站点id")
private Integer siteId;
@ApiModelProperty(value = "模板状态(0禁用;1启用)")
private Integer templateStatus;
@ApiModelProperty(value = "链接类型")
private Integer connectionType;
@ApiModelProperty(value = "链接地址")
private String linkAddress;
@ApiModelProperty(value = "站点选择(连接类型为其它站点连接时储存)")
private Integer siteSelection;
@ApiModelProperty(value = "编辑人")
private String edit;
@ApiModelProperty(value = "审核人")
private String audit;
@ApiModelProperty(value = "活动开始时间")
private Date activityStartTime;
@ApiModelProperty(value = "活动结束时间")
private Date activityEndTime;
@ApiModelProperty(value = "演讲系列")
private String lectureSeries;
@ApiModelProperty(value = "线上地点")
private String onlineLocation;
@ApiModelProperty(value = "线下地点")
private String offlineLocation;
@ApiModelProperty(value = "主讲人")
private String keynoteSpeaker;
@ApiModelProperty(value = "活动简介")
private String eventProfile;
@ApiModelProperty(value = "出版年份")
private String publicationYear;
@ApiModelProperty(value = "出版类型(前端自定义)")
private Integer publicationTypeId;
@ApiModelProperty(value = "DOI")
private String doi;
@ApiModelProperty(value = "引用")
private String quote;
@ApiModelProperty(value = "主题标签(sys_content_label表外键) 可多选逗号隔开")
private String lableId;
@ApiModelProperty(value = "所属分类(sys_content_classification表外键)")
private Integer classificationId;
@ApiModelProperty(value = "样式id(用于前端区分是会议还是文章跳转界面)")
private Integer listStyleId;
}
Loading…
Cancel
Save