diff --git a/src/main/java/com/huoran/iasf/common/utils/Constant.java b/src/main/java/com/huoran/iasf/common/utils/Constant.java index 6e85a07..a85f09f 100644 --- a/src/main/java/com/huoran/iasf/common/utils/Constant.java +++ b/src/main/java/com/huoran/iasf/common/utils/Constant.java @@ -59,4 +59,22 @@ public class Constant { public static final Integer TEMPLATE_STATUS_DISABLED = 0; public static final Integer TEMPLATE_STATUS_ENABLED = 1; + + + /** + * 模板类型 类型(0:列表样式 1:详情样式)', + */ + + public static final Integer LIST_TEMPLATE_TYPES = 0; + + public static final Integer DETAILS_TEMPLATE_TYPE = 1; + + + /** + * 栏目导航菜单是否可见 菜单是否可见(默认0可见 1不可见) + */ + + public static final Integer NAVIGATION_MENU_VISIBLE = 0; + + public static final Integer THE_NAVIGATION_MENU_IS_NOT_VISIBLE = 1; } diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index b82cef8..e20947b 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -2,6 +2,7 @@ package com.huoran.iasf.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +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; @@ -13,6 +14,7 @@ import io.swagger.annotations.*; import com.huoran.iasf.common.utils.R; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -46,10 +48,16 @@ public class SysColumnController { @PostMapping("/listWithTree") @ApiOperation(value = "栏目树结构", response = SysColumn.class) - public R listWithTree(@RequestBody @Valid PaginationColumnReqVO sysColumn) { + public R listWithTree(@RequestBody @Validated PaginationColumnReqVO sysColumn) { return R.success(service.listWithTree(sysColumn)); } + @PostMapping("/listWithTreeMenuVisible") + @ApiOperation(value = "栏目树结构(前台可见,只展示试单可见的栏目)", response = SysColumn.class) + public R listWithTreeMenuVisible(@RequestBody @Validated PaginationColumnReqVO sysColumn) { + return R.success(service.listWithTreeMenuVisible(sysColumn)); + } + @PostMapping("/findById") @ApiOperation(value = "查询详情", response = SysColumn.class) @@ -63,7 +71,7 @@ public class SysColumnController { @ApiOperation(value = "新增", response = SysColumn.class) public R save(@RequestBody @Valid SysColumn sysColumn) { boolean addState = service.save(sysColumn); - return addState ? R.success() : R.fail("新增失败"); + return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); } @PostMapping("/update") @@ -77,6 +85,24 @@ public class SysColumnController { @ApiOperation(value = "删除", response = SysContent.class) public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { boolean delState = service.removeById(id); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("column_id",id); + //删除栏目后删除栏目下的文章 + List contentId = contentService.list(queryWrapper); + contentService.removeByIds(contentId); + + return delState ? R.success() : R.fail("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除栏目", response = SysColumn.class) + public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("column_id",ids); + //删除栏目后删除栏目下的文章 + contentService.remove(queryWrapper); return delState ? R.success() : R.fail("删除失败"); } @@ -94,7 +120,7 @@ public class SysColumnController { BeanUtils.copyProperties(sort, sysColumn); service.updateById(sysColumn); //依据当前循环获取的栏目id,查询到引用当前栏目的文章对其进行修改栏目id - QueryWrapper queryWrapper = new QueryWrapper<>(); + /*QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("column_id", sysColumn.getId()); List contentList = contentService.list(queryWrapper); if (contentList.size() > 0) { @@ -103,7 +129,7 @@ public class SysColumnController { updateWrapper.set("column_id", sysColumn.getId()); contentService.update(content, updateWrapper); } - } + }*/ } diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java index 74048bc..ad619ed 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java @@ -3,6 +3,8 @@ package com.huoran.iasf.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.huoran.iasf.common.utils.Constant; +import com.huoran.iasf.entity.SysColumn; +import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.vo.req.SysColumnLongRedisVO; import io.swagger.annotations.*; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -39,7 +41,8 @@ public class SysColumnLongPageController { @Autowired public SysColumnLongPageService service; - + @Autowired + public SysColumnService columnService; @Autowired private StringRedisTemplate redisTemplate; @@ -52,13 +55,11 @@ public class SysColumnLongPageController { } - - @PostMapping("/getLongPageInformation") @ApiOperation(value = "根据栏目id查询类型长页栏目信息", response = SysColumnLongPage.class) public R getLongPageInformation(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("column_id",columnId); + queryWrapper.eq("column_id", columnId); List longPageList = service.list(queryWrapper); return R.success(longPageList); } @@ -67,6 +68,16 @@ public class SysColumnLongPageController { @PostMapping("/save") @ApiOperation(value = "新增", response = SysColumnLongPage.class) public R save(@RequestBody @Valid @ApiParam(name = "长页栏目拓展表对象", value = "传入json格式", required = true) SysColumnLongPage sysColumnLongPage) { + + SysColumn column = columnService.getById(sysColumnLongPage.getColumnId()); + if (sysColumnLongPage.getState() == Constant.ARTICLE_NOT_PUBLISHED) {//发布状态(0:草稿 1已发布) + //发布状态为草稿箱时候 导航菜单是否启用为禁用状态 + column.setMenuVisible(Constant.THE_NAVIGATION_MENU_IS_NOT_VISIBLE); + } else { + column.setMenuVisible(Constant.NAVIGATION_MENU_VISIBLE); + } + + columnService.updateById(column); boolean addState = service.save(sysColumnLongPage); return addState ? R.success() : R.fail("新增失败"); } @@ -75,6 +86,16 @@ public class SysColumnLongPageController { @PostMapping("/update") @ApiOperation(value = "修改", response = SysColumnLongPage.class) public R update(@RequestBody @ApiParam(name = "长页栏目拓展表对象", value = "传入json格式", required = true) SysColumnLongPage sysColumnLongPage) { + SysColumn column = columnService.getById(sysColumnLongPage.getColumnId()); + if (sysColumnLongPage.getState() == Constant.ARTICLE_NOT_PUBLISHED) {//发布状态(0:草稿 1已发布) + //发布状态为草稿箱时候 导航菜单是否启用为禁用状态 + column.setMenuVisible(Constant.THE_NAVIGATION_MENU_IS_NOT_VISIBLE); + + } else { + column.setMenuVisible(Constant.NAVIGATION_MENU_VISIBLE); + } + + columnService.updateById(column); boolean updateState = service.updateById(sysColumnLongPage); return updateState ? R.success() : R.fail("编辑失败"); } diff --git a/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java b/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java new file mode 100644 index 0000000..f8ed41c --- /dev/null +++ b/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java @@ -0,0 +1,108 @@ +package com.huoran.iasf.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.utils.R; +import com.huoran.iasf.entity.SysContentClassification; +import com.huoran.iasf.service.SysContentClassificationService; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +import javax.validation.Valid; +import java.util.List; + + +/** + * @描述:文章所属分类控制类 + * @作者: Rong + * @日期: 2022-11-08 + */ +@RestController +@RequestMapping("/content/classification") +@Api(value = "文章所属分类:SysContentClassificationController", tags = "R-文章所属分类") +public class SysContentClassificationController { + + @Autowired + public SysContentClassificationService service; + + + @PostMapping("/allTheQuery") + @ApiOperation(value = "查询全部文章所属分类", response = SysContentClassification.class) + public R allTheQuery(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) { + List list = service.list(new QueryWrapper().eq("site_id", siteId)); + return R.success(list); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = SysContentClassification.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + SysContentClassification sysContentClassification = service.getById(id); + return R.success(sysContentClassification); + } + + + @PostMapping("/checkForHeavy") + @ApiOperation(value = "分类校验判重", response = SysContentClassification.class) + public R checkForHeavy(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId, + @ApiParam(name = "classificationName", value = "分类名称", required = true) @RequestParam String classificationName, + @ApiParam(name = "classificationId", value = "分类id(新增不传,编辑传)", required = false) @RequestParam Integer classificationId) { + + QueryWrapper queryWrapper = new QueryWrapper().eq("site_id", siteId). + eq("classification_name", classificationName); + + //id不得空表示编辑校验 + if (classificationId != null) { + queryWrapper.last(" and id != " + classificationId); + } + SysContentClassification sysContentClassification = service.getOne(queryWrapper); + if (sysContentClassification != null) { + return R.fail("当前分类名称已存在!"); + } + return R.success(); + + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = SysContentClassification.class) + public R save(@RequestBody @Valid @ApiParam(name = "文章所属分类对象", value = "传入json格式", required = true) SysContentClassification sysContentClassification) { + boolean addState = service.save(sysContentClassification); + return addState ? R.success() : R.fail("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = SysContentClassification.class) + public R update(@RequestBody @ApiParam(name = "文章所属分类对象", value = "传入json格式", required = true) SysContentClassification sysContentClassification) { + boolean updateState = service.updateById(sysContentClassification); + return updateState ? R.success() : R.fail("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = SysContentClassification.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.success() : R.fail("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = SysContentClassification.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.success() : R.fail("删除失败"); + // + } +} + diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index ff066a4..95a131e 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -1,6 +1,11 @@ package com.huoran.iasf.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.iasf.entity.SysContentFile; import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; +import com.huoran.iasf.vo.req.ContentReq; import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.resp.PageContentRespVO; import io.swagger.annotations.*; @@ -17,6 +22,7 @@ import com.huoran.iasf.service.SysContentService; import com.huoran.iasf.entity.SysContent; import javax.validation.Valid; +import java.util.List; /** @@ -40,6 +46,9 @@ public class SysContentController { } + + + @PostMapping("/findById") @ApiOperation(value = "查询详情", response = SysContent.class) public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { @@ -51,7 +60,7 @@ public class SysContentController { @ApiOperation(value = "新增", response = SysContent.class) public R save(@RequestBody @Valid @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { boolean addState = service.save(sysContent); - return addState ? R.success() : R.fail("新增失败"); + return addState ? R.success(sysContent.getId()) : R.fail("新增失败"); } @@ -71,6 +80,14 @@ public class SysContentController { } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除文章", response = SysContent.class) + public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.success() : R.fail("删除失败"); + } + @PostMapping("/checkIfTheTitleIsRepeat") @ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) { @@ -90,5 +107,21 @@ public class SysContentController { public R publishedEnabledArticles() { return service.publishedEnabledArticles(); } + + + /** + * 获取栏目下的文章 + * @param pageReq + * @return + */ + @PostMapping("/getColumnArticles") + @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 queryWrapper = new QueryWrapper<>(); + queryWrapper.in("column_id",pageReq.getColumnIds()); + IPage iPage = service.page(page,queryWrapper); + return R.success(iPage); + } } diff --git a/src/main/java/com/huoran/iasf/controller/SysContentFileController.java b/src/main/java/com/huoran/iasf/controller/SysContentFileController.java new file mode 100644 index 0000000..5e95c48 --- /dev/null +++ b/src/main/java/com/huoran/iasf/controller/SysContentFileController.java @@ -0,0 +1,81 @@ +package com.huoran.iasf.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.utils.R; +import com.huoran.iasf.entity.SysContentFile; +import com.huoran.iasf.service.SysContentFileService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +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 java.util.List; + + +/** + * @描述:文章附件管理表控制类 + * @作者: Rong + * @日期: 2022-11-07 + */ +@RestController +@RequestMapping("/content/file") +@Api(value = "文章附件管理表:SysContentFileController", tags = "文章附件管理表") +public class SysContentFileController { + + @Autowired + public SysContentFileService service; + + + @PostMapping("/theAttachmentUnderTheQueryColumn") + @ApiOperation(value = "查询文章id下的附件", response = SysContentFile.class) + public R theAttachmentUnderTheQueryColumn(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("content_id",contentId); + List sysContentFile = service.list(queryWrapper); + return R.success(sysContentFile); + } + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = SysContentFile.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + SysContentFile sysContentFile = service.getById(id); + return R.success(sysContentFile); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = SysContentFile.class) + public R save(@RequestBody @ApiParam(name = "文章附件管理表对象", value = "传入json格式", required = true) SysContentFile sysContentFile) { + boolean addState = service.save(sysContentFile); + return addState ? R.success(sysContentFile.getId()) : R.fail("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = SysContentFile.class) + public R update(@RequestBody @ApiParam(name = "文章附件管理表对象", value = "传入json格式", required = true) SysContentFile sysContentFile) { + boolean updateState = service.updateById(sysContentFile); + return updateState ? R.success() : R.fail("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = SysContentFile.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.success() : R.fail("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = SysContentFile.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.success() : R.fail("删除失败"); + } +} + diff --git a/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java b/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java new file mode 100644 index 0000000..d344ad1 --- /dev/null +++ b/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java @@ -0,0 +1,104 @@ +package com.huoran.iasf.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.utils.R; +import com.huoran.iasf.entity.SysContentClassification; +import com.huoran.iasf.entity.SysContentLabel; +import com.huoran.iasf.service.SysContentLabelService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +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 javax.validation.Valid; +import java.util.List; + + +/** + * @描述:文章主题标签控制类 + * @作者: Rong + * @日期: 2022-11-08 + */ +@RestController +@RequestMapping("/content/label") +@Api(value = "文章主题标签:SysContentLabelController", tags = "R-文章主题标签") +public class SysContentLabelController { + + @Autowired + public SysContentLabelService service; + + + @PostMapping("/queryAllArticleSubjectTags") + @ApiOperation(value = "查询全部文章主题标签", response = SysContentLabel.class) + public R queryAllArticleSubjectTags(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) { + List list = service.list(new QueryWrapper().eq("site_id", siteId)); + return R.success(list); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = SysContentLabel.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + SysContentLabel sysContentLabel = service.getById(id); + return R.success(sysContentLabel); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = SysContentLabel.class) + public R save(@RequestBody @Valid @ApiParam(name = "文章主题标签对象", value = "传入json格式", required = true) SysContentLabel sysContentLabel) { + boolean addState = service.save(sysContentLabel); + return addState ? R.success() : R.fail("新增失败"); + } + + + @PostMapping("/checkForHeavy") + @ApiOperation(value = "标签校验判重", response = SysContentLabel.class) + public R checkForHeavy(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId, + @ApiParam(name = "labelName", value = "标签名称", required = true) @RequestParam String labelName, + @ApiParam(name = "labelId", value = "标签id(新增不传,编辑传)", required = false) @RequestParam Integer labelId) { + + QueryWrapper queryWrapper = new QueryWrapper().eq("site_id", siteId).eq("label_name", labelName); + + //id不得空表示编辑校验 + if (labelId != null) { + queryWrapper.last(" and id != " + labelId); + } + SysContentLabel contentLabel = service.getOne(queryWrapper); + if (contentLabel != null) { + return R.fail("当前标签名称已存在!"); + } + return R.success(); + + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = SysContentLabel.class) + public R update(@RequestBody @ApiParam(name = "文章主题标签对象", value = "传入json格式", required = true) SysContentLabel sysContentLabel) { + boolean updateState = service.updateById(sysContentLabel); + return updateState ? R.success() : R.fail("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = SysContentLabel.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.success() : R.fail("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = SysContentLabel.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.success() : R.fail("删除失败"); + } +} + diff --git a/src/main/java/com/huoran/iasf/controller/SysTemplateController.java b/src/main/java/com/huoran/iasf/controller/SysTemplateController.java new file mode 100644 index 0000000..3090b9e --- /dev/null +++ b/src/main/java/com/huoran/iasf/controller/SysTemplateController.java @@ -0,0 +1,89 @@ +package com.huoran.iasf.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.utils.Constant; +import com.huoran.iasf.entity.SysTemplateStyle; +import com.huoran.iasf.service.SysTemplateStyleService; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.iasf.common.utils.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import com.huoran.iasf.service.SysTemplateService; +import com.huoran.iasf.entity.SysTemplate; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @描述:栏目模板控制类 + * @作者: Rong + * @日期: 2022-11-11 + */ +@RestController +@RequestMapping("/template") +@Api(value = "栏目模板:SysTemplateController", tags = "栏目模板:栏目模板相关") +public class SysTemplateController { + + @Autowired + public SysTemplateService templateService; + + @Autowired + public SysTemplateStyleService styleService; + + + @PostMapping("/listOfColumnTemplates") + @ApiOperation(value = "获取栏目模板列表", response = SysTemplate.class) + public R listByEntity() { + List list = templateService.list(); + return R.success(list); + } + + @PostMapping("/theTemplateIdGetsTheStyle") + @ApiOperation(value = "根据模板id获取样式", response = SysTemplateStyle.class) + public R theTemplateIdGetsTheStyle(@ApiParam(name = "templateId", value = "模板id", required = true) @RequestParam Integer templateId) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("template_id",templateId); + queryWrapper.eq("type", Constant.LIST_TEMPLATE_TYPES); + List listingTemplateTypes = styleService.list(queryWrapper); + + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("template_id",templateId); + queryWrapper1.eq("type", Constant.DETAILS_TEMPLATE_TYPE); + List detailsTypeOfTheTemplate = styleService.list(queryWrapper1); + + + Map map = new HashMap<>(); + map.put("listingTemplateTypes",listingTemplateTypes);//列表样式 + map.put("detailsTypeOfTheTemplate",detailsTypeOfTheTemplate);//详情样式 + return R.success(map); + } + + + + + + @PostMapping("/fullDetailsTemplateStyle") + @ApiOperation(value = "全部详情模板样式", response = SysTemplateStyle.class) + public R fullDetailsTemplateStyle() { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type", Constant.DETAILS_TEMPLATE_TYPE); + List listingTemplateTypes = styleService.list(queryWrapper); + return R.success(listingTemplateTypes); + } +} + diff --git a/src/main/java/com/huoran/iasf/entity/SysColumn.java b/src/main/java/com/huoran/iasf/entity/SysColumn.java index 524577d..a2e66f6 100644 --- a/src/main/java/com/huoran/iasf/entity/SysColumn.java +++ b/src/main/java/com/huoran/iasf/entity/SysColumn.java @@ -51,17 +51,17 @@ public class SysColumn implements Serializable { @ApiModelProperty(value = "菜单是否可见(默认0可见 1不可见)") private Integer menuVisible; - @ApiModelProperty(value = "栏目类型(由前端自己设定)") + @ApiModelProperty(value = "栏目类型id") private Integer typeId; - @ApiModelProperty(value = "栏目模板(由前端自己设定)") + @ApiModelProperty(value = "栏目模板id") private Integer templateId; - @ApiModelProperty(value = "列表样式(由前端自己设定)") + @ApiModelProperty(value = "列表样式id") private Integer listStyleId; - @ApiModelProperty(value = "详情样式(由前端自己设定)") - private Integer detailStyle; + @ApiModelProperty(value = "详情样式id") + private Integer detailStyleId; @ApiModelProperty(value = "链接类型") private Integer connectionType; @@ -136,6 +136,19 @@ public class SysColumn implements Serializable { return 0; } + @TableField(exist = false) + @ApiModelProperty(value = "模板名称") + private String templateName; + + @TableField(exist = false) + @ApiModelProperty(value = "列表样式") + private String listStyle; + + + @TableField(exist = false) + @ApiModelProperty(value = "详情样式") + private String detailStyle; + //----------------------非数据库字段End---------------------- } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/entity/SysContent.java b/src/main/java/com/huoran/iasf/entity/SysContent.java index 4bfca1d..b175a4c 100644 --- a/src/main/java/com/huoran/iasf/entity/SysContent.java +++ b/src/main/java/com/huoran/iasf/entity/SysContent.java @@ -30,53 +30,44 @@ public class SysContent implements Serializable { private Integer id; @ApiModelProperty(value = "标题(全库判重)") - @NotNull(message = "标题不能为空!") private String title; @ApiModelProperty(value = "所属栏目") - @NotNull(message = "所属栏目不能为空!") private Integer columnId; - @ApiModelProperty(value = "标题图") - private String titleImg; + @ApiModelProperty(value = "发布时间") + private Date releaseTime; @ApiModelProperty(value = "来源") private String source; - @ApiModelProperty(value = "发布时间") -// @NotNull(message = "发布时间不能为空!") - private Date releaseTime; - - @ApiModelProperty(value = "摘要") - private String summary; + @ApiModelProperty(value = "作者") + private String author; @ApiModelProperty(value = "banner图") private String bannerImg; - @ApiModelProperty(value = "文章模板(前端自定义)——>没选择时默认读取当前所引用栏目的栏目类型") + @ApiModelProperty(value = "文章模板(前端自定义)") private Integer articleTemplate; + @ApiModelProperty(value = "摘要") + private String summary; + + @ApiModelProperty(value = "标题图(封面图)") + private String titleImg; + @ApiModelProperty(value = "正文") private String mainBody; - @ApiModelProperty(value = "作者") - private String author; - - @ApiModelProperty(value = "发布状态——>是否发布(0:草稿 1:已发布)") - @NotNull(message = "发布状态不能为空!") + @ApiModelProperty(value = "是否发布(0:草稿 1:已发布)") private Integer isRelease; @ApiModelProperty(value = "创建人id") - @NotNull(message = "创建人id不能为空!") private Integer founderId; @ApiModelProperty(value = "编辑人id") - @NotNull(message = "编辑人id不能为空!") private Integer editorId; - @ApiModelProperty(value = "文件") - private String file; - @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) private Date createTime; @@ -84,19 +75,9 @@ public class SysContent implements Serializable { @ApiModelProperty(value = "更新时间") @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; - @ApiModelProperty(value = "文章总浏览量") private Integer totalBrowsing; - @ApiModelProperty(value = "链接类型") - private Integer connectionType; - - @ApiModelProperty(value = "链接地址") - private String linkAddress; - - @ApiModelProperty(value = "站点选择(连接类型为其它站点连接时储存)1.EFL中文2.SRL中文") - private Integer siteSelection; - @ApiModelProperty(value = "是否在新窗口打开(0:否 1:是)") private Integer isOpen; @@ -105,9 +86,66 @@ public class SysContent implements Serializable { private Integer deleted; @ApiModelProperty(value = "站点id") - @NotNull(message = "站点id不能为空!") private Integer siteId; - @ApiModelProperty(value = "独立模板状态(0禁用;1启用)") + @ApiModelProperty(value = "模板状态(0禁用;1启用)") private Integer templateStatus; + + /* @ApiModelProperty(value = "其余模板字段") + private String remainingTemplateFields;*/ + + @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; + } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/entity/SysContentClassification.java b/src/main/java/com/huoran/iasf/entity/SysContentClassification.java new file mode 100644 index 0000000..551dd91 --- /dev/null +++ b/src/main/java/com/huoran/iasf/entity/SysContentClassification.java @@ -0,0 +1,57 @@ +package com.huoran.iasf.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * @描述:文章所属分类 + * @作者: Rong + * @日期: 2022-11-08 + */ +@Data +@ApiModel(value = "文章所属分类") +@TableName("sys_content_classification") +public class SysContentClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String classificationName; + + @ApiModelProperty(value = "创建人id") + @NotNull(message = "创建人id不能为空") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + @NotNull(message = "编辑人id不能为空") + private Integer editorId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + @ApiModelProperty(value = "是否删除(1未删除;0已删除)") + @TableLogic + private Integer deleted; + + @ApiModelProperty(value = "站点id") + @NotNull(message = "站点id不能为空!") + private Integer siteId; + + +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/entity/SysContentFile.java b/src/main/java/com/huoran/iasf/entity/SysContentFile.java new file mode 100644 index 0000000..3a6c1e2 --- /dev/null +++ b/src/main/java/com/huoran/iasf/entity/SysContentFile.java @@ -0,0 +1,63 @@ +package com.huoran.iasf.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:文章附件管理表 + * @作者: Rong + * @日期: 2022-11-07 + */ +@Data +@ApiModel(value = "文章附件管理表") +@TableName("sys_content_file") +public class SysContentFile implements Serializable { + + private static final long serialVersionUID=1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "文章id") + private Integer contentId; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "是否删除(1未删除;0已删除)") + @TableLogic + private Integer deleted; + + +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/entity/SysContentLabel.java b/src/main/java/com/huoran/iasf/entity/SysContentLabel.java new file mode 100644 index 0000000..538056b --- /dev/null +++ b/src/main/java/com/huoran/iasf/entity/SysContentLabel.java @@ -0,0 +1,53 @@ +package com.huoran.iasf.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * @描述:文章主题标签 + * @作者: Rong + * @日期: 2022-11-08 + */ +@Data +@ApiModel(value = "文章主题标签") +@TableName("sys_content_label") +public class SysContentLabel implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "标签名称") + private String labelName; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + @ApiModelProperty(value = "是否删除(1未删除;0已删除)") + @TableLogic + private Integer deleted; + + @ApiModelProperty(value = "站点id") + @NotNull(message = "站点id不能为空!") + private Integer siteId; +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/entity/SysTemplate.java b/src/main/java/com/huoran/iasf/entity/SysTemplate.java new file mode 100644 index 0000000..09f8682 --- /dev/null +++ b/src/main/java/com/huoran/iasf/entity/SysTemplate.java @@ -0,0 +1,36 @@ +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; +import lombok.EqualsAndHashCode; + +/** + *

+ * 栏目模板 + *

+ * + * @author cheney + * @since 2022-11-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "SysTemplate对象", description = "栏目模板") +public class SysTemplate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "模板类型名称") + private String templateType; + + +} diff --git a/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java b/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java new file mode 100644 index 0000000..add1c9c --- /dev/null +++ b/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java @@ -0,0 +1,42 @@ +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; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author cheney + * @since 2022-11-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "SysTemplateStyle对象", description = "") +public class SysTemplateStyle implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "类型(0:列表样式 1:详情样式)") + private Integer type; + + @ApiModelProperty(value = "样式名称") + private String style; + + @ApiModelProperty(value = "模板id") + private Integer templateId; + + +} diff --git a/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java b/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java index 9dfb4d4..09df759 100644 --- a/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java +++ b/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java @@ -25,6 +25,8 @@ import java.util.List; public interface SysColumnMapper extends BaseMapper { List filter(@Param("vo") PaginationColumnReqVO vo); + List filterMenuVisible(@Param("vo") PaginationColumnReqVO vo); + IPage longPageColumnList(Page page, @Param("req") LongPageColumnReqVO req); diff --git a/src/main/java/com/huoran/iasf/mapper/SysContentClassificationMapper.java b/src/main/java/com/huoran/iasf/mapper/SysContentClassificationMapper.java new file mode 100644 index 0000000..c691fce --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/SysContentClassificationMapper.java @@ -0,0 +1,16 @@ +package com.huoran.iasf.mapper; + +import com.huoran.iasf.entity.SysContentClassification; +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @描述:文章所属分类 Mapper 接口 + * @作者: Rong + * @日期: 2022-11-08 + */ +@Mapper +public interface SysContentClassificationMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/SysContentFileMapper.java b/src/main/java/com/huoran/iasf/mapper/SysContentFileMapper.java new file mode 100644 index 0000000..b8b63b4 --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/SysContentFileMapper.java @@ -0,0 +1,15 @@ +package com.huoran.iasf.mapper; + +import com.huoran.iasf.entity.SysContentFile; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @描述:文章附件管理表 Mapper 接口 + * @作者: Rong + * @日期: 2022-11-07 + */ +@Mapper +public interface SysContentFileMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/SysContentLabelMapper.java b/src/main/java/com/huoran/iasf/mapper/SysContentLabelMapper.java new file mode 100644 index 0000000..3c4ab41 --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/SysContentLabelMapper.java @@ -0,0 +1,16 @@ +package com.huoran.iasf.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.iasf.entity.SysContentLabel; +import org.apache.ibatis.annotations.Mapper; + + +/** + * @描述:文章主题标签 Mapper 接口 + * @作者: Rong + * @日期: 2022-11-08 + */ +@Mapper +public interface SysContentLabelMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/SysTemplateMapper.java b/src/main/java/com/huoran/iasf/mapper/SysTemplateMapper.java new file mode 100644 index 0000000..bca17a5 --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/SysTemplateMapper.java @@ -0,0 +1,16 @@ +package com.huoran.iasf.mapper; + +import com.huoran.iasf.entity.SysTemplate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 栏目模板 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-11 + */ +public interface SysTemplateMapper extends BaseMapper { + +} diff --git a/src/main/java/com/huoran/iasf/mapper/SysTemplateStyleMapper.java b/src/main/java/com/huoran/iasf/mapper/SysTemplateStyleMapper.java new file mode 100644 index 0000000..669822e --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/SysTemplateStyleMapper.java @@ -0,0 +1,16 @@ +package com.huoran.iasf.mapper; + +import com.huoran.iasf.entity.SysTemplateStyle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-11 + */ +public interface SysTemplateStyleMapper extends BaseMapper { + +} diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml index e26e2ef..c3599f2 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml @@ -15,7 +15,7 @@ - + @@ -32,12 +32,16 @@ + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentClassificationMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentClassificationMapper.xml new file mode 100644 index 0000000..be99075 --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentClassificationMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentFileMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentFileMapper.xml new file mode 100644 index 0000000..c5aa3e3 --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentFileMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentLabelMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentLabelMapper.xml new file mode 100644 index 0000000..020ce5c --- /dev/null +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentLabelMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml index c68d90b..e842a15 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml @@ -2,23 +2,23 @@ + + - - @@ -27,7 +27,23 @@ - + + + + + + + + + + + + + + + + +