|
|
@ -1,15 +1,19 @@ |
|
|
|
package com.huoran.iasf.controller; |
|
|
|
package com.huoran.iasf.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
|
|
import com.huoran.iasf.entity.SysColumn; |
|
|
|
import com.huoran.iasf.entity.SysContentFile; |
|
|
|
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.ContentHeavyTitleReqVO; |
|
|
|
import com.huoran.iasf.vo.req.ContentReq; |
|
|
|
import com.huoran.iasf.vo.req.ContentReq; |
|
|
|
import com.huoran.iasf.vo.req.PageContentReqVO; |
|
|
|
import com.huoran.iasf.vo.req.PageContentReqVO; |
|
|
|
import com.huoran.iasf.vo.resp.PageContentRespVO; |
|
|
|
import com.huoran.iasf.vo.resp.PageContentRespVO; |
|
|
|
import io.swagger.annotations.*; |
|
|
|
import io.swagger.annotations.*; |
|
|
|
import com.huoran.iasf.common.utils.R; |
|
|
|
import com.huoran.iasf.common.utils.R; |
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.Update; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
@ -37,7 +41,8 @@ public class SysContentController { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
public SysContentService service; |
|
|
|
public SysContentService service; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public SysColumnService columnService; |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/pagingQuery") |
|
|
|
@PostMapping("/pagingQuery") |
|
|
|
@ApiOperation(value = "分页查询", response = PageContentRespVO.class) |
|
|
|
@ApiOperation(value = "分页查询", response = PageContentRespVO.class) |
|
|
@ -53,6 +58,13 @@ public class SysContentController { |
|
|
|
@ApiOperation(value = "查询详情", response = SysContent.class) |
|
|
|
@ApiOperation(value = "查询详情", response = SysContent.class) |
|
|
|
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
|
|
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
|
|
SysContent sysContent = service.getById(id); |
|
|
|
SysContent sysContent = service.getById(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysColumn sysColumn = columnService.getById(sysContent.getColumnId()); |
|
|
|
|
|
|
|
if (sysColumn.getColumnName()!=null){ |
|
|
|
|
|
|
|
sysContent.setColumnName(sysColumn.getColumnName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.success(sysContent); |
|
|
|
return R.success(sysContent); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -123,5 +135,19 @@ public class SysContentController { |
|
|
|
IPage<SysContent> iPage = service.page(page,queryWrapper); |
|
|
|
IPage<SysContent> iPage = service.page(page,queryWrapper); |
|
|
|
return R.success(iPage); |
|
|
|
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<SysContent> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
updateWrapper.set("is_disable",isDisable); |
|
|
|
|
|
|
|
updateWrapper.eq("id",id); |
|
|
|
|
|
|
|
boolean ret = service.update(updateWrapper); |
|
|
|
|
|
|
|
return ret?R.success():R.fail("禁用/启用失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|