parent
fd25c70c41
commit
96abde4271
30 changed files with 1407 additions and 172 deletions
@ -0,0 +1,86 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.entity.SysContent; |
||||
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
||||
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
||||
import io.swagger.annotations.*; |
||||
import com.huoran.iasf.common.utils.R; |
||||
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 com.huoran.iasf.service.SysColumnService; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* @描述:栏目基础信息控制类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-01 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/sysColumn") |
||||
@Api(value = "栏目基础信息:SysColumnController", tags = "R-栏目管理") |
||||
public class SysColumnController { |
||||
|
||||
@Autowired |
||||
public SysColumnService service; |
||||
|
||||
|
||||
@PostMapping("/listWithTree") |
||||
@ApiOperation(value = "栏目树结构", response = SysColumn.class) |
||||
public R listWithTree(@RequestBody @Valid PaginationColumnReqVO sysColumn) { |
||||
return R.success(service.listWithTree(sysColumn)); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/findById") |
||||
@ApiOperation(value = "查询详情", response = SysColumn.class) |
||||
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
||||
SysColumn sysColumn = service.getById(id); |
||||
return R.success(sysColumn); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/save") |
||||
@ApiOperation(value = "新增", response = SysColumn.class) |
||||
public R save(@RequestBody @Valid SysColumn sysColumn) { |
||||
boolean addState = service.save(sysColumn); |
||||
return addState ? R.success() : R.fail("新增失败"); |
||||
} |
||||
|
||||
@PostMapping("/update") |
||||
@ApiOperation(value = "修改", response = SysColumn.class) |
||||
public R update(@RequestBody SysColumn sysColumn) { |
||||
boolean updateState = service.updateById(sysColumn); |
||||
return updateState ? R.success() : R.fail("编辑失败"); |
||||
} |
||||
|
||||
@PostMapping("/delete") |
||||
@ApiOperation(value = "删除", response = SysContent.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("/sameLevelJudgment") |
||||
@ApiOperation(value = "同级判重", response = ColumnWeightReqVO.class) |
||||
public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) { |
||||
return service.sameLevelJudgment(sysColumn) ? R.success() : R.fail("同级下已存在重复栏目!"); |
||||
} |
||||
|
||||
@PostMapping("/sortByColumn") |
||||
@ApiOperation(value = "栏目排序", response = SysColumn.class) |
||||
public R sortByColumn(@RequestBody List<SysColumn> entityList) { |
||||
boolean updateState = service.updateBatchById(entityList); |
||||
return updateState ? R.success() : R.fail("编辑成功"); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,68 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
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.*; |
||||
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 com.huoran.iasf.service.SysColumnLongPageService; |
||||
import com.huoran.iasf.entity.SysColumnLongPage; |
||||
|
||||
import javax.validation.Valid; |
||||
|
||||
|
||||
/** |
||||
* @描述:长页栏目拓展表控制类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-09 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/sysColumnLongPage") |
||||
@Api(value = "长页栏目拓展表:SysColumnLongPageController", tags = "R-长页栏目拓展信息") |
||||
public class SysColumnLongPageController { |
||||
|
||||
@Autowired |
||||
public SysColumnLongPageService service; |
||||
|
||||
|
||||
@PostMapping("/findById") |
||||
@ApiOperation(value = "查询详情", response = SysColumnLongPage.class) |
||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
||||
SysColumnLongPage sysColumnLongPage = service.getById(id); |
||||
return R.success(sysColumnLongPage); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/save") |
||||
@ApiOperation(value = "新增", response = SysColumnLongPage.class) |
||||
public R save(@RequestBody @Valid @ApiParam(name = "长页栏目拓展表对象", value = "传入json格式", required = true) SysColumnLongPage sysColumnLongPage) { |
||||
boolean addState = service.save(sysColumnLongPage); |
||||
return addState ? R.success() : R.fail("新增失败"); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/update") |
||||
@ApiOperation(value = "修改", response = SysColumnLongPage.class) |
||||
public R update(@RequestBody @ApiParam(name = "长页栏目拓展表对象", value = "传入json格式", required = true) SysColumnLongPage sysColumnLongPage) { |
||||
boolean updateState = service.updateById(sysColumnLongPage); |
||||
return updateState ? R.success() : R.fail("编辑失败"); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/delete") |
||||
@ApiOperation(value = "删除", response = SysColumnLongPage.class) |
||||
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
||||
boolean delState = service.removeById(id); |
||||
return delState ? R.success() : R.fail("删除失败"); |
||||
} |
||||
} |
||||
|
@ -1,79 +1,80 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.huoran.iasf.common.aop.annotation.DataScope; |
||||
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import io.swagger.annotations.*; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.SysContentEntity; |
||||
import com.huoran.iasf.service.SysContentService; |
||||
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 io.swagger.annotations.ApiParam; |
||||
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
import org.springframework.util.CollectionUtils; |
||||
import org.springframework.util.StringUtils; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import com.huoran.iasf.service.SysContentService; |
||||
import com.huoran.iasf.entity.SysContent; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
import javax.validation.Valid; |
||||
|
||||
|
||||
/** |
||||
* 文章管理 |
||||
* |
||||
* @author cheney |
||||
* @version V1.0 |
||||
* @date 2022年7月28日 |
||||
* @描述:文章管理控制类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Api(tags = "文章管理") |
||||
@RestController |
||||
@RequestMapping("/sysContent") |
||||
@Api(value = "文章管理:SysContentController", tags = "R-文章管理") |
||||
public class SysContentController { |
||||
@Resource |
||||
private SysContentService sysContentService; |
||||
|
||||
@Autowired |
||||
public SysContentService service; |
||||
|
||||
|
||||
@ApiOperation(value = "新增") |
||||
@PostMapping("/add") |
||||
@RequiresPermissions("sysContent:add") |
||||
public R add(@RequestBody SysContentEntity sysContent) { |
||||
sysContentService.save(sysContent); |
||||
return R.success(); |
||||
@PostMapping("/pagingQuery") |
||||
@ApiOperation(value = "分页查询", response = PageContentRespVO.class) |
||||
public R pagingQuery(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) PageContentReqVO sysContent) { |
||||
return service.articlePaginationList(sysContent); |
||||
} |
||||
|
||||
@ApiOperation(value = "删除") |
||||
@DeleteMapping("/delete") |
||||
@RequiresPermissions("sysContent:delete") |
||||
public R delete(@RequestBody @ApiParam(value = "id集合") List<String> ids) { |
||||
sysContentService.removeByIds(ids); |
||||
return R.success(); |
||||
|
||||
@PostMapping("/findById") |
||||
@ApiOperation(value = "查询详情", response = SysContent.class) |
||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
||||
SysContent sysContent = service.getById(id); |
||||
return R.success(sysContent); |
||||
} |
||||
|
||||
@ApiOperation(value = "更新") |
||||
@PutMapping("/update") |
||||
@RequiresPermissions("sysContent:update") |
||||
public R update(@RequestBody SysContentEntity sysContent) { |
||||
sysContentService.updateById(sysContent); |
||||
return R.success(); |
||||
@PostMapping("/save") |
||||
@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("新增失败"); |
||||
} |
||||
|
||||
@ApiOperation(value = "查询分页数据") |
||||
@PostMapping("/listByPage") |
||||
@RequiresPermissions("sysContent:list") |
||||
@DataScope |
||||
public R findListByPage(@RequestBody SysContentEntity sysContent) { |
||||
LambdaQueryWrapper<SysContentEntity> queryWrapper = Wrappers.lambdaQuery(); |
||||
//查询条件示例
|
||||
if (!StringUtils.isEmpty(sysContent.getTitle())) { |
||||
queryWrapper.like(SysContentEntity::getTitle, sysContent.getTitle()); |
||||
|
||||
@PostMapping("/update") |
||||
@ApiOperation(value = "修改", response = SysContent.class) |
||||
public R update(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { |
||||
boolean updateState = service.updateById(sysContent); |
||||
return updateState ? R.success() : R.fail("编辑失败"); |
||||
} |
||||
//数据权限示例, 需手动添加此条件 begin
|
||||
if (!CollectionUtils.isEmpty(sysContent.getCreateIds())) { |
||||
queryWrapper.in(SysContentEntity::getCreateId, sysContent.getCreateIds()); |
||||
|
||||
|
||||
@PostMapping("/delete") |
||||
@ApiOperation(value = "删除", response = SysContent.class) |
||||
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
||||
boolean delState = service.removeById(id); |
||||
return delState ? R.success() : R.fail("删除失败"); |
||||
} |
||||
//数据权限示例, 需手动添加此条件 end
|
||||
IPage<SysContentEntity> iPage = sysContentService.page(sysContent.getQueryPage(), queryWrapper); |
||||
return R.success(iPage); |
||||
|
||||
|
||||
@PostMapping("/checkIfTheTitleIsRepeat") |
||||
@ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) |
||||
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) { |
||||
return service.checkIfTheTitleIsRepeat(content) ? R.success() : R.fail("该标题已重复!"); |
||||
} |
||||
} |
||||
|
||||
|
@ -0,0 +1,57 @@ |
||||
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.SysColumn; |
||||
import com.huoran.iasf.entity.SysContent; |
||||
import com.huoran.iasf.service.SysColumnService; |
||||
import com.huoran.iasf.service.SysContentService; |
||||
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
||||
import com.huoran.iasf.vo.req.LongPageColumnReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.util.StringUtils; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* @描述:页面管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-08 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/pageManagement") |
||||
@Api(value = "页面管理:SysPageManagementController", tags = "R-页面管理") |
||||
public class SysPageManagementController { |
||||
|
||||
@Autowired |
||||
public SysColumnService columnService; |
||||
|
||||
|
||||
/** |
||||
* 需求:当前接口只查栏目类型为长页栏目的数据 |
||||
* |
||||
* @param sysContent |
||||
* @return |
||||
*/ |
||||
@PostMapping("/longPageColumnList") |
||||
@ApiOperation(value = "长页列列表", response = PageContentRespVO.class) |
||||
public R longPageColumnList(@RequestBody @Valid @ApiParam(name = "分页查询参数", value = "传入json格式", required = true) LongPageColumnReqVO sysContent) { |
||||
return columnService.longPageColumnList(sysContent); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
|
@ -0,0 +1,114 @@ |
||||
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 java.util.List; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
/** |
||||
* @描述:栏目基础信息 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-03 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "栏目基础信息") |
||||
@TableName("sys_column") |
||||
public class SysColumn implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "父id(第一级为0)") |
||||
private Integer fatherId; |
||||
|
||||
@ApiModelProperty(value = "排序") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "层级((1-一级分类 2-二级分类 3-三级分类以此叠加))") |
||||
private Integer level; |
||||
|
||||
@ApiModelProperty(value = "栏目名称") |
||||
private String columnName; |
||||
|
||||
@ApiModelProperty(value = "banner路径") |
||||
private String columnBanner; |
||||
|
||||
@ApiModelProperty(value = "分页条数") |
||||
private Integer pageSize; |
||||
|
||||
@ApiModelProperty(value = "菜单是否可见(默认0可见 1不可见)") |
||||
private Integer menuVisible; |
||||
|
||||
@ApiModelProperty(value = "栏目类型(由前端自己设定)") |
||||
private Integer typeId; |
||||
|
||||
@ApiModelProperty(value = "栏目模板(由前端自己设定)") |
||||
private Integer templateId; |
||||
|
||||
@ApiModelProperty(value = "列表样式(由前端自己设定)") |
||||
private Integer listStyleId; |
||||
|
||||
@ApiModelProperty(value = "详情样式(由前端自己设定)") |
||||
private Integer detailStyle; |
||||
|
||||
@ApiModelProperty(value = "链接类型") |
||||
private Integer connectionType; |
||||
|
||||
@ApiModelProperty(value = "链接地址") |
||||
private String linkAddress; |
||||
|
||||
@ApiModelProperty(value = "只有一篇文章时,以详情方式展示(0默认否 1为是)") |
||||
private Integer showWithDetails; |
||||
|
||||
@ApiModelProperty(value = "站点选择(连接类型为其它站点连接时储存)1.EFL中文2.SRL中文") |
||||
private Integer siteSelection; |
||||
|
||||
@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 = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "状态(0默认草稿箱 1为已发布)") |
||||
private Integer status; |
||||
|
||||
@ApiModelProperty(value = "是否删除(1未删除;0已删除)") |
||||
@TableLogic |
||||
private Integer deleted; |
||||
|
||||
|
||||
@ApiModelProperty(value = "是否在新窗口打开(0:否 1:是)") |
||||
private Integer isOpen; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
@ApiModelProperty("子分类") |
||||
@TableField(exist = false) |
||||
private List<SysColumn> children; |
||||
|
||||
|
||||
} |
@ -0,0 +1,65 @@ |
||||
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-08-09 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "长页栏目拓展表") |
||||
@TableName("sys_column_long_page") |
||||
public class SysColumnLongPage implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "栏目id") |
||||
@NotNull(message = "栏目id不能为空!") |
||||
private Integer columnId; |
||||
|
||||
@ApiModelProperty(value = "当前页面版面排序") |
||||
@NotNull(message = "排序不能为空!") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "内容(json字符串)") |
||||
@NotNull(message = "内容不能为空!") |
||||
private String json; |
||||
|
||||
@ApiModelProperty(value = "创建人id") |
||||
private Integer founderId; |
||||
|
||||
@ApiModelProperty(value = "编辑人id") |
||||
private Integer editorId; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
@TableField(fill = FieldFill.INSERT) |
||||
private Date createTime; |
||||
|
||||
@ApiModelProperty(value = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "是否删除(1未删除;0已删除)") |
||||
private Integer deleted; |
||||
|
||||
@ApiModelProperty(value = "备注") |
||||
private String remark; |
||||
|
||||
|
||||
} |
@ -0,0 +1,110 @@ |
||||
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-08-08 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "文章管理") |
||||
@TableName("sys_content") |
||||
public class SysContent implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键") |
||||
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 String source; |
||||
|
||||
@ApiModelProperty(value = "发布时间") |
||||
@NotNull(message = "发布时间不能为空!") |
||||
private Date releaseTime; |
||||
|
||||
@ApiModelProperty(value = "摘要") |
||||
private String summary; |
||||
|
||||
@ApiModelProperty(value = "banner图") |
||||
private String bannerImg; |
||||
|
||||
@ApiModelProperty(value = "文章模板(前端自定义)——>没选择时默认读取当前所引用栏目的栏目类型") |
||||
private Integer articleTemplate; |
||||
|
||||
@ApiModelProperty(value = "正文") |
||||
private String mainBody; |
||||
|
||||
@ApiModelProperty(value = "作者") |
||||
private String author; |
||||
|
||||
@ApiModelProperty(value = "发布状态——>是否发布(0:草稿 1:已发布)") |
||||
@NotNull(message = "发布状态不能为空!") |
||||
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; |
||||
|
||||
@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; |
||||
|
||||
@ApiModelProperty(value = "是否删除(1未删除;0已删除)") |
||||
@TableLogic |
||||
private Integer deleted; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
} |
@ -1,88 +0,0 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 内容管理 |
||||
* |
||||
* @author cheney |
||||
* @version V1.0 |
||||
* @date 2022年7月28日 |
||||
*/ |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@Data |
||||
@TableName("sys_content") |
||||
public class SysContentEntity extends BaseEntity implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 主键id |
||||
*/ |
||||
@TableId("id") |
||||
@ApiModelProperty(value = "主键id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 主题 |
||||
*/ |
||||
@TableField("title") |
||||
@ApiModelProperty(value = "主题") |
||||
private String title; |
||||
|
||||
/** |
||||
* 内容 |
||||
*/ |
||||
@TableField("content") |
||||
@ApiModelProperty(value = "内容") |
||||
private String content; |
||||
|
||||
/** |
||||
* 单个图片url |
||||
*/ |
||||
@ApiModelProperty(value = "单个图片url") |
||||
private String oneImg; |
||||
|
||||
/** |
||||
* 多个图片url |
||||
*/ |
||||
@ApiModelProperty(value = "多个图片url") |
||||
private String multipleImg; |
||||
|
||||
/** |
||||
* 关键字 |
||||
*/ |
||||
@ApiModelProperty(value = "关键字") |
||||
private String keywords; |
||||
|
||||
/** |
||||
* 类型(数据字典) |
||||
*/ |
||||
@TableField("type") |
||||
@ApiModelProperty(value = "类型") |
||||
private String type; |
||||
|
||||
/** |
||||
* 创建人 |
||||
*/ |
||||
@TableField(value = "create_id", fill = FieldFill.INSERT) |
||||
@ApiModelProperty(value = "创建人") |
||||
private String createId; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
@TableField(value = "create_time", fill = FieldFill.INSERT) |
||||
@ApiModelProperty(value = "创建时间") |
||||
private Date createTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.SysColumnLongPage; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @描述:长页栏目拓展表 Mapper 接口 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-09 |
||||
*/ |
||||
@Mapper |
||||
public interface SysColumnLongPageMapper extends BaseMapper<SysColumnLongPage> { |
||||
|
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.vo.FatherContentRespVO; |
||||
import com.huoran.iasf.vo.req.LongPageColumnReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述: Mapper 接口 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-01 |
||||
*/ |
||||
@Mapper |
||||
public interface SysColumnMapper extends BaseMapper<SysColumn> { |
||||
List<SysColumn> filter(@Param("vo") PaginationColumnReqVO vo); |
||||
|
||||
|
||||
IPage<PageContentRespVO> longPageColumnList(Page<PageContentRespVO> page, @Param("req") LongPageColumnReqVO req); |
||||
|
||||
//依据子级查询父级
|
||||
List<FatherContentRespVO> getParentInformationBasedOnChild(@Param("id")Integer id); |
||||
} |
@ -1,15 +1,20 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.huoran.iasf.entity.SysContent; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.huoran.iasf.entity.SysContentEntity; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
/** |
||||
* 内容管理 Mapper |
||||
* |
||||
* @author cheney |
||||
* @version V1.0 |
||||
* @date 2022年7月28日 |
||||
* @描述:文章管理 Mapper 接口 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
public interface SysContentMapper extends BaseMapper<SysContentEntity> { |
||||
|
||||
@Mapper |
||||
public interface SysContentMapper extends BaseMapper<SysContent> { |
||||
IPage<PageContentRespVO> articlePaginationList(Page<PageContentRespVO> page, @Param("req") PageContentReqVO req); |
||||
} |
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.SysColumnLongPageMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.huoran.iasf.entity.SysColumnLongPage"> |
||||
<id column="id" property="id"/> |
||||
<result column="column_id" property="columnId"/> |
||||
<result column="sort" property="sort"/> |
||||
<result column="json" property="json"/> |
||||
<result column="founder_id" property="founderId"/> |
||||
<result column="editor_id" property="editorId"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="deleted" property="deleted"/> |
||||
<result column="remark" property="remark"/> |
||||
</resultMap> |
||||
|
||||
</mapper> |
@ -0,0 +1,78 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.SysColumnMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.huoran.iasf.entity.SysColumn"> |
||||
<id column="id" property="id"/> |
||||
<result column="father_id" property="fatherId"/> |
||||
<result column="sort" property="sort"/> |
||||
<result column="level" property="level"/> |
||||
<result column="column_name" property="columnName"/> |
||||
<result column="column_banner" property="columnBanner"/> |
||||
<result column="page_size" property="pageSize"/> |
||||
<result column="menu_visible" property="menuVisible"/> |
||||
<result column="type_id" property="typeId"/> |
||||
<result column="template_id" property="templateId"/> |
||||
<result column="list_style_id" property="listStyleId"/> |
||||
<result column="detail_style" property="detailStyle"/> |
||||
<result column="connection_type" property="connectionType"/> |
||||
<result column="link_address" property="linkAddress"/> |
||||
<result column="show_with_details" property="showWithDetails"/> |
||||
<result column="site_selection" property="siteSelection"/> |
||||
<result column="founder_id" property="founderId"/> |
||||
<result column="editor_id" property="editorId"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="status" property="status"/> |
||||
<result column="deleted" property="deleted"/> |
||||
<result column="is_open" property="isOpen"/> |
||||
<result column="site_id" property="siteId"/> |
||||
</resultMap> |
||||
|
||||
<select id="filter" resultType="com.huoran.iasf.entity.SysColumn"> |
||||
SELECT * |
||||
FROM sys_column |
||||
WHERE deleted = 1 and site_id = #{vo.siteId} |
||||
<if test="vo.columnName != '' and vo.columnName!= null"> |
||||
and column_name LIKE CONCAT('%',#{vo.columnName},'%') |
||||
</if> |
||||
|
||||
</select> |
||||
|
||||
|
||||
<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 u.username FROM sys_user u WHERE u.id = c.editor_id) AS editorName, |
||||
c.* |
||||
FROM sys_column c |
||||
WHERE deleted = 1 |
||||
AND type_id = #{req.columnTypeId} |
||||
and site_id = #{req.siteId} |
||||
ORDER BY c.create_time asc |
||||
</select> |
||||
<select id="getParentInformationBasedOnChild" resultType="com.huoran.iasf.vo.FatherContentRespVO"> |
||||
SELECT |
||||
T2.id, |
||||
T2.column_name , |
||||
T2.father_id, |
||||
T2.level, |
||||
T2.sort |
||||
FROM ( |
||||
SELECT @r AS _id, |
||||
( SELECT @r := father_id FROM sys_column WHERE id = _id ) AS parent_id, |
||||
@l := @l + 1 AS lvl |
||||
FROM |
||||
( SELECT @r := #{id}, @l := 0 ) vars, |
||||
sys_column h |
||||
WHERE |
||||
@r != 0 |
||||
) T1 |
||||
JOIN sys_column T2 ON T1._id = T2.id |
||||
WHERE |
||||
deleted = 1 and id != #{id} |
||||
ORDER BY |
||||
T1.lvl DESC |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,57 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.SysContentMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.huoran.iasf.entity.SysContent"> |
||||
<id column="id" property="id"/> |
||||
<result column="title" property="title"/> |
||||
<result column="column_id" property="columnId"/> |
||||
<result column="title_img" property="titleImg"/> |
||||
<result column="source" property="source"/> |
||||
<result column="release_time" property="releaseTime"/> |
||||
<result column="summary" property="summary"/> |
||||
<result column="banner_img" property="bannerImg"/> |
||||
<result column="article_template" property="articleTemplate"/> |
||||
<result column="main_body" property="mainBody"/> |
||||
<result column="author" property="author"/> |
||||
<result column="is_release" property="isRelease"/> |
||||
<result column="founder_id" property="founderId"/> |
||||
<result column="editor_id" property="editorId"/> |
||||
<result column="file" property="file"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="total_browsing" property="totalBrowsing"/> |
||||
<result column="connection_type" property="connectionType"/> |
||||
<result column="link_address" property="linkAddress"/> |
||||
<result column="site_selection" property="siteSelection"/> |
||||
<result column="is_open" property="isOpen"/> |
||||
<result column="deleted" property="deleted"/> |
||||
<result column="side_id" property="siteId"/> |
||||
</resultMap> |
||||
<select id="articlePaginationList" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> |
||||
SELECT c.*, |
||||
(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.username 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 |
||||
FROM sys_content c |
||||
WHERE c.deleted = 1 and site_id = #{req.siteId} |
||||
<if test="req.columnIds != null and req.columnIds.size() > 0 "> |
||||
and column_id in |
||||
<foreach item="item" index="index" collection="req.columnIds" |
||||
open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
|
||||
|
||||
<if test="req.title != null and req.title != ''"> |
||||
and title LIKE CONCAT('%',#{req.title},'%') |
||||
</if> |
||||
|
||||
ORDER BY c.create_time desc |
||||
|
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.SysColumnLongPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @描述:长页栏目拓展表 service接口 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-09 |
||||
*/ |
||||
public interface SysColumnLongPageService extends IService<SysColumnLongPage> { |
||||
|
||||
|
||||
} |
@ -0,0 +1,29 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
||||
import com.huoran.iasf.vo.req.LongPageColumnReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述: service接口 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-01 |
||||
*/ |
||||
public interface SysColumnService extends IService<SysColumn> { |
||||
|
||||
//新增栏目前,同级判重
|
||||
boolean sameLevelJudgment(ColumnWeightReqVO column); |
||||
|
||||
|
||||
List<SysColumn> listWithTree(PaginationColumnReqVO sysColumn); |
||||
|
||||
//长页栏目列表
|
||||
R longPageColumnList(LongPageColumnReqVO reqVO); |
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.iasf.entity.SysColumnLongPage; |
||||
import com.huoran.iasf.mapper.SysColumnLongPageMapper; |
||||
import com.huoran.iasf.service.SysColumnLongPageService; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
/** |
||||
* @描述:长页栏目拓展表 服务类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-09 |
||||
*/ |
||||
@Service |
||||
public class SysColumnLongPageServiceImpl extends ServiceImpl<SysColumnLongPageMapper, SysColumnLongPage> implements SysColumnLongPageService { |
||||
|
||||
@Autowired |
||||
private SysColumnLongPageMapper mapper; |
||||
|
||||
} |
||||
|
||||
|
||||
|
@ -0,0 +1,131 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.mapper.SysColumnMapper; |
||||
import com.huoran.iasf.service.SysColumnService; |
||||
import com.huoran.iasf.vo.FatherContentRespVO; |
||||
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
||||
import com.huoran.iasf.vo.req.LongPageColumnReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @描述: 服务类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-01 |
||||
*/ |
||||
@Service |
||||
public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn> implements SysColumnService { |
||||
|
||||
@Autowired |
||||
private SysColumnMapper mapper; |
||||
|
||||
@Override |
||||
public boolean sameLevelJudgment(ColumnWeightReqVO column) { |
||||
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("column_name", column.getColumnName()); |
||||
queryWrapper.eq("level", column.getLevel()); |
||||
queryWrapper.eq("site_id", column.getSiteId()); |
||||
SysColumn sysColumn = mapper.selectOne(queryWrapper); |
||||
if (sysColumn != null) { |
||||
if (column.getId() != null) { |
||||
//判断为编辑情况下,如果编辑的id与查询出来的一致不提示
|
||||
if (column.getId() == sysColumn.getId()) { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public List<SysColumn> listWithTree(PaginationColumnReqVO column) { |
||||
//查询所有栏目
|
||||
List<SysColumn> columnList = baseMapper.filter(column); |
||||
|
||||
if (column.getColumnName().equals("")) { |
||||
//用来保存父节点
|
||||
List<SysColumn> rootColumn = new ArrayList<>(); |
||||
//用来保存子节点
|
||||
List<SysColumn> childList = new ArrayList<>(); |
||||
//遍历所有栏目,将所有栏目的父栏目id为0的栏目放入父节点集合中
|
||||
for (SysColumn column1 : columnList) { |
||||
Integer parentId = column1.getFatherId(); |
||||
if (parentId == 0) { |
||||
rootColumn.add(column1); |
||||
} |
||||
} |
||||
for (SysColumn sysColumn : rootColumn) { |
||||
Integer deptId = sysColumn.getId(); |
||||
//调用工具类获取子节点
|
||||
childList = getChildren(deptId, columnList); |
||||
sysColumn.setChildren(childList); |
||||
} |
||||
|
||||
return rootColumn; |
||||
} |
||||
|
||||
return columnList; |
||||
|
||||
|
||||
} |
||||
|
||||
@Override |
||||
public R longPageColumnList(LongPageColumnReqVO reqVO) { |
||||
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize()); |
||||
IPage<PageContentRespVO> pageList = baseMapper.longPageColumnList(page, reqVO); |
||||
pageList.getRecords().forEach(pageContentRespVO -> { |
||||
if (pageContentRespVO.getLevel() > 1) { |
||||
//判断该栏目层级为第一级时候不返回上级栏目
|
||||
List<FatherContentRespVO> upperLevel = baseMapper.getParentInformationBasedOnChild(pageContentRespVO.getId()); |
||||
pageContentRespVO.setSuperiorColumn(upperLevel); |
||||
} |
||||
|
||||
}); |
||||
|
||||
|
||||
return R.success(pageList); |
||||
} |
||||
|
||||
|
||||
public static List<SysColumn> getChildren(Integer id, List<SysColumn> allDept) { |
||||
//存放子节点
|
||||
List<SysColumn> childList = new ArrayList<>(); |
||||
//遍历所有栏目,如果父id与传来的id相同,则为传来的id这个栏目的子栏目
|
||||
for (SysColumn dept : allDept) { |
||||
Integer parentId = dept.getFatherId(); |
||||
if (parentId.equals(id)) { |
||||
childList.add(dept); |
||||
} |
||||
} |
||||
|
||||
//自调用来判断是否还有子节点
|
||||
for (SysColumn dept : childList) { |
||||
dept.setChildren(getChildren(dept.getId(), allDept)); |
||||
} |
||||
|
||||
//如果没有子节点则返回空集合
|
||||
if (childList.size() == 0) { |
||||
return new ArrayList<>(); |
||||
} |
||||
return childList; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
@ -1,20 +1,59 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.iasf.entity.SysContentEntity; |
||||
import com.huoran.iasf.common.utils.Constant; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.SysContent; |
||||
import com.huoran.iasf.mapper.SysContentMapper; |
||||
import com.huoran.iasf.service.SysContentService; |
||||
import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; |
||||
import com.huoran.iasf.vo.req.PageContentReqVO; |
||||
import com.huoran.iasf.vo.resp.PageContentRespVO; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
/** |
||||
* 内容 服务类 |
||||
* |
||||
* @author cheney |
||||
* @version V1.0 |
||||
* @date 2022年7月28日 |
||||
* @描述:文章管理 服务类 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Service("sysContentService") |
||||
public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysContentEntity> implements SysContentService { |
||||
@Service |
||||
public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysContent> implements SysContentService { |
||||
|
||||
@Autowired |
||||
private SysContentMapper mapper; |
||||
|
||||
@Override |
||||
public boolean checkIfTheTitleIsRepeat(ContentHeavyTitleReqVO content) { |
||||
//只对已发布的标题判重
|
||||
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("title", content.getTitle()); |
||||
queryWrapper.eq("is_release", Constant.ARTICLE_PUBLISHED); |
||||
queryWrapper.eq("site_id", content.getSiteId()); |
||||
SysContent sysContent = mapper.selectOne(queryWrapper); |
||||
if (sysContent != null) { |
||||
if (content.getId() != null) { |
||||
//判断为编辑情况下,如果编辑的id与查询出来的一致不提示
|
||||
if (content.getId() == content.getId()) { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public R articlePaginationList(PageContentReqVO reqVO) { |
||||
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize()); |
||||
IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO); |
||||
return R.success(pageList); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,39 @@ |
||||
package com.huoran.iasf.vo; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
public class FatherContentRespVO { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "父id(第一级为0)") |
||||
private Integer fatherId; |
||||
|
||||
@ApiModelProperty(value = "排序") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "层级((1-一级分类 2-二级分类 3-三级分类以此叠加))") |
||||
private Integer level; |
||||
|
||||
@ApiModelProperty(value = "栏目名称") |
||||
private String columnName; |
||||
|
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
/** |
||||
* @描述:栏目基础信息 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-03 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "栏目判重") |
||||
public class ColumnWeightReqVO { |
||||
|
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "层级((1-一级分类 2-二级分类 3-三级分类以此叠加))") |
||||
@NotNull(message = "层级不能为空") |
||||
private Integer level; |
||||
|
||||
@ApiModelProperty(value = "栏目名称") |
||||
@NotNull(message = "栏目名称不能为空") |
||||
private String columnName; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,32 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "文章标题判重") |
||||
public class ContentHeavyTitleReqVO { |
||||
|
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键(编辑时需要传)",required = false) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "标题(全库判重)",required = true) |
||||
@NotNull(message = "标题不能为空") |
||||
private String title; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
public class LongPageColumnReqVO extends PageReqVO { |
||||
|
||||
|
||||
@ApiModelProperty(value = "模板名称") |
||||
private String templateName; |
||||
|
||||
|
||||
@ApiModelProperty(value = "栏目名称") |
||||
private String programName; |
||||
|
||||
|
||||
@ApiModelProperty(value = "栏目类型id",hidden = true) |
||||
private Integer columnTypeId; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
public Integer getColumnTypeId() { |
||||
return 3; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,30 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
public class PageContentReqVO extends PageReqVO { |
||||
|
||||
|
||||
@ApiModelProperty(value = "栏目id") |
||||
private List<Integer> columnIds; |
||||
|
||||
@ApiModelProperty(value = "标题") |
||||
private String title; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @ProjectName: huorantech |
||||
* @Package: com.huoran.occupationlab.entity.req |
||||
* @ClassName: PageReq |
||||
* @Description: 分页 |
||||
* @Author: Maureen.Rong |
||||
* @CreateDate: 2021/8/12 15:10 |
||||
* @UpdateDate: 2021/8/12 15:10 |
||||
* @Version: 1.0 |
||||
*/ |
||||
@Data |
||||
public class PageReqVO { |
||||
|
||||
@ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) |
||||
private Integer pageNum; |
||||
@ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) |
||||
private Integer pageSize; |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
/** |
||||
* @ProjectName: huorantech |
||||
* @Package: com.huoran.occupationlab.entity.req |
||||
* @ClassName: PageReq |
||||
* @Description: 分页 |
||||
* @Author: Maureen.Rong |
||||
* @CreateDate: 2021/8/12 15:10 |
||||
* @UpdateDate: 2021/8/12 15:10 |
||||
* @Version: 1.0 |
||||
*/ |
||||
@Data |
||||
public class PaginationColumnReqVO extends PageReqVO { |
||||
|
||||
@ApiModelProperty(value = "栏目名称") |
||||
private String columnName; |
||||
|
||||
@ApiModelProperty(value = "栏目类型") |
||||
private Integer typeId; |
||||
|
||||
@ApiModelProperty(value = "栏目模板") |
||||
private Integer templateId; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
@NotNull(message = "站点id不能为空!") |
||||
private Integer siteId; |
||||
|
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.huoran.iasf.vo.req; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @描述:栏目基础信息 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-03 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "栏目基础信息") |
||||
@TableName("sys_column") |
||||
public class SortByColumnReqVO { |
||||
|
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "父id") |
||||
private Integer fatherId; |
||||
|
||||
@ApiModelProperty(value = "排序") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "层级((1-一级分类 2-二级分类 3-三级分类以此叠加))") |
||||
private Integer level; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,95 @@ |
||||
package com.huoran.iasf.vo.resp; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import com.huoran.iasf.entity.SysColumn; |
||||
import com.huoran.iasf.vo.FatherContentRespVO; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:文章管理 |
||||
* @作者: Rong |
||||
* @日期: 2022-08-05 |
||||
*/ |
||||
@Data |
||||
public class PageContentRespVO { |
||||
|
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "标题") |
||||
private String title; |
||||
|
||||
@ApiModelProperty(value = "所属栏目") |
||||
private String columnName; |
||||
|
||||
@ApiModelProperty(value = "所属栏目") |
||||
private Integer columnId; |
||||
|
||||
@ApiModelProperty(value = "标题图") |
||||
private String titleImg; |
||||
|
||||
@ApiModelProperty(value = "来源") |
||||
private String source; |
||||
|
||||
@ApiModelProperty(value = "发布时间") |
||||
private String releaseTime; |
||||
|
||||
@ApiModelProperty(value = "摘要") |
||||
private String summary; |
||||
|
||||
@ApiModelProperty(value = "banner图") |
||||
private String bannerImg; |
||||
|
||||
@ApiModelProperty(value = "文章模板(前端自定义)") |
||||
private Integer articleTemplate; |
||||
|
||||
@ApiModelProperty(value = "正文") |
||||
private String mainBody; |
||||
|
||||
@ApiModelProperty(value = "作者") |
||||
private String author; |
||||
|
||||
@ApiModelProperty(value = "是否发布(0:草稿 1:已发布)") |
||||
private Integer isRelease; |
||||
|
||||
@ApiModelProperty(value = "栏目类型(由前端自己设定)") |
||||
private Integer typeId; |
||||
|
||||
|
||||
@ApiModelProperty(value = "创建人") |
||||
private String founderName; |
||||
|
||||
@ApiModelProperty(value = "编辑人") |
||||
private String editorName; |
||||
|
||||
@ApiModelProperty(value = "文件") |
||||
private String file; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
@TableField(fill = FieldFill.INSERT) |
||||
private Date createTime; |
||||
|
||||
@ApiModelProperty(value = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "文章总浏览量") |
||||
private Integer totalBrowsing; |
||||
|
||||
@ApiModelProperty(value = "父id(第一级为0)") |
||||
private Integer fatherId; |
||||
|
||||
@ApiModelProperty(value = "层级((1-一级分类 2-二级分类 3-三级分类以此叠加))") |
||||
private Integer level; |
||||
|
||||
|
||||
@ApiModelProperty(value = "上级栏目") |
||||
private List<FatherContentRespVO> superiorColumn; |
||||
|
||||
} |
Loading…
Reference in new issue