fix(province): improve error handling and logging in equipment configuration retrieval
This commit is contained in:
parent
97eb09437b
commit
8c16a8b9e7
|
|
@ -191,45 +191,56 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
if (devices == null || devices.isEmpty()) continue;
|
if (devices == null || devices.isEmpty()) continue;
|
||||||
|
|
||||||
Ownerdomin first = devices.get(0);
|
Ownerdomin first = devices.get(0);
|
||||||
|
if (first == null || first.getCompanyId() == null || first.getMaName() == null) {
|
||||||
|
log.warn("设备信息不完整,跳过处理: companyId={}, devices={}", key, devices);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Long companyId = first.getCompanyId();
|
Long companyId = first.getCompanyId();
|
||||||
String maName = first.getMaName();
|
String maName = first.getMaName();
|
||||||
|
|
||||||
// 从 devInfo 中找公司名称
|
// 从 devInfo 中找公司名称,添加空值检查
|
||||||
Optional<NewOwnerdomin> matchDev = ownListFromDevInfo.stream()
|
Optional<NewOwnerdomin> matchDev = ownListFromDevInfo.stream()
|
||||||
.filter(d -> d.getCompanyId() == companyId.intValue() && d.getMaName().equals(maName))
|
.filter(d -> d != null && d.getMaName() != null &&
|
||||||
|
d.getCompanyId() == companyId.intValue() && maName.equals(d.getMaName()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司");
|
String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司");
|
||||||
|
|
||||||
// 获取或创建公司维度的汇总对象 如果这个公司没统计对象,就创建一个
|
// 获取或创建公司维度的汇总对象
|
||||||
DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> {
|
DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> {
|
||||||
DeptConfigRateSummary d = new DeptConfigRateSummary();
|
DeptConfigRateSummary d = new DeptConfigRateSummary();
|
||||||
d.setDeptName(companyName);
|
d.setDeptName(companyName);
|
||||||
// d.setConfigType(entry.getValue().get(0).getCompanyId());
|
|
||||||
d.setCompanyId(companyId);
|
d.setCompanyId(companyId);
|
||||||
d.setCompanyName(companyName);
|
d.setCompanyName(companyName);
|
||||||
d.setValueA(BigDecimal.ZERO);
|
d.setValueA(BigDecimal.ZERO);
|
||||||
d.setValueB(BigDecimal.ZERO);
|
d.setValueB(BigDecimal.ZERO);
|
||||||
d.setValueC(BigDecimal.ZERO);
|
d.setValueC(BigDecimal.ZERO);
|
||||||
|
d.setConfigType(BigDecimal.ZERO); // 设置默认的配置类型
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 汇总订单数量
|
// 汇总订单数量,添加空值处理
|
||||||
BigDecimal orderCount = devices.stream()
|
BigDecimal orderCount = devices.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.map(d -> Optional.ofNullable(d.getOrderCount()).orElse(BigDecimal.ZERO))
|
.map(d -> Optional.ofNullable(d.getOrderCount()).orElse(BigDecimal.ZERO))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
// 构造“临时配置项”用于计算
|
// 构造"临时配置项"用于计算
|
||||||
DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary();
|
DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary();
|
||||||
// 假设你已经找到了匹配的 NewOwnerdomin 对象 matchDev
|
dummyConfig.setFullScore(matchDev.map(NewOwnerdomin::getFullScore)
|
||||||
BigDecimal fullScore = matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN);
|
.filter(Objects::nonNull)
|
||||||
BigDecimal baseNum = matchDev.map(NewOwnerdomin::getBaseNum).orElse(BigDecimal.ONE);
|
.orElse(BigDecimal.TEN));
|
||||||
dummyConfig.setFullScore(fullScore);
|
|
||||||
dummyConfig.setOrderCount(orderCount);
|
dummyConfig.setOrderCount(orderCount);
|
||||||
dummyConfig.setDeptName(maName);
|
dummyConfig.setDeptName(maName);
|
||||||
dummyConfig.setCompanyId(companyId);
|
dummyConfig.setCompanyId(companyId);
|
||||||
dummyConfig.setCompanyName(companyName);
|
dummyConfig.setCompanyName(companyName);
|
||||||
|
dummyConfig.setConfigValue(matchDev.map(NewOwnerdomin::getBaseNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.orElse(BigDecimal.ONE));
|
||||||
|
dummyConfig.setConfigRate(matchDev.map(NewOwnerdomin::getFullScore)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.orElse(BigDecimal.TEN));
|
||||||
// 计算得分
|
// 计算得分
|
||||||
BigDecimal score = computeScoreByMaName(orderCount, devices, dummyConfig, "0");
|
BigDecimal score = computeScoreByMaName(orderCount, devices, dummyConfig, "0");
|
||||||
|
|
||||||
|
|
@ -328,19 +339,19 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
if (limitedType && result.compareTo(new BigDecimal("20")) > 0) {
|
if (limitedType && result.compareTo(new BigDecimal("20")) > 0) {
|
||||||
result = new BigDecimal("20.00");
|
result = new BigDecimal("20.00");
|
||||||
}
|
}
|
||||||
System.out.println("【配置率计算明细】");
|
// System.out.println("【配置率计算明细】");
|
||||||
System.err.println("类型:" + config.getConfigType());
|
// System.err.println("类型:" + config.getConfigType());
|
||||||
System.out.println("设备名:" + config.getDeptName());
|
// System.out.println("设备名:" + config.getDeptName());
|
||||||
System.out.println("配置类型:" + config.getConfigType());
|
// System.out.println("配置类型:" + config.getConfigType());
|
||||||
System.out.println("自有数量合计(ownedTotal):" + ownedTotal);
|
// System.out.println("自有数量合计(ownedTotal):" + ownedTotal);
|
||||||
System.out.println("租赁数量合计(leasedTotal):" + leasedTotal);
|
// System.out.println("租赁数量合计(leasedTotal):" + leasedTotal);
|
||||||
System.out.println("订单数量(ordercount):" + ordercount);
|
// System.out.println("订单数量(ordercount):" + ordercount);
|
||||||
System.out.println("基本配置数量(base):" + base);
|
// System.out.println("基本配置数量(base):" + base);
|
||||||
System.out.println("满分值(score):" + score);
|
// System.out.println("满分值(score):" + score);
|
||||||
System.out.println("得分比例(rate):" + rate);
|
// System.out.println("得分比例(rate):" + rate);
|
||||||
System.out.println("是否为限制类型(3/4/5):" + limitedType);
|
// System.out.println("是否为限制类型(3/4/5):" + limitedType);
|
||||||
System.out.println("最终得分(result):" + result);
|
// System.out.println("最终得分(result):" + result);
|
||||||
System.out.println("--------------------------------------------------");
|
// System.out.println("--------------------------------------------------");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@ import com.bonus.material.device.domain.DevInfo;
|
||||||
import com.bonus.material.largeScreen.service.ProvinceScreenService;
|
import com.bonus.material.largeScreen.service.ProvinceScreenService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -19,6 +21,7 @@ import java.util.Map;
|
||||||
* @author 马三炮
|
* @author 马三炮
|
||||||
* @date 2025/9/14
|
* @date 2025/9/14
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(value = "网省大屏", tags = {"网省大屏"})
|
@Api(value = "网省大屏", tags = {"网省大屏"})
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/provinceScreen")
|
@RequestMapping("/provinceScreen")
|
||||||
|
|
@ -66,9 +69,15 @@ public class ProvinceScreenController extends BaseController {
|
||||||
public AjaxResult getUnitEquipmentConfiguration() {
|
public AjaxResult getUnitEquipmentConfiguration() {
|
||||||
try {
|
try {
|
||||||
List<Map<String,Object>> res = provinceScreenService.getUnitEquipmentConfiguration();
|
List<Map<String,Object>> res = provinceScreenService.getUnitEquipmentConfiguration();
|
||||||
|
if (res == null) {
|
||||||
|
logger.warn("单位装备配置数据为空");
|
||||||
|
return AjaxResult.success(new ArrayList<>());
|
||||||
|
}
|
||||||
return AjaxResult.success(res);
|
return AjaxResult.success(res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return AjaxResult.error("单位装备配置异常");
|
log.error("e: ", e);
|
||||||
|
logger.error("单位装备配置异常: ", e);
|
||||||
|
return AjaxResult.error("单位装备配置异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,52 +112,95 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String,Object>> getUnitEquipmentConfiguration() {
|
public List<Map<String,Object>> getUnitEquipmentConfiguration() {
|
||||||
//获取所有单位 TODO 后期可能单位放到字典表这里要修改
|
if (sysDeptMapper == null) {
|
||||||
|
log.error("sysDeptMapper is null");
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
SysDept sysDept = new SysDept();
|
SysDept sysDept = new SysDept();
|
||||||
DevInfoReq devInfoReq = new DevInfoReq();
|
DevInfoReq devInfoReq = new DevInfoReq();
|
||||||
List<SysDept> sysDeptList = sysDeptMapper.selectDeptList(sysDept);
|
List<SysDept> sysDeptList = sysDeptMapper.selectDeptList(sysDept);
|
||||||
|
|
||||||
|
if (sysDeptList == null) {
|
||||||
|
log.error("未找到部门数据");
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String,Object>> res = new ArrayList<>();
|
List<Map<String,Object>> res = new ArrayList<>();
|
||||||
for (SysDept sysDeptNew : sysDeptList) {
|
for (SysDept sysDeptNew : sysDeptList) {
|
||||||
Map<String,Object> dept = new HashMap<>();
|
if (sysDeptNew == null || sysDeptNew.getDeptId() == null) {
|
||||||
|
log.warn("跳过无效的部门数据");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
dept.put("deptName",sysDeptNew.getDeptName());
|
Map<String,Object> dept = new HashMap<>();
|
||||||
|
dept.put("deptName", sysDeptNew.getDeptName() != null ? sysDeptNew.getDeptName() : "未知部门");
|
||||||
devInfoReq.setOwnCo(Math.toIntExact(sysDeptNew.getDeptId()));
|
devInfoReq.setOwnCo(Math.toIntExact(sysDeptNew.getDeptId()));
|
||||||
|
|
||||||
// 装备价值
|
// 装备价值
|
||||||
BigDecimal totalValue = devInfoMapper.getTotalValue(devInfoReq);
|
BigDecimal totalValue = devInfoMapper.getTotalValue(devInfoReq);
|
||||||
dept.put("totalValue",totalValue);
|
dept.put("totalValue", totalValue != null ? totalValue : BigDecimal.ZERO);
|
||||||
|
|
||||||
// 装备总数
|
// 装备总数
|
||||||
Integer totalEquipmentQuantity = devInfoMapper.getTotalEquipment(devInfoReq);
|
Integer totalEquipmentQuantity = devInfoMapper.getTotalEquipment(devInfoReq);
|
||||||
dept.put("totalEquipmentQuantity",totalEquipmentQuantity);
|
dept.put("totalEquipmentQuantity", totalEquipmentQuantity != null ? totalEquipmentQuantity : 0);
|
||||||
|
|
||||||
// 线路
|
// 线路
|
||||||
devInfoReq.setTypeId(1);
|
devInfoReq.setTypeId(1);
|
||||||
int lineNum = devInfoMapper.getLineNum(devInfoReq);
|
int lineNum = devInfoMapper.getLineNum(devInfoReq);
|
||||||
dept.put("lineNum", lineNum);
|
dept.put("lineNum", lineNum);
|
||||||
|
|
||||||
// 变电
|
// 变电
|
||||||
devInfoReq.setTypeId(2);
|
devInfoReq.setTypeId(2);
|
||||||
int substationNum = devInfoMapper.getLineNum(devInfoReq);
|
int substationNum = devInfoMapper.getLineNum(devInfoReq);
|
||||||
dept.put("substationNum", substationNum);
|
dept.put("substationNum", substationNum);
|
||||||
|
|
||||||
// 电缆
|
// 电缆
|
||||||
devInfoReq.setTypeId(3);
|
devInfoReq.setTypeId(3);
|
||||||
int cableNum = devInfoMapper.getLineNum(devInfoReq);
|
int cableNum = devInfoMapper.getLineNum(devInfoReq);
|
||||||
dept.put("cableNum", cableNum);
|
dept.put("cableNum", cableNum);
|
||||||
|
|
||||||
// 所在城市
|
// 所在城市
|
||||||
String cityName = sysDeptMapper.getCityName(sysDeptNew.getCity());
|
String cityName = sysDeptMapper.getCityName(sysDeptNew.getCity());
|
||||||
dept.put("cityName",cityName);
|
dept.put("cityName", cityName != null ? cityName : "未知城市");
|
||||||
|
|
||||||
// 获取装备转换率
|
// 获取装备转换率
|
||||||
|
try {
|
||||||
DeptConfigRateSummary user = new DeptConfigRateSummary();
|
DeptConfigRateSummary user = new DeptConfigRateSummary();
|
||||||
List<DeptConfigRateSummary> list = sysDeptService.selectDeptConfigRatePivot(user);
|
List<DeptConfigRateSummary> list = sysDeptService.selectDeptConfigRatePivot(user);
|
||||||
|
|
||||||
|
if (list != null) {
|
||||||
for (DeptConfigRateSummary deptConfigRateSummary : list) {
|
for (DeptConfigRateSummary deptConfigRateSummary : list) {
|
||||||
if (deptConfigRateSummary.getDeptId().equals(sysDeptNew.getDeptId())){
|
if (deptConfigRateSummary != null &&
|
||||||
|
deptConfigRateSummary.getDeptId() != null &&
|
||||||
|
deptConfigRateSummary.getDeptId().equals(sysDeptNew.getDeptId()))
|
||||||
|
{
|
||||||
|
|
||||||
// 总数
|
// 总数
|
||||||
dept.put("configRate",deptConfigRateSummary.getConfigRate());
|
dept.put("configRate", deptConfigRateSummary.getConfigRate() != null ?
|
||||||
|
deptConfigRateSummary.getConfigRate() : 0.0);
|
||||||
// 线路
|
// 线路
|
||||||
dept.put("valueA",deptConfigRateSummary.getValueA());
|
dept.put("valueA", deptConfigRateSummary.getValueA() != null ?
|
||||||
|
deptConfigRateSummary.getValueA() : 0.0);
|
||||||
// 变电
|
// 变电
|
||||||
dept.put("valueA",deptConfigRateSummary.getValueB());
|
dept.put("valueB", deptConfigRateSummary.getValueB() != null ?
|
||||||
|
deptConfigRateSummary.getValueB() : 0.0);
|
||||||
// 电缆
|
// 电缆
|
||||||
dept.put("valueA",deptConfigRateSummary.getValueC());
|
dept.put("valueC", deptConfigRateSummary.getValueC() != null ?
|
||||||
|
deptConfigRateSummary.getValueC() : 0.0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取装备转换率异常: " + e.getMessage(), e);
|
||||||
|
// 设置默认值
|
||||||
|
dept.put("configRate", 0.0);
|
||||||
|
dept.put("valueA", 0.0);
|
||||||
|
dept.put("valueB", 0.0);
|
||||||
|
dept.put("valueC", 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
res.add(dept);
|
res.add(dept);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -200,7 +243,7 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
res.add(res2);
|
res.add(res2);
|
||||||
res.add(res3);
|
res.add(res3);
|
||||||
res.add(res4);
|
res.add(res4);
|
||||||
return null;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -262,23 +305,20 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
res.add(dept);
|
res.add(dept);
|
||||||
}
|
}
|
||||||
// 【核心排序逻辑】按proportion数值降序排序(高在用率优先)
|
// 【核心排序逻辑】按proportion数值降序排序(高在用率优先)
|
||||||
Collections.sort(res, new Comparator<Map<String, Object>>() {
|
// res.sort((map1, map2) -> {
|
||||||
@Override
|
// // 1. 提取两个map中的proportion字符串
|
||||||
public int compare(Map<String, Object> map1, Map<String, Object> map2) {
|
// String proportion1 = (String) map1.get("proportion");
|
||||||
// 1. 提取两个map中的proportion字符串
|
// String proportion2 = (String) map2.get("proportion");
|
||||||
String proportion1 = (String) map1.get("proportion");
|
// // 2. 处理null值(默认视为0%)
|
||||||
String proportion2 = (String) map2.get("proportion");
|
// proportion1 = proportion1 == null ? "0%" : proportion1;
|
||||||
// 2. 处理null值(默认视为0%)
|
// proportion2 = proportion2 == null ? "0%" : proportion2;
|
||||||
proportion1 = proportion1 == null ? "0%" : proportion1;
|
// // 3. 去掉"%"符号,转为Integer数值(核心步骤)
|
||||||
proportion2 = proportion2 == null ? "0%" : proportion2;
|
// // 注意:若proportion含小数(如"83.5%"),需转为Double,此处按整数处理(适配原代码逻辑)
|
||||||
// 3. 去掉"%"符号,转为Integer数值(核心步骤)
|
// int propValue1 = Integer.parseInt(proportion1.replace("%", ""));
|
||||||
// 注意:若proportion含小数(如"83.5%"),需转为Double,此处按整数处理(适配原代码逻辑)
|
// int propValue2 = Integer.parseInt(proportion2.replace("%", ""));
|
||||||
int propValue1 = Integer.parseInt(proportion1.replace("%", ""));
|
// // 4. 数值降序排序(高在用率在前);升序用:propValue1 - propValue2
|
||||||
int propValue2 = Integer.parseInt(proportion2.replace("%", ""));
|
// return propValue2 - propValue1;
|
||||||
// 4. 数值降序排序(高在用率在前);升序用:propValue1 - propValue2
|
// });
|
||||||
return propValue2 - propValue1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,7 +343,7 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
List<MaType> maTypeList = new ArrayList<>();
|
List<MaType> maTypeList = new ArrayList<>();
|
||||||
//获取装备在用率 查询全部
|
//获取装备在用率 查询全部
|
||||||
if (StringUtils.isNull(type)){
|
if (StringUtils.isNull(type)){
|
||||||
maTypeList = maTypeMapper.selectMaTypeTreeBy5Level(type);
|
maTypeList = maTypeMapper.selectMaTypeTreeBy5Level(null);
|
||||||
}else {
|
}else {
|
||||||
maTypeList = maTypeMapper.selectMaTypeTreeBy5Level2(type);
|
maTypeList = maTypeMapper.selectMaTypeTreeBy5Level2(type);
|
||||||
}
|
}
|
||||||
|
|
@ -330,9 +370,7 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 【核心排序逻辑】按proportion数值降序排序(高在用率优先)
|
// 【核心排序逻辑】按proportion数值降序排序(高在用率优先)
|
||||||
Collections.sort(res, new Comparator<Map<String, Object>>() {
|
res.sort((map1, map2) -> {
|
||||||
@Override
|
|
||||||
public int compare(Map<String, Object> map1, Map<String, Object> map2) {
|
|
||||||
// 1. 提取两个map中的proportion字符串
|
// 1. 提取两个map中的proportion字符串
|
||||||
String proportion1 = (String) map1.get("proportion");
|
String proportion1 = (String) map1.get("proportion");
|
||||||
String proportion2 = (String) map2.get("proportion");
|
String proportion2 = (String) map2.get("proportion");
|
||||||
|
|
@ -345,9 +383,8 @@ public class ProvinceScreenServiceImpl implements ProvinceScreenService {
|
||||||
int propValue2 = Integer.parseInt(proportion2.replace("%", ""));
|
int propValue2 = Integer.parseInt(proportion2.replace("%", ""));
|
||||||
// 4. 数值降序排序(高在用率在前);升序用:propValue1 - propValue2
|
// 4. 数值降序排序(高在用率在前);升序用:propValue1 - propValue2
|
||||||
return propValue2 - propValue1;
|
return propValue2 - propValue1;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return res;
|
return res.subList(0,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -621,16 +621,14 @@
|
||||||
<select id="selectMaTypeTreeBy5Level" resultType="com.bonus.material.ma.vo.MaType">
|
<select id="selectMaTypeTreeBy5Level" resultType="com.bonus.material.ma.vo.MaType">
|
||||||
select type_id, type_name from ma_type where del_flag = '0' and level = '5'
|
select type_id, type_name from ma_type where del_flag = '0' and level = '5'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMaTypeTreeBy5Level2" resultType="com.bonus.material.ma.vo.MaType">
|
<select id="selectMaTypeTreeBy5Level2" resultType="com.bonus.material.ma.vo.MaType">
|
||||||
select mt.type_id, mt.type_name
|
select
|
||||||
from ma_type mt
|
mtv.typeId, mtv.devSubcategory as typeName
|
||||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
from
|
||||||
left join ma_type mt2 on mt1.parent_id = mt2.type_id
|
ma_type_view mtv
|
||||||
left join ma_type mt3 on mt2.parent_id = mt3.type_id
|
<if test="type != null and type != 0">
|
||||||
left join ma_type mt4 on mt3.parent_id = mt4.type_id
|
where mtv.maxTypeId = #{type}
|
||||||
where mt.del_flag = '0'
|
|
||||||
<if test="type != null ">
|
|
||||||
AND mt4.type_id = #{type}
|
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue