|
|
|
@ -6,7 +6,8 @@ import com.huoran.iasf.common.utils.Constant; |
|
|
|
|
import com.huoran.iasf.entity.ColumnEntity; |
|
|
|
|
import com.huoran.iasf.entity.SysColumn; |
|
|
|
|
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.PaginationColumnReqVO; |
|
|
|
|
import com.huoran.iasf.vo.resp.SortColumnRespVO; |
|
|
|
@ -22,12 +23,13 @@ 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.lang.reflect.InvocationTargetException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -46,6 +48,13 @@ public class SysColumnController { |
|
|
|
|
@Autowired |
|
|
|
|
public SysContentService contentService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
public SysTemplateService templateService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
public SysTemplateStyleService styleService; |
|
|
|
|
@Autowired |
|
|
|
|
public SysTemplateStyleConfigurationService templateStyleConfigurationService; |
|
|
|
|
|
|
|
|
|
@PostMapping("/listWithTree") |
|
|
|
|
@ApiOperation(value = "栏目树结构", response = SysColumn.class) |
|
|
|
@ -64,6 +73,12 @@ public class SysColumnController { |
|
|
|
|
@ApiOperation(value = "查询详情", response = SysColumn.class) |
|
|
|
|
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
|
|
|
|
SysColumn sysColumn = service.getById(id); |
|
|
|
|
SysTemplateStyle sysTemplateStyle = styleService.getById(sysColumn.getListStyleId()); |
|
|
|
|
|
|
|
|
|
if (sysTemplateStyle.getPath() != null) { |
|
|
|
|
sysColumn.setPath(sysTemplateStyle.getPath()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.success(sysColumn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -124,18 +139,6 @@ public class SysColumnController { |
|
|
|
|
SysColumn sysColumn = new SysColumn(); |
|
|
|
|
BeanUtils.copyProperties(sort, 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(); |
|
|
|
@ -145,6 +148,14 @@ public class SysColumnController { |
|
|
|
|
@PostMapping("/getsTheSubColumn") |
|
|
|
|
public R getsTheSubColumn(Integer id) { |
|
|
|
|
|
|
|
|
|
String ids = this.getIds(id); |
|
|
|
|
|
|
|
|
|
return service.getsTheSubColumn(id, ids); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getIds(Integer id) { |
|
|
|
|
//1 创建list集合,用于封装所有删除菜单id值
|
|
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
|
//2 向idList集合设置删除菜单id
|
|
|
|
@ -156,9 +167,7 @@ public class SysColumnController { |
|
|
|
|
str += idstr + ","; |
|
|
|
|
} |
|
|
|
|
String ids = str.substring(0, str.length() - 1); |
|
|
|
|
|
|
|
|
|
return service.getsTheSubColumn(id, ids); |
|
|
|
|
|
|
|
|
|
return ids; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|