Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/huoran/iasf/vo/req/PageContentReqVO.java
master
cheney 2 years ago
commit b6b94646f3
  1. 1
      src/main/java/com/huoran/iasf/common/shiro/ShiroConfig.java
  2. 20
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  3. 133
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  4. 19
      src/main/java/com/huoran/iasf/entity/SysContent.java
  5. 8
      src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
  6. 16
      src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml
  7. 103
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  8. 7
      src/main/java/com/huoran/iasf/service/SysContentService.java
  9. 82
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java
  10. 16
      src/main/java/com/huoran/iasf/vo/req/ArticleModifiedSortReq.java
  11. 20
      src/main/java/com/huoran/iasf/vo/req/PageContentReqVO.java
  12. 8
      src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java

@ -180,6 +180,5 @@ public class ShiroConfig {
return authorizationAttributeSourceAdvisor; return authorizationAttributeSourceAdvisor;
} }
} }

@ -102,14 +102,15 @@ public class SysColumnController {
boolean updateState = service.updateById(sysColumn); boolean updateState = service.updateById(sysColumn);
return updateState ? R.success() : R.fail("编辑失败"); return updateState ? R.success() : R.fail("编辑失败");
} }
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation(value = "删除", response = SysContent.class) @ApiOperation(value = "删除", response = SysContent.class)
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
UpdateWrapper<SysFilesEntity> filesEntityUpdateWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> filesEntityUpdateWrapper = new UpdateWrapper<>();
filesEntityUpdateWrapper.eq("quote_id",id); filesEntityUpdateWrapper.eq("quote_id", id);
filesEntityUpdateWrapper.eq("quote_type",1); filesEntityUpdateWrapper.eq("quote_type", 1);
filesEntityUpdateWrapper.set("is_del",1); filesEntityUpdateWrapper.set("is_del", 1);
sysFilesService.update(filesEntityUpdateWrapper); sysFilesService.update(filesEntityUpdateWrapper);
boolean delState = service.removeById(id); boolean delState = service.removeById(id);
@ -122,15 +123,16 @@ public class SysColumnController {
return delState ? R.success() : R.fail("删除失败"); return delState ? R.success() : R.fail("删除失败");
} }
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/batchDeletion") @PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除栏目", response = SysColumn.class) @ApiOperation(value = "批量删除栏目", response = SysColumn.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) { public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
UpdateWrapper<SysFilesEntity> filesEntityUpdateWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> filesEntityUpdateWrapper = new UpdateWrapper<>();
filesEntityUpdateWrapper.eq("quote_id",id); filesEntityUpdateWrapper.eq("quote_id", id);
filesEntityUpdateWrapper.eq("quote_type",1); filesEntityUpdateWrapper.eq("quote_type", 1);
filesEntityUpdateWrapper.set("is_del",1); filesEntityUpdateWrapper.set("is_del", 1);
sysFilesService.update(filesEntityUpdateWrapper); sysFilesService.update(filesEntityUpdateWrapper);
} }
@ -238,12 +240,14 @@ public class SysColumnController {
Integer pid = service.oneLevelChecksThemAll(id); Integer pid = service.oneLevelChecksThemAll(id);
String ids = this.getIds(pid); String ids = this.getIds(pid);
return service.getSubColumn(pid, ids,isSort); return service.getSubColumn(pid, ids, isSort);
} }
/** /**
* 查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章反之查询选中栏目下的文章) * 查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章反之查询选中栏目下的文章)
* 2023.02.22依需求更改为以发布时间排序(非创建时间)
*
* @param columnId * @param columnId
* @return * @return
*/ */
@ -251,7 +255,7 @@ public class SysColumnController {
@PostMapping("/queryArticlesByColumnType") @PostMapping("/queryArticlesByColumnType")
public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) {
String ids = this.getIds(columnId); String ids = this.getIds(columnId);
return service.queryArticlesByColumnType(ids,columnId); return service.queryArticlesByColumnType(ids, columnId);
} }
} }

