|
|
@ -6,7 +6,8 @@ import com.huoran.iasf.common.utils.Constant; |
|
|
|
import com.huoran.iasf.entity.ColumnEntity; |
|
|
|
import com.huoran.iasf.entity.ColumnEntity; |
|
|
|
import com.huoran.iasf.entity.SysColumn; |
|
|
|
import com.huoran.iasf.entity.SysColumn; |
|
|
|
import com.huoran.iasf.entity.SysContent; |
|
|
|
import com.huoran.iasf.entity.SysContent; |
|
|
|
import com.huoran.iasf.service.SysContentService; |
|
|
|
import com.huoran.iasf.entity.SysTemplateStyle; |
|
|
|
|
|
|
|
import com.huoran.iasf.service.*; |
|
|
|
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
|
|
|
import com.huoran.iasf.vo.req.ColumnWeightReqVO; |
|
|
|
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
|
|
|
import com.huoran.iasf.vo.req.PaginationColumnReqVO; |
|
|
|
import com.huoran.iasf.vo.resp.SortColumnRespVO; |
|
|
|
import com.huoran.iasf.vo.resp.SortColumnRespVO; |
|
|
@ -22,12 +23,13 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import com.huoran.iasf.service.SysColumnService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -46,6 +48,13 @@ public class SysColumnController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
public SysContentService contentService; |
|
|
|
public SysContentService contentService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public SysTemplateService templateService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public SysTemplateStyleService styleService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public SysTemplateStyleConfigurationService templateStyleConfigurationService; |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/listWithTree") |
|
|
|
@PostMapping("/listWithTree") |
|
|
|
@ApiOperation(value = "栏目树结构", response = SysColumn.class) |
|
|
|
@ApiOperation(value = "栏目树结构", response = SysColumn.class) |
|
|
@ -64,6 +73,12 @@ public class SysColumnController { |
|
|
|
@ApiOperation(value = "查询详情", response = SysColumn.class) |
|
|
|
@ApiOperation(value = "查询详情", response = SysColumn.class) |
|
|
|
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
|
|
|
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
|
|
|
SysColumn sysColumn = service.getById(id); |
|
|
|
SysColumn sysColumn = service.getById(id); |
|
|
|
|
|
|
|
SysTemplateStyle sysTemplateStyle = styleService.getById(sysColumn.getListStyleId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sysTemplateStyle.getPath() != null) { |
|
|
|
|
|
|
|
sysColumn.setPath(sysTemplateStyle.getPath()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return R.success(sysColumn); |
|
|
|
return R.success(sysColumn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,7 +89,7 @@ public class SysColumnController { |
|
|
|
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>(); |
|
|
|
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>(); |
|
|
|
queryWrapper.eq("father_id", sysColumn.getFatherId()); |
|
|
|
queryWrapper.eq("father_id", sysColumn.getFatherId()); |
|
|
|
Integer count = service.count(queryWrapper); |
|
|
|
Integer count = service.count(queryWrapper); |
|
|
|
sysColumn.setSort(count+1); |
|
|
|
sysColumn.setSort(count + 1); |
|
|
|
boolean addState = service.save(sysColumn); |
|
|
|
boolean addState = service.save(sysColumn); |
|
|
|
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); |
|
|
|
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); |
|
|
|
} |
|
|
|
} |
|
|
@ -124,18 +139,6 @@ public class SysColumnController { |
|
|
|
SysColumn sysColumn = new SysColumn(); |
|
|
|
SysColumn sysColumn = new SysColumn(); |
|
|
|
BeanUtils.copyProperties(sort, sysColumn); |
|
|
|
BeanUtils.copyProperties(sort, sysColumn); |
|
|
|
service.updateById(sysColumn); |
|
|
|
service.updateById(sysColumn); |
|
|
|
//依据当前循环获取的栏目id,查询到引用当前栏目的文章对其进行修改栏目id
|
|
|
|
|
|
|
|
/*QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("column_id", sysColumn.getId()); |
|
|
|
|
|
|
|
List<SysContent> contentList = contentService.list(queryWrapper); |
|
|
|
|
|
|
|
if (contentList.size() > 0) { |
|
|
|
|
|
|
|
for (SysContent content : contentList) { |
|
|
|
|
|
|
|
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
updateWrapper.set("column_id", sysColumn.getId()); |
|
|
|
|
|
|
|
contentService.update(content, updateWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return R.success(); |
|
|
|
return R.success(); |
|
|
@ -145,6 +148,14 @@ public class SysColumnController { |
|
|
|
@PostMapping("/getsTheSubColumn") |
|
|
|
@PostMapping("/getsTheSubColumn") |
|
|
|
public R getsTheSubColumn(Integer id) { |
|
|
|
public R getsTheSubColumn(Integer id) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ids = this.getIds(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return service.getsTheSubColumn(id, ids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getIds(Integer id) { |
|
|
|
//1 创建list集合,用于封装所有删除菜单id值
|
|
|
|
//1 创建list集合,用于封装所有删除菜单id值
|
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
//2 向idList集合设置删除菜单id
|
|
|
|
//2 向idList集合设置删除菜单id
|
|
|
@ -156,9 +167,7 @@ public class SysColumnController { |
|
|
|
str += idstr + ","; |
|
|
|
str += idstr + ","; |
|
|
|
} |
|
|
|
} |
|
|
|
String ids = str.substring(0, str.length() - 1); |
|
|
|
String ids = str.substring(0, str.length() - 1); |
|
|
|
|
|
|
|
return ids; |
|
|
|
return service.getsTheSubColumn(id, ids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void selectCategoryChildById(String id, List<Integer> idList) { |
|
|
|
public void selectCategoryChildById(String id, List<Integer> idList) { |
|
|
@ -178,5 +187,28 @@ public class SysColumnController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取一级下的子级栏目以及下的全部文章标签") |
|
|
|
|
|
|
|
@PostMapping("/getTheFullArticleByColumn") |
|
|
|
|
|
|
|
public R getTheFullArticleByColumn(@ApiParam(name = "id", value = "一级栏目id", required = true) @RequestParam Integer id) { |
|
|
|
|
|
|
|
String ids = this.getIds(id); |
|
|
|
|
|
|
|
return contentService.getTheFullArticleByColumn(ids); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取子级栏目id") |
|
|
|
|
|
|
|
@PostMapping("/getsTheChildColumnId") |
|
|
|
|
|
|
|
public R getsTheSublevelColumnIdOfTheNextLevel(@ApiParam(name = "id", value = "一级栏目id", required = true) @RequestParam Integer id) { |
|
|
|
|
|
|
|
//1 创建list集合,用于封装所有删除菜单id值
|
|
|
|
|
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
|
|
|
|
//2 向idList集合设置删除菜单id
|
|
|
|
|
|
|
|
this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去
|
|
|
|
|
|
|
|
//把当前id封装到list里面
|
|
|
|
|
|
|
|
idList.add(id);//现在把当前id封装进去 之前都是子菜单的id
|
|
|
|
|
|
|
|
return R.success(idList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|