提交 6be4f1f4 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 57b7e436
......@@ -52,6 +52,8 @@ public class BaseRequestPath {
public static final String LIST = "/list";
/** 获取树形数据 */
public static final String TREE = "/tree";
/** 获取树形数据——文章 */
public static final String ARTICLE_TREE = "/article_tree";
/** 判断是否存在*/
public static final String ISEXIST = "/isExist";
/** 导入 */
......
package com.zrqx.core.enums;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 资源类型枚举
* @author ycw
* @date
*/
public enum InputMode {
/**EPUB */
EPUB(2, "EPUB"),
/** 手动 */
HANDS(1, "手动");
private final Integer code;
private final String name;
private InputMode(Integer code,String name){
this.code=code;
this.name=name;
}
public static InputMode valueOfCode(String code) {
if (StringUtils.isBlank(code)) {
throw new IllegalArgumentException("Library Status " + code + " is blank");
}
for (InputMode mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Library Status " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(Integer code) {
if (code == null) {
return null;
}
for (InputMode mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 通过中文名称获取ID
* @param code
* @return
*/
public static Integer getCode(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
for (InputMode mt : values()) {
if (mt.getName().equals(name)) {
return mt.getCode();
}
}
return null;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<String,String> getAllEnumMap() {
HashMap<String,String> map = new HashMap<String,String>();
for (InputMode mt : values()) {
map.put(mt.getCode()+"", mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
......@@ -8,6 +8,6 @@ import lombok.Data;
public class QueryResourceRelationForm {
@ApiModelProperty(value = "当前资源id",required = true)
private String id;
@ApiModelProperty("资源类型 1杂志、2文章、3PDF")
@ApiModelProperty("录入方式 1手动、2EPUB")
private Integer resourceType;
}
......@@ -13,7 +13,7 @@ public class ResourceRelationVo {
private String resourceId;
@ApiModelProperty("资源名")
private String name;
@ApiModelProperty("资源类型1杂志、2文章、3PDF、4图片")
@ApiModelProperty("录入方式:1:手动 2EPUB")
private Integer resourceType;
@ApiModelProperty("创建时间")
private String uploadTime;
......
......@@ -203,6 +203,17 @@ public class DiyTypeController {
tree(list,voList);
return CallBack.success(voList);
}
@ApiOperation(value = "查询文章自定义分类tree", notes = "查询列表")
@GetMapping(value = ResourceRequestPath.ARTICLE_TREE)
public CallBack<List<DiyTypeVO>> article_tree() {
Example example = service.createExample();
example.createCriteria().andEqualTo("status", DiyTypeStatusEnum.STATUS_1.getCode()).andEqualTo("typeName",AllResourceTypeEnum.ARTICLE.getName());
PageHelper.orderBy("sort");
List<DiyType> list = service.selectByExample(example);
List<DiyTypeVO> voList = Copy.copyList(list , DiyTypeVO.class, obj -> obj.getParentId().intValue() == 0);
tree(list,voList);
return CallBack.success(voList);
}
@ApiOperation(value = "根据数据类型(一级分类名)查询自定义分类tree", notes = "查询列表")
@GetMapping(value = ResourceRequestPath.NAME + ResourceRequestPath.TREE)
......
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.InputMode;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.exception.ParameterValidateException;
......@@ -208,8 +209,7 @@ public class ResourceLibraryController {
@ApiOperation(value = "资源类型列表" , notes ="资源类型")
@GetMapping(value = ResourceRequestPath.TYPE + ResourceRequestPath.LIST)
public CallBack<Map<String,String>> queryResourceTypeList(){
Map<String, String> map = AllResourceTypeEnum.getAllEnumMap();
//资源类型 1图书、2医家、3文章、4图片、5视频、6音频、7附件
Map<String, String> map = InputMode.getAllEnumMap();
map = sortList(map);
return CallBack.success(map);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论