@ -3,13 +3,16 @@ package com.huoran.iasf.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.entity.SysContentFile; import com.huoran.iasf.entity.SysContentFile;
import com.huoran.iasf.entity.SysFilesEntity; import com.huoran.iasf.entity.SysFilesEntity;
import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.service.SysColumnService;
import com.huoran.iasf.service.SysContentFileService; import com.huoran.iasf.service.SysContentFileService;
import com.huoran.iasf.service.SysFilesService; import com.huoran.iasf.service.SysFilesService;
import com.huoran.iasf.vo.req.ArticleModifiedSortReq;
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO;
import com.huoran.iasf.vo.req.ContentReq; import com.huoran.iasf.vo.req.ContentReq;
import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.req.PageContentReqVO;
@ -30,7 +33,9 @@ import com.huoran.iasf.service.SysContentService;
import com.huoran.iasf.entity.SysContent; import com.huoran.iasf.entity.SysContent;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
@ -55,7 +60,6 @@ public class SysContentController {
public SysFilesService sysFilesService; public SysFilesService sysFilesService;
@PostMapping("/pagingQuery") @PostMapping("/pagingQuery")
@ApiOperation(value = "分页查询文章列表", response = PageContentRespVO.class) @ApiOperation(value = "分页查询文章列表", response = PageContentRespVO.class)
public R pagingQuery(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) PageContentReqVO sysContent) { public R pagingQuery(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) PageContentReqVO sysContent) {
@ -81,7 +85,15 @@ public class SysContentController {
@PostMapping("/save") @PostMapping("/save")
@ApiOperation(value = "新增", response = SysContent.class) @ApiOperation(value = "新增", response = SysContent.class)
public R save(@RequestBody @Valid @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { public R save(@RequestBody @Valid @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) {
QueryWrapper<SysContent> queryWrap = new QueryWrapper<>();
queryWrap.eq("column_id", sysContent.getColumnId());
queryWrap.eq("deleted", 1);
Integer count = service.count(queryWrap);
sysContent.setSequence(count++);
boolean addState = service.save(sysContent); boolean addState = service.save(sysContent);
return addState ? R.success(sysContent.getId()) : R.fail("新增失败"); return addState ? R.success(sysContent.getId()) : R.fail("新增失败");
} }
@ -98,9 +110,9 @@ public class SysContentController {
@ApiOperation(value = "删除", response = SysContent.class) @ApiOperation(value = "删除", response = SysContent.class)
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>();
queryWrapper.eq("quote_id",id); queryWrapper.eq("quote_id", id);
queryWrapper.eq("quote_type",0); queryWrapper.eq("quote_type", 0);
queryWrapper.set("is_del",1); queryWrapper.set("is_del", 1);
sysFilesService.update(queryWrapper); sysFilesService.update(queryWrapper);
boolean delState = service.removeById(id); boolean delState = service.removeById(id);
return delState ? R.success() : R.fail("删除失败"); return delState ? R.success() : R.fail("删除失败");
@ -112,9 +124,9 @@ public class SysContentController {
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) { public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>();
queryWrapper.eq("quote_id",id); queryWrapper.eq("quote_id", id);
queryWrapper.eq("quote_type",0); queryWrapper.eq("quote_type", 0);
queryWrapper.set("is_del",1); queryWrapper.set("is_del", 1);
sysFilesService.update(queryWrapper); sysFilesService.update(queryWrapper);
} }
boolean delState = service.removeByIds(ids); boolean delState = service.removeByIds(ids);
@ -190,5 +202,110 @@ public class SysContentController {
return service.siteSearchArticles(req); return service.siteSearchArticles(req);
} }
/*@PostMapping("/modifiedSort")
@ApiOperation(value = "修改排序", response = SysContent.class)
public R modifiedSort(
@ApiParam(name = "sequenceNumber", value = "要排序的序号", required = true) @RequestParam Integer sequenceNumber,
@ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) {
if (sequenceNumber<=0){
return R.fail("请输入正确的序号!");
}
SysContent content = service.getById(articleId);
//获取当前排序的序号
Integer currentSerialNumber = content.getSequence();
//获取当前文章所属栏目id
Integer columnId = content.getColumnId();
//获取当前栏目下的全部文章
*//*QueryWrapper<SysContent> queryWrap = new QueryWrapper<>();
queryWrap.eq("column_id", columnId);
queryWrap.eq("deleted", 1);
List<SysContent> contentList = service.list(queryWrap);*//*
//判断排序是值改小还是改大,大改小比如53改5那就加一个语句“大于等于5并且小于53”
//如果是小改大比如3改50那就是“大于3并且小于等于50”
//改小那就是拿到的数据都减一,改大那就是加一
//对剩余的
UpdateWrapper<SysContent> updateWrapper1 = new UpdateWrapper<>();
updateWrapper1.ne("id",articleId);
if (currentSerialNumber >= sequenceNumber) {
//改小
updateWrapper1.setSql(" sequence = sequence + 1");
} else if (currentSerialNumber <= sequenceNumber) {
//改大
updateWrapper1.setSql(" sequence = sequence - 1");
}
updateWrapper1.eq("column_id",columnId);
updateWrapper1.eq("deleted", 1);
service.update(new SysContent(),updateWrapper1);
//修改当前序号
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("sequence",sequenceNumber);
updateWrapper.eq("id",articleId);
service.update(new SysContent(),updateWrapper);
return R.success();
}*/
@PostMapping("/modifiedSort")
@ApiOperation(value = "修改排序", response = SysContent.class)
public R modifiedSort(
@ApiParam(name = "sequenceNumber", value = "要排序的序号", required = true) @RequestParam Integer sequenceNumber,
@ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) {
return service.modifiedSort(sequenceNumber, articleId);
}
@PostMapping("/modifiedArticleSort")
@ApiOperation(value = "修改文章排序", response = SysContent.class)
public R modifiedSort(@RequestBody List<ArticleModifiedSortReq> reqList) {
return service.modifiedSort(reqList);
}
@PostMapping("/sort")
@ApiOperation(value = "排序(自设置排序号) 上线后注释", response = SysContent.class)
public R sort() {
//获取当前栏目
QueryWrapper<SysContent> queryWrap = new QueryWrapper<>();
queryWrap.eq("deleted", 1);
queryWrap.groupBy("column_id");
queryWrap.orderByAsc("sequence");
List<SysContent> columnList = service.list(queryWrap);
for (SysContent content : columnList) {
Integer columnId = content.getColumnId();
QueryWrapper<SysContent> queryWrap1 = new QueryWrapper<>();
queryWrap1.eq("column_id", columnId);
queryWrap1.eq("deleted", 1);
List<SysContent> list = service.list(queryWrap1);
Integer count = 0;
for (SysContent c : list) {
++count;
c.setSequence(count);
service.updateById(c);
}
}
return R.success();
}
} }

@ -37,7 +37,7 @@ public class SysContent implements Serializable {
private Integer columnId; private Integer columnId;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
private Date releaseTime; private String releaseTime;
@ApiModelProperty(value = "来源") @ApiModelProperty(value = "来源")
private String source; private String source;
@ -159,4 +159,21 @@ public class SysContent implements Serializable {
@ApiModelProperty(value = "文章附件") @ApiModelProperty(value = "文章附件")
@TableField(exist = false) @TableField(exist = false)
List<SysContentFile> fileList; List<SysContentFile> fileList;
@ApiModelProperty(value = "刊物名称")
private String periodicalName;
@ApiModelProperty(value = "卷")
private String reel;
@ApiModelProperty(value = "文献号")
private String documentNumber;
@ApiModelProperty(value = "文章关键字")
private String articleKeyWord;
@ApiModelProperty(value = "顺序(排序号)")
private Integer sequence;
} }

@ -31,4 +31,12 @@ public interface SysContentMapper extends BaseMapper<SysContent> {
List<PageContentRespVO> columnConditionsFilterArticles(@Param("columnId")String columnId); List<PageContentRespVO> columnConditionsFilterArticles(@Param("columnId")String columnId);
/*Integer selectNextId(@Param("content")SysContent sysContent);
Integer updateSortById(@Param("content")SysContent sysContent);
Integer selectPreviousId(@Param("content")SysContent sysContent);*/
} }

@ -33,8 +33,8 @@
<select id="filter" resultType="com.huoran.iasf.entity.SysColumn"> <select id="filter" resultType="com.huoran.iasf.entity.SysColumn">
SELECT SELECT
*, *,
( SELECT u.username FROM sys_user u WHERE u.id = s.founder_id ) AS creteUser, ( SELECT u.real_name FROM sys_user u WHERE u.id = s.founder_id ) AS creteUser,
( SELECT u.username FROM sys_user u WHERE u.id = s.editor_id ) AS editorUser, ( SELECT u.real_name FROM sys_user u WHERE u.id = s.editor_id ) AS editorUser,
( SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id ) AS templateName, ( SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id ) AS templateName,
( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS listStyle, ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS listStyle,
( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle, ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle,
@ -61,8 +61,8 @@
<select id="longPageColumnList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> <select id="longPageColumnList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT (SELECT u.username FROM sys_user u WHERE u.id = c.founder_id) AS founderName, SELECT (SELECT u.real_name FROM sys_user u WHERE u.id = c.founder_id) AS founderName,
(SELECT u.username FROM sys_user u WHERE u.id = c.editor_id) AS editorName, (SELECT u.real_name FROM sys_user u WHERE u.id = c.editor_id) AS editorName,
c.* c.*
FROM sys_column c FROM sys_column c
WHERE deleted = 1 WHERE deleted = 1
@ -93,8 +93,8 @@
<select id="filterMenuVisible" resultType="com.huoran.iasf.entity.SysColumn"> <select id="filterMenuVisible" resultType="com.huoran.iasf.entity.SysColumn">
SELECT SELECT
*, *,
( SELECT u.username FROM sys_user u WHERE u.id = s.founder_id ) AS creteUser, ( SELECT u.real_name FROM sys_user u WHERE u.id = s.founder_id ) AS creteUser,
( SELECT u.username FROM sys_user u WHERE u.id = s.editor_id ) AS editorUser, ( SELECT u.real_name FROM sys_user u WHERE u.id = s.editor_id ) AS editorUser,
( SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id ) AS templateName, ( SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id ) AS templateName,
( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS listStyle, ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS listStyle,
( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle, ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle,
@ -148,8 +148,8 @@
</select>--> </select>-->
<select id="getsTheSubColumn" resultType="com.huoran.iasf.entity.SysColumn"> <select id="getsTheSubColumn" resultType="com.huoran.iasf.entity.SysColumn">
SELECT *, SELECT *,
(SELECT u.username FROM sys_user u WHERE u.id = s.founder_id) AS creteUser, (SELECT u.real_name FROM sys_user u WHERE u.id = s.founder_id) AS creteUser,
(SELECT u.username FROM sys_user u WHERE u.id = s.editor_id) AS editorUser, (SELECT u.real_name FROM sys_user u WHERE u.id = s.editor_id) AS editorUser,
(SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id) AS templateName, (SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id) AS templateName,
(SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id) AS listStyle, (SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id) AS listStyle,
(SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id) AS detailStyle, (SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id) AS detailStyle,

@ -4,9 +4,10 @@
<select id="articlePaginationList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> <select id="articlePaginationList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT c.*, SELECT c.*,
(SELECT sys_column.column_name FROM sys_column WHERE sys_column.id = c.column_id) AS columnName, (SELECT sys_column.column_name FROM sys_column WHERE sys_column.id = c.column_id) AS columnName,
(SELECT u.username FROM sys_user u WHERE u.id = c.founder_id) AS founderName, (SELECT u.real_name FROM sys_user u WHERE u.id = c.founder_id) AS founderName,
(SELECT u.username FROM sys_user u WHERE u.id = c.editor_id) AS editorName, (SELECT u.real_name FROM sys_user u WHERE u.id = c.editor_id) AS editorName,
(SELECT type_id from sys_column WHERE sys_column.id = c.column_id) as typeId (SELECT type_id from sys_column WHERE sys_column.id = c.column_id) as typeId,
IFNULL( ( SELECT c1.classification_name FROM sys_content_classification c1 WHERE c1.id = c.classification_id ), '暂无' ) AS classificationName
FROM sys_content c FROM sys_content c
WHERE c.deleted = 1 and site_id = #{req.siteId} WHERE c.deleted = 1 and site_id = #{req.siteId}
<if test="req.columnIds != null and req.columnIds.size() > 0 "> <if test="req.columnIds != null and req.columnIds.size() > 0 ">
@ -22,13 +23,13 @@
and title LIKE CONCAT('%',#{req.title},'%') and title LIKE CONCAT('%',#{req.title},'%')
</if> </if>
<if test="req.founder != null and req.founder != ''"> <if test="req.founder != null and req.founder != ''">
AND ( SELECT u.username FROM sys_user u WHERE u.id = c.founder_id ) LIKE AND ( SELECT u.real_name FROM sys_user u WHERE u.id = c.founder_id ) LIKE
CONCAT('%',#{req.founder},'%') CONCAT('%',#{req.founder},'%')
</if> </if>
<if test="req.editor != null and req.editor != ''"> <if test="req.editor != null and req.editor != ''">
AND ( SELECT u.username FROM sys_user u WHERE u.id = c.editor_id ) LIKE CONCAT('%',#{req.editor},'%') AND ( SELECT u.real_name FROM sys_user u WHERE u.id = c.editor_id ) LIKE CONCAT('%',#{req.editor},'%')
</if> </if>
<if test="req.column != null and req.column != ''"> <if test="req.column != null and req.column != ''">
@ -36,7 +37,36 @@
CONCAT('%',#{req.column},'%') CONCAT('%',#{req.column},'%')
</if> </if>
ORDER BY c.create_time desc
<if test="req.isDisable != null and req.isDisable != '' or req.isDisable==0">
AND c.is_disable = #{req.isDisable}
</if>
<if test="req.modifiedTimeSort ==0">
ORDER BY c.update_time desc
</if>
<if test="req.modifiedTimeSort ==1">
ORDER BY c.update_time asc
</if>
<if test="req.publicationTimeSort ==0">
ORDER BY c.release_time desc
</if>
<if test="req.publicationTimeSort ==1">
ORDER BY c.release_time asc
</if>
<if test="req.ordinalSort ==0">
ORDER BY sequence asc
</if>
<if test="req.ordinalSort ==1">
ORDER BY sequence desc
</if>
</select> </select>
@ -140,27 +170,50 @@
</if> </if>
</select> </select>
<select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> <select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT SELECT t.*,
t.*, (SELECT cl.list_style_id FROM sys_column cl WHERE cl.id = t.column_id) AS listStyleId
( SELECT cl.list_style_id FROM sys_column cl WHERE cl.id = t.column_id ) AS listStyleId FROM (SELECT s.*,
FROM (SELECT GROUP_CONCAT(label_name)
( FROM sys_content_label l
SELECT WHERE deleted = 1 AND FIND_IN_SET(l.id, s.lable_id)) AS labelName,
s.*, (SELECT c.classification_name
( SELECT GROUP_CONCAT( label_name ) FROM sys_content_label l WHERE deleted = 1 AND FIND_IN_SET( l.id, s.lable_id ) ) AS labelName, FROM sys_content_classification c
( SELECT c.classification_name FROM sys_content_classification c WHERE deleted = 1 AND s.classification_id = c.id ) AS classificationName WHERE deleted = 1 AND s.classification_id = c.id) AS classificationName
FROM FROM sys_content s
sys_content s WHERE s.deleted = 1
WHERE AND is_disable = 0
s.deleted = 1 AND is_release = 1) t
AND is_disable = 0 WHERE FIND_IN_SET(t.column_id, #{columnId})
AND is_release = 1
) t ORDER BY
WHERE t.sequence ASC
FIND_IN_SET( t.column_id, #{columnId} ) </select>
ORDER BY t.create_time desc <!-- &lt;!&ndash;根据 sequence 查询下一条记录主键&ndash;&gt;
<select id="selectNextId" resultType="java.lang.Integer">
SELECT
IFNULL(
( SELECT id FROM sys_content WHERE sequence &gt; #{content.sequence} AND column_id = #{content.columnId} AND deleted = 1
ORDER BY sequence ASC LIMIT 0, 1 ),
1
) AS nextTypeId
</select> </select>
&lt;!&ndash;根据主键更新排序号&ndash;&gt;
<update id="updateSortById" parameterType="java.lang.Integer" >
update sys_content
set sequence = #{content.sequence},update_time = now()
where id = #{content.id}
</update>
&lt;!&ndash;根据 sequence 查询上一条记录主键&ndash;&gt;
<select id="selectPreviousId" resultType="java.lang.Integer" >
SELECT IFNULL(
(SELECT id FROM sys_content WHERE sequence &lt; #{content.sequence} AND column_id = #{content.columnId} AND deleted = 1
ORDER BY sequence DESC LIMIT 0,1),1
) AS preTypeId
</select>-->
</mapper> </mapper>

@ -3,9 +3,12 @@ package com.huoran.iasf.service;
import com.huoran.iasf.common.utils.R; import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysContent; import com.huoran.iasf.entity.SysContent;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.iasf.vo.req.ArticleModifiedSortReq;
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO;
import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.req.PageContentReqVO;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@ -36,4 +39,8 @@ public interface SysContentService extends IService<SysContent> {
R siteSearchArticles(PageContentReqVO req); R siteSearchArticles(PageContentReqVO req);
R modifiedSort(List<ArticleModifiedSortReq> reqList);
R modifiedSort(Integer sequenceNumber, Integer articleId);
} }

@ -10,6 +10,7 @@ import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysContent; import com.huoran.iasf.entity.SysContent;
import com.huoran.iasf.mapper.SysContentMapper; import com.huoran.iasf.mapper.SysContentMapper;
import com.huoran.iasf.service.SysContentService; import com.huoran.iasf.service.SysContentService;
import com.huoran.iasf.vo.req.ArticleModifiedSortReq;
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO;
import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.req.PageContentReqVO;
import com.huoran.iasf.vo.resp.PageContentRespVO; import com.huoran.iasf.vo.resp.PageContentRespVO;
@ -44,7 +45,7 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
if (sysContent != null) { if (sysContent != null) {
if (content.getId() != null) { if (content.getId() != null) {
//判断为编辑情况下,如果编辑的id与查询出来的一致不提示 //判断为编辑情况下,如果编辑的id与查询出来的一致不提示
if (content.getId() == content.getId()) { if (content.getId().equals(content.getId())) {
return true; return true;
} }
} }
@ -57,6 +58,16 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
@Override @Override
public R articlePaginationList(PageContentReqVO reqVO) { public R articlePaginationList(PageContentReqVO reqVO) {
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize()); Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize());
/*if (reqVO.getModifiedTimeSort() == null && reqVO.getPublicationTimeSort() == null) {
reqVO.setPublicationTimeSort(0);
}*/
/*if (reqVO.getIsDisable()!=null){
if (reqVO.getIsDisable() == 1) {
//是否禁用(0默认,0启用 1禁用)
reqVO.setIsDisable(1);
}
}*/
IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO); IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO);
return R.success(pageList); return R.success(pageList);
} }
@ -126,6 +137,75 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
return R.success(pageList); return R.success(pageList);
} }
@Override
public R modifiedSort(List<ArticleModifiedSortReq> reqList) {
for (ArticleModifiedSortReq req : reqList) {
SysContent content = new SysContent();
content.setId(req.getArticleId());
content.setSequence(req.getSequence());
baseMapper.updateById(content);
}
return R.success();
}
@Override
public R modifiedSort(Integer sequenceNumber, Integer articleId) {
if (sequenceNumber <= 0) {
return R.fail("请输入正确的序号!");
}
SysContent content = baseMapper.selectById(articleId);
//获取当前排序的序号
Integer currentSerialNumber = content.getSequence();
//获取当前文章所属栏目id
Integer columnId = content.getColumnId();
//获取栏目下全部文章的数量与当前输入的序号判断 如果要更改的序号大于当前有的数量,直接替换
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("column_id", columnId);
queryWrapper.eq("deleted", 1);
List<SysContent> contentList = baseMapper.selectList(queryWrapper);
if (sequenceNumber >= contentList.size()) {
sequenceNumber = contentList.size();
}
if (currentSerialNumber.equals(sequenceNumber)) {
return R.success();
}
//修改当前序号
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("sequence", sequenceNumber);
updateWrapper.eq("id", articleId);
baseMapper.update(new SysContent(), updateWrapper);
UpdateWrapper<SysContent> updateWrapper1 = new UpdateWrapper<>();
updateWrapper1.ne("id", articleId);
// 序号越小值越算大
//currentSerialNumber 当前文章的序号
//sequenceNumber 要更改的序号
if (currentSerialNumber > sequenceNumber) {
//改大 gt >
updateWrapper1.setSql(" sequence = sequence + 1");
updateWrapper1.last(" and sequence >= " + sequenceNumber + " and sequence < " + currentSerialNumber);
} else if (currentSerialNumber < sequenceNumber) {
//改小
updateWrapper1.le("sequence", sequenceNumber);
updateWrapper1.setSql(" sequence = sequence - 1");
//用于判断序号为本身就为1时候就不减了
updateWrapper1.ne("sequence", 1);
}
updateWrapper1.eq("column_id", columnId);
updateWrapper1.eq("deleted", 1);
baseMapper.update(new SysContent(), updateWrapper1);
return R.success();
}
} }

@ -0,0 +1,16 @@
package com.huoran.iasf.vo.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
public class ArticleModifiedSortReq {
@ApiModelProperty(value = "顺序(排序号)")
private Integer sequence;
@ApiModelProperty(value = "文章id")
private Integer articleId;
}

@ -1,14 +1,10 @@
package com.huoran.iasf.vo.req; package com.huoran.iasf.vo.req;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @描述文章管理 * @描述文章管理
@ -51,7 +47,7 @@ public class PageContentReqVO extends PageReqVO {
@ApiModelProperty(value = "召开类型(1.即将召开 2.已经召开)") @ApiModelProperty(value = "召开类型(1.即将召开 2.已经召开)")
private Integer convokeType; private Integer convokeType;
private String role; private String role;
@ -73,4 +69,18 @@ public class PageContentReqVO extends PageReqVO {
return extraParams; return extraParams;
} }
@ApiModelProperty(value = "修改时间排序(0默认倒序 1升序)")
private Integer modifiedTimeSort;
@ApiModelProperty(value = "发布时间排序(0默认倒序 1升序)")
private Integer publicationTimeSort;
@ApiModelProperty(value = "序号排序(0默认升序 1倒序)")
private Integer ordinalSort;
/* @ApiModelProperty(value = "模板状态(0禁用;1启用)")
private Integer templateStatus;*/
@ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)")
private Integer isDisable;
} }

@ -96,11 +96,10 @@ public class PageContentRespVO {
private Integer isDisable; private Integer isDisable;
@ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") @ApiModelProperty(value = "标签名称")
private String labelName; private String labelName;
@ApiModelProperty(value = "分类名称(没有显示暂无)")
@ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)")
private String classificationName; private String classificationName;
@ -183,5 +182,6 @@ public class PageContentRespVO {
@ApiModelProperty(value = "样式id(用于前端区分是会议还是文章跳转界面)") @ApiModelProperty(value = "样式id(用于前端区分是会议还是文章跳转界面)")
private Integer listStyleId; private Integer listStyleId;
@ApiModelProperty(value = "顺序(排序号)")
private Integer sequence;
} }
Loading…
Cancel
Save