diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index 95a131e..a072c3a 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -1,15 +1,19 @@ package com.huoran.iasf.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 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.entity.SysContentFile; +import com.huoran.iasf.service.SysColumnService; 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.*; import com.huoran.iasf.common.utils.R; +import org.apache.ibatis.annotations.Update; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping; @@ -37,7 +41,8 @@ public class SysContentController { @Autowired public SysContentService service; - + @Autowired + public SysColumnService columnService; @PostMapping("/pagingQuery") @ApiOperation(value = "分页查询", response = PageContentRespVO.class) @@ -53,6 +58,13 @@ public class SysContentController { @ApiOperation(value = "查询详情", response = SysContent.class) public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { SysContent sysContent = service.getById(id); + + SysColumn sysColumn = columnService.getById(sysContent.getColumnId()); + if (sysColumn.getColumnName()!=null){ + sysContent.setColumnName(sysColumn.getColumnName()); + } + + return R.success(sysContent); } @@ -123,5 +135,19 @@ public class SysContentController { IPage iPage = service.page(page,queryWrapper); return R.success(iPage); } + + + + @PostMapping("/articleEnableOrDisable") + @ApiOperation(value = "文章启用禁用",response = SysContent.class) + public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, + @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_disable",isDisable); + updateWrapper.eq("id",id); + boolean ret = service.update(updateWrapper); + return ret?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 index 3090b9e..b943e78 100644 --- a/src/main/java/com/huoran/iasf/controller/SysTemplateController.java +++ b/src/main/java/com/huoran/iasf/controller/SysTemplateController.java @@ -44,9 +44,17 @@ public class SysTemplateController { @PostMapping("/listOfColumnTemplates") - @ApiOperation(value = "获取栏目模板列表", response = SysTemplate.class) - public R listByEntity() { - List list = templateService.list(); + @ApiOperation(value = "获取文章模板列表、详情样式", response = SysTemplate.class) + public R listOfColumnTemplates() { + List list = templateService.list(new QueryWrapper().eq("type",1)); + return R.success(list); + } + + + @PostMapping("/longPageListStyle") + @ApiOperation(value = "长页列表样式", response = SysTemplate.class) + public R longPageListStyle() { + List list = styleService.list(new QueryWrapper().eq("template_id",9)); return R.success(list); } diff --git a/src/main/java/com/huoran/iasf/entity/SysColumn.java b/src/main/java/com/huoran/iasf/entity/SysColumn.java index a2e66f6..ceadc4d 100644 --- a/src/main/java/com/huoran/iasf/entity/SysColumn.java +++ b/src/main/java/com/huoran/iasf/entity/SysColumn.java @@ -149,6 +149,10 @@ public class SysColumn implements Serializable { @ApiModelProperty(value = "详情样式") private String detailStyle; + @TableField(exist = false) + @ApiModelProperty(value = "路径") + private String path; + //----------------------非数据库字段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 b175a4c..b1abf6a 100644 --- a/src/main/java/com/huoran/iasf/entity/SysContent.java +++ b/src/main/java/com/huoran/iasf/entity/SysContent.java @@ -148,4 +148,10 @@ public class SysContent implements Serializable { @ApiModelProperty(value = "所属分类(sys_content_classification表外键)") private Integer classificationId; + @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") + private Integer isDisable; + + @ApiModelProperty(value = "栏目名称") + @TableField(exist = false) + private String columnName; } \ 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 index 09f8682..f8f6309 100644 --- a/src/main/java/com/huoran/iasf/entity/SysTemplate.java +++ b/src/main/java/com/huoran/iasf/entity/SysTemplate.java @@ -33,4 +33,8 @@ public class SysTemplate implements Serializable { private String templateType; + @ApiModelProperty(value = "类型(0栏目 1文章)") + private Integer type; + + } diff --git a/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java b/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java index add1c9c..dc49b03 100644 --- a/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java +++ b/src/main/java/com/huoran/iasf/entity/SysTemplateStyle.java @@ -38,5 +38,10 @@ public class SysTemplateStyle implements Serializable { @ApiModelProperty(value = "模板id") private Integer templateId; + @ApiModelProperty(value = "跳转路径") + private String path; + + + } 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 c3599f2..38fa860 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml @@ -37,7 +37,8 @@ ( SELECT u.username FROM sys_user u WHERE u.id = s.editor_id ) AS editorUser, ( SELECT t.template_type FROM sys_template t WHERE t.id = s.template_id ) AS templateName, ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS listStyle, - ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle + ( SELECT sty.style FROM sys_template_style sty WHERE sty.id = s.detail_style_id ) AS detailStyle, + ( SELECT sty.path FROM sys_template_style sty WHERE sty.id = s.list_style_id ) AS path FROM sys_column s WHERE diff --git a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java index 357402e..3fa562f 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java @@ -72,8 +72,6 @@ public class SysContentServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("is_release", Constant.ARTICLE_PUBLISHED); queryWrapper.eq("template_status",Constant.TEMPLATE_STATUS_ENABLED); - -// queryWrapper.eq("site_id", content.getSiteId()); List sysContentList = mapper.selectList(queryWrapper); return R.success(sysContentList); diff --git a/src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java b/src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java index b7bfacd..d73fce8 100644 --- a/src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java +++ b/src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java @@ -92,4 +92,7 @@ public class PageContentRespVO { @ApiModelProperty(value = "上级栏目") private List superiorColumn; + @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") + private Integer isDisable; + } \ No newline at end of file