初次提交
This commit is contained in:
parent
480ca9397b
commit
7030f3773c
|
@ -28,12 +28,12 @@ public class CodeGenerator {
|
||||||
})
|
})
|
||||||
.packageConfig(builder -> {
|
.packageConfig(builder -> {
|
||||||
builder.parent("com.hivekion") // 设置父包名
|
builder.parent("com.hivekion") // 设置父包名
|
||||||
.moduleName("environment") // 设置模块名(可选)
|
.moduleName("guarantee") // 设置模块名(可选)
|
||||||
.pathInfo(Collections.singletonMap(OutputFile.xml,
|
.pathInfo(Collections.singletonMap(OutputFile.xml,
|
||||||
basePath + "/src/main/resources/mapper/tbl")); // 设置mapperXml生成路径
|
basePath + "/src/main/resources/mapper/tbl")); // 设置mapperXml生成路径
|
||||||
})
|
})
|
||||||
.strategyConfig(builder -> {
|
.strategyConfig(builder -> {
|
||||||
builder.addInclude("tbl_ebe") // 设置需要生成的表名(多个用逗号分隔)
|
builder.addInclude("tbl_safeguard_detail") // 设置需要生成的表名(多个用逗号分隔)
|
||||||
.addTablePrefix("tbl_"); // 设置过滤表前缀
|
.addTablePrefix("tbl_"); // 设置过滤表前缀
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
|
|
|
@ -7,6 +7,8 @@ import com.hivekion.baseData.service.ITblEntityService;
|
||||||
import com.hivekion.common.entity.ResponseData;
|
import com.hivekion.common.entity.ResponseData;
|
||||||
import com.hivekion.common.entity.TreeEntity;
|
import com.hivekion.common.entity.TreeEntity;
|
||||||
import com.hivekion.common.entity.TreeNode;
|
import com.hivekion.common.entity.TreeNode;
|
||||||
|
import com.hivekion.guarantee.entity.Safeguardclassdata;
|
||||||
|
import com.hivekion.guarantee.service.SafeguardclassdataService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
|
@ -27,9 +29,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class TreeController {
|
public class TreeController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITblEntityService tblEntityService;
|
private ITblEntityService tblEntityService; //装备服务类
|
||||||
@Resource
|
@Resource
|
||||||
private FightpowerhierarchyService fightpowerhierarchyService;
|
private FightpowerhierarchyService fightpowerhierarchyService; //组织架构服务类
|
||||||
|
@Resource
|
||||||
|
private SafeguardclassdataService safeguardclassdataService; //保障服务类
|
||||||
|
|
||||||
@GetMapping("/armament")
|
@GetMapping("/armament")
|
||||||
@ApiOperation(value = "装备树", notes = "")
|
@ApiOperation(value = "装备树", notes = "")
|
||||||
|
@ -54,9 +58,10 @@ public class TreeController {
|
||||||
|
|
||||||
@GetMapping("/organization")
|
@GetMapping("/organization")
|
||||||
@ApiOperation(value = "组织机构树", notes = "")
|
@ApiOperation(value = "组织机构树", notes = "")
|
||||||
public ResponseData<List<TreeNode>> organizedTree(Integer id) {
|
public ResponseData<List<TreeNode>> organizedTree(Integer id, Integer unitType) {
|
||||||
List<TreeNode> nodeList = new ArrayList<>();
|
List<TreeNode> nodeList = new ArrayList<>();
|
||||||
List<Fightpowerhierarchy> organizationList = fightpowerhierarchyService.list();
|
List<Fightpowerhierarchy> organizationList = fightpowerhierarchyService.listByUnitType(
|
||||||
|
unitType);
|
||||||
//排序
|
//排序
|
||||||
organizationList.sort(Comparator.comparingInt(Fightpowerhierarchy::getId));
|
organizationList.sort(Comparator.comparingInt(Fightpowerhierarchy::getId));
|
||||||
addTreeNodeToList(nodeList, id, organizationList);
|
addTreeNodeToList(nodeList, id, organizationList);
|
||||||
|
@ -66,7 +71,8 @@ public class TreeController {
|
||||||
/**
|
/**
|
||||||
* 增加树节点到list
|
* 增加树节点到list
|
||||||
*/
|
*/
|
||||||
private <T extends TreeEntity> void addTreeNodeToList(List<TreeNode> nodeList, Integer id, List<T> list) {
|
private <T extends TreeEntity> void addTreeNodeToList(List<TreeNode> nodeList, Integer id,
|
||||||
|
List<T> list) {
|
||||||
Map<Integer, T> entityMap = idMap(list);
|
Map<Integer, T> entityMap = idMap(list);
|
||||||
Map<Integer, List<T>> parentMap = parentIdMap(list);
|
Map<Integer, List<T>> parentMap = parentIdMap(list);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
|
@ -95,7 +101,8 @@ public class TreeController {
|
||||||
buildRecursionArmamentTree(node, parentMap);
|
buildRecursionArmamentTree(node, parentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends TreeEntity> void buildRecursionArmamentTree(TreeNode info, Map<Integer, List<T>> parentMap) {
|
private <T extends TreeEntity> void buildRecursionArmamentTree(TreeNode info,
|
||||||
|
Map<Integer, List<T>> parentMap) {
|
||||||
Integer key = Integer.parseInt(info.getKey());
|
Integer key = Integer.parseInt(info.getKey());
|
||||||
if (parentMap.containsKey(key)) {
|
if (parentMap.containsKey(key)) {
|
||||||
List<TreeNode> children = new ArrayList<>();
|
List<TreeNode> children = new ArrayList<>();
|
||||||
|
@ -121,4 +128,15 @@ public class TreeController {
|
||||||
return a.getParentId();
|
return a.getParentId();
|
||||||
}, LinkedHashMap::new, Collectors.toList()));
|
}, LinkedHashMap::new, Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/guaranteeTree")
|
||||||
|
@ApiOperation(value = "保障单位树", notes = "")
|
||||||
|
public ResponseData<List<TreeNode>> guaranteeTree(
|
||||||
|
@ApiParam(value = "父节点ID,指定从哪个节点开始返回保障单位") Integer id) {
|
||||||
|
List<TreeNode> nodeList = new ArrayList<>();
|
||||||
|
List<Safeguardclassdata> guaranteeList = safeguardclassdataService.list();
|
||||||
|
guaranteeList.sort(Comparator.comparingInt(Safeguardclassdata::getId));
|
||||||
|
addTreeNodeToList(nodeList, id, guaranteeList);
|
||||||
|
return ResponseData.success(nodeList);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -305,5 +305,12 @@ public class Fightpowerhierarchy extends TreeEntity {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部队属性 部队属性 1 - 作战部队 2-保障部队
|
||||||
|
*/
|
||||||
|
private Integer unittype;
|
||||||
|
|
||||||
|
public void setFlag(int flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,5 @@ import java.util.List;
|
||||||
public interface FightpowerhierarchyService extends IService<Fightpowerhierarchy> {
|
public interface FightpowerhierarchyService extends IService<Fightpowerhierarchy> {
|
||||||
|
|
||||||
List<Fightpowerhierarchy> queryChildRen(Integer id);
|
List<Fightpowerhierarchy> queryChildRen(Integer id);
|
||||||
|
List<Fightpowerhierarchy> listByUnitType(Integer unitType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,4 +27,13 @@ public class FightpowerhierarchyServiceImpl extends
|
||||||
queryWrapper.eq("parent_id", id);
|
queryWrapper.eq("parent_id", id);
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Fightpowerhierarchy> listByUnitType(Integer unitType) {
|
||||||
|
QueryWrapper<Fightpowerhierarchy> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (unitType != null) {
|
||||||
|
queryWrapper.eq("unittype", unitType);
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user