Commit 8ff0ae47 authored by chenzhao's avatar chenzhao

适用类型 树接口

parent d8fd4b2a
...@@ -192,10 +192,58 @@ public class InputItem extends BasicEntity { ...@@ -192,10 +192,58 @@ public class InputItem extends BasicEntity {
// 重点类型 // 重点类型
@Column(name = "key_parts_type") @Column(name = "key_parts_type")
private String keyPartsType; private String keyPartsType;
//自定义类型 //自定义类型
@Column(name = "custom_type") @Column(name = "custom_type")
private String customType; private String customType;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
public String getCustomType() {
return customType;
}
public void setCustomType(String customType) {
this.customType = customType;
}
......
...@@ -7,6 +7,7 @@ import java.util.HashSet; ...@@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -291,6 +292,71 @@ public class EquipmentCategoryController extends AbstractBaseController { ...@@ -291,6 +292,71 @@ public class EquipmentCategoryController extends AbstractBaseController {
return list; return list;
} }
/**
* 除消防设施全量数据树形结构返回
*
* @return
*/
@RequestMapping(value = "/equip-tree", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "除消防设施全量数据树形结构返回", notes = "除消防设施全量数据树形结构返回")
public List<EquipmentCategory> listEquip() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListNotFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
if (action.getParentId() == null) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
return list;
}
/**
* 消防设施分类定义树
*
* @return
*/
@RequestMapping(value = "/list-tree-fire", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防设施分类定义树", notes = "消防设施分类定义树")
public List<EquipmentCategory> listFire() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListByFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
if (action.getName().equals("消防设施")) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
return list;
}
/** /**
* *
* 获取子节点 * 获取子节点
......
...@@ -53,6 +53,10 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -53,6 +53,10 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
int checkUsed( String id ); int checkUsed( String id );
List<EquipmentCategory> getEquipmentCategoryList(Integer head); List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head);
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head);
List<EquipmentCategory> getEquipmentCategoryCarList(); List<EquipmentCategory> getEquipmentCategoryCarList();
List<EquipmentCategory> getEquipmentCategoryEquipmentList(); List<EquipmentCategory> getEquipmentCategoryEquipmentList();
......
...@@ -47,6 +47,10 @@ public interface IEquipmentCategoryService extends IService<EquipmentCategory> { ...@@ -47,6 +47,10 @@ public interface IEquipmentCategoryService extends IService<EquipmentCategory> {
List<EquipmentCategory> getEquipmentCategoryList(Integer head); List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) ;
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) ;
/** /**
* 根据分类定义id获取对应所有子分类id * 根据分类定义id获取对应所有子分类id
* *
......
...@@ -391,6 +391,16 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM ...@@ -391,6 +391,16 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM
return this.baseMapper.getEquipmentCategoryList(head); return this.baseMapper.getEquipmentCategoryList(head);
} }
public List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) {
return this.baseMapper.getEquipmentCategoryListNotFacilities(head);
}
public List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) {
return this.baseMapper.getEquipmentCategoryListByFacilities(head);
}
@Override @Override
public List<Long> getAllChildCategoryIdList(Long categoryId) { public List<Long> getAllChildCategoryIdList(Long categoryId) {
return this.baseMapper.getAllChildCategoryIdList(categoryId); return this.baseMapper.getAllChildCategoryIdList(categoryId);
......
...@@ -304,6 +304,48 @@ ...@@ -304,6 +304,48 @@
left join wl_industry i on ec.industry_code = i.code left join wl_industry i on ec.industry_code = i.code
</select> </select>
<select id="getEquipmentCategoryListNotFacilities" resultMap="Category">
SELECT ec.id,
ec.parent_id,
ec.CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
ec.industry_code,
ec.remark,
ec.create_date,
i.`name` as industryName,
-- industry_code = 2代表消防设备
IF(LEFT(ec.CODE, 1) = #{head} and ec.industry_code = 2, 'car', 'equipment')
AS type
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE
ec.code NOT LIKE CONCAT ('930','%')
</select>
<select id="getEquipmentCategoryListByFacilities" resultMap="Category">
SELECT ec.id,
ec.parent_id,
ec.CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
ec.industry_code,
ec.remark,
ec.create_date,
i.`name` as industryName,
-- industry_code = 2代表消防设备
IF(LEFT(ec.CODE, 1) = #{head} and ec.industry_code = 2, 'car', 'equipment')
AS type
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE
ec.code LIKE CONCAT ('930','%')
</select>
<select id="getEquipmentCategoryCarList" resultMap="Category"> <select id="getEquipmentCategoryCarList" resultMap="Category">
SELECT SELECT
id, id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment