|
|
|
@ -46,6 +46,8 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
@Autowired |
|
|
|
|
private ICmsColumnService cmsColumnService; |
|
|
|
|
|
|
|
|
|
private static final String ADMIN_COLUMN_KEY = "99"; |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "文章栏目-获取栏目树型列表", notes = "文章栏目-获取栏目树型列表") |
|
|
|
|
@GetMapping(value = "/getColumnTree") |
|
|
|
|
public Result<?> getColumnTree(HttpServletRequest req) { |
|
|
|
@ -76,7 +78,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
// @AutoLog(value = "文章栏目-分页列表查询")
|
|
|
|
|
@ApiOperation(value = "文章栏目-分页列表查询", notes = "文章栏目-分页列表查询") |
|
|
|
|
@GetMapping(value = "/rootList") |
|
|
|
|
public Result<?> queryPageList(CmsColumn cmsColumn, |
|
|
|
@ -84,7 +85,7 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
String hasQuery = req.getParameter("hasQuery"); |
|
|
|
|
if (hasQuery != null && "true".equals(hasQuery)) { |
|
|
|
|
if (hasQuery != null && HAS_QUERY.equals(hasQuery)) { |
|
|
|
|
QueryWrapper<CmsColumn> queryWrapper = QueryGenerator.initQueryWrapper(cmsColumn, req.getParameterMap()); |
|
|
|
|
List<CmsColumn> list = cmsColumnService.queryTreeListNoPage(queryWrapper); |
|
|
|
|
IPage<CmsColumn> pageList = new Page<>(1, 10, list.size()); |
|
|
|
@ -105,7 +106,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
Page<CmsColumn> page = new Page<CmsColumn>(pageNo, pageSize); |
|
|
|
|
IPage<CmsColumn> pageList = cmsColumnService.page(page, queryWrapper); |
|
|
|
|
List<CmsColumn> records = pageList.getRecords(); |
|
|
|
|
// records.sort(Comparator.comparing(CmsColumn::getSort));
|
|
|
|
|
Collections.sort(records, Comparator.comparingInt(CmsColumn::getSort)); |
|
|
|
|
|
|
|
|
|
return Result.OK(pageList); |
|
|
|
@ -119,7 +119,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
// @AutoLog(value = "文章栏目-获取子数据")
|
|
|
|
|
@ApiOperation(value = "文章栏目-获取子数据", notes = "文章栏目-获取子数据") |
|
|
|
|
@GetMapping(value = "/childList") |
|
|
|
|
public Result<?> queryPageList(CmsColumn cmsColumn, HttpServletRequest req) { |
|
|
|
@ -138,7 +137,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
* @return 返回 IPage |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
// @AutoLog(value = "文章栏目-批量获取子数据")
|
|
|
|
|
@ApiOperation(value = "文章栏目-批量获取子数据", notes = "文章栏目-批量获取子数据") |
|
|
|
|
@GetMapping("/getChildListBatch") |
|
|
|
|
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { |
|
|
|
@ -162,7 +160,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
* @param cmsColumn |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
// @AutoLog(value = "文章栏目-添加")
|
|
|
|
|
@ApiOperation(value = "文章栏目-添加", notes = "文章栏目-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody CmsColumn cmsColumn) { |
|
|
|
@ -178,7 +175,6 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
* @param cmsColumn |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
// @AutoLog(value = "文章栏目-编辑")
|
|
|
|
|
@ApiOperation(value = "文章栏目-编辑", notes = "文章栏目-编辑") |
|
|
|
|
@PutMapping(value = "/edit") |
|
|
|
|
public Result<?> edit(@RequestBody CmsColumn cmsColumn) { |
|
|
|
@ -196,9 +192,13 @@ public class CmsColumnController extends JeecgController<CmsColumn, ICmsColumnSe |
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
CmsColumn cmsColumn = cmsColumnService.getById(id); |
|
|
|
|
if (StringUtils.equals("99", cmsColumn.getId())) throw new JeecgBootException("文章总栏目不可删除"); |
|
|
|
|
if (StringUtils.equals(ADMIN_COLUMN_KEY, cmsColumn.getId())) { |
|
|
|
|
throw new JeecgBootException("文章总栏目不可删除"); |
|
|
|
|
} |
|
|
|
|
int count = cmsColumnService.count(new LambdaQueryWrapper<CmsColumn>().eq(CmsColumn::getPid, cmsColumn.getId())); |
|
|
|
|
if (count > 0) throw new JeecgBootException("存在子栏目暂不可删除"); |
|
|
|
|
if (count > 0) { |
|
|
|
|
throw new JeecgBootException("存在子栏目暂不可删除"); |
|
|
|
|
} |
|
|
|
|
cmsColumnService.deleteCmsColumn(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
|