装备类型调整

This commit is contained in:
syruan 2025-09-18 20:09:01 +08:00
parent a08a45b216
commit bd3f58d888
7 changed files with 80 additions and 115 deletions

View File

@ -36,7 +36,8 @@ import java.util.stream.Collectors;
public class SysDeptServiceImpl implements ISysDeptService { public class SysDeptServiceImpl implements ISysDeptService {
private static final Logger log = LoggerFactory.getLogger(SysDeptServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(SysDeptServiceImpl.class);
@Autowired
@Resource
private SysDeptMapper mapper; private SysDeptMapper mapper;
@Resource @Resource
@ -126,7 +127,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
for (DeptConfigRateSummary config : configList) { for (DeptConfigRateSummary config : configList) {
String company = config.getCompanyName(); String company = config.getCompanyName();
String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电
String maName = config.getDeptName();
String typeId = config.getTypeId(); String typeId = config.getTypeId();
BigDecimal orderCount = config.getOrderCount(); BigDecimal orderCount = config.getOrderCount();
Long configCompanyId = config.getCompanyId(); Long configCompanyId = config.getCompanyId();
@ -231,19 +231,13 @@ public class SysDeptServiceImpl implements ISysDeptService {
// 构造"临时配置项"用于计算 // 构造"临时配置项"用于计算
DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary(); DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary();
dummyConfig.setFullScore(matchDev.map(NewOwnerdomin::getFullScore) dummyConfig.setFullScore(matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN));
.filter(Objects::nonNull)
.orElse(BigDecimal.TEN));
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) dummyConfig.setConfigValue(matchDev.map(NewOwnerdomin::getBaseNum).orElse(BigDecimal.ONE));
.filter(Objects::nonNull) dummyConfig.setConfigRate(matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN));
.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");
@ -325,16 +319,16 @@ public class SysDeptServiceImpl implements ISysDeptService {
} }
// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量 // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量
BigDecimal rate = ownedTotal BigDecimal rate = ownedTotal
.add(leasedTotal.multiply(new BigDecimal("0.6"))) .add(leasedTotal.multiply(new BigDecimal("0.6")))
.add(ordercount.multiply(new BigDecimal("0.9"))) .add(ordercount.multiply(new BigDecimal("0.9")))
.divide(base, 4, RoundingMode.HALF_UP); .divide(base, 4, RoundingMode.HALF_UP);
// 计算原始得分 // 计算原始得分
BigDecimal result = rate.multiply(score).setScale(2, RoundingMode.HALF_UP); BigDecimal result = rate.multiply(score).setScale(2, RoundingMode.HALF_UP);
// 限制得分不超过满分且如果是 3/4/5 类型不能超过 20 // 限制得分不超过满分且如果是 3/4/5 类型不能超过 20
if (rate.compareTo(BigDecimal.ONE) > 0) { if (rate.compareTo(BigDecimal.ONE) > 0) {
result = score.setScale(2, RoundingMode.HALF_UP); result = score.setScale(2, RoundingMode.HALF_UP);
} }
@ -424,6 +418,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
BaseEntity entity = CommonDataPermissionInfo.backMissionInfo(dept.getParams().get("dataScope").toString()); BaseEntity entity = CommonDataPermissionInfo.backMissionInfo(dept.getParams().get("dataScope").toString());
BeanUtils.copyProperties(entity, dept); BeanUtils.copyProperties(entity, dept);
} catch (Exception e) { } catch (Exception e) {
log.error("类型转换失败:", e);
e.printStackTrace(); e.printStackTrace();
} }
if (dept.getDeptName() != null) { if (dept.getDeptName() != null) {
@ -470,7 +465,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
List<SysDept> tlist = new ArrayList<>(); List<SysDept> tlist = new ArrayList<>();
for (SysDept n : list) { for (SysDept n : list) {
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
tlist.add((SysDeptVO) n); tlist.add(n);
} }
} }
return tlist; return tlist;

View File

@ -216,8 +216,8 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "根据左列表类型id查询右表格") @ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getList") @GetMapping("/getList")
public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level) { public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level, @RequestParam(value = "typeId", required = false) Integer parentId) {
List<MaType> listByMaType = iTypeService.getList(typeName,level); List<MaType> listByMaType = iTypeService.getList(typeName,level,parentId);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));

View File

@ -95,7 +95,7 @@ public interface MaTypeMapper {
int insertMaTypePropertyNames(@Param("typeId") Long typeId, @Param("list") List<MaTypeProperty> properties); int insertMaTypePropertyNames(@Param("typeId") Long typeId, @Param("list") List<MaTypeProperty> properties);
List<MaType> getList(@Param("typeName") String typeName, @Param("level") Integer level); List<MaType> getList(@Param("typeName") String typeName, @Param("level") Integer level, @Param("parentId") Integer parentId);
List<MaType> selectMaTypeTreeBy5Level(Integer type); List<MaType> selectMaTypeTreeBy5Level(Integer type);

View File

@ -75,5 +75,5 @@ public interface ITypeService {
AjaxResult updateProperties(MaType maType); AjaxResult updateProperties(MaType maType);
List<MaType> getList(String typeName,Integer level); List<MaType> getList(String typeName,Integer level, Integer parentId);
} }

View File

@ -65,11 +65,6 @@ public class MaTypeServiceImpl implements ITypeService {
} }
maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); maType.setLevel(String.valueOf(Integer.parseInt(level) + 1));
maType.setCreateTime(DateUtils.getNowDate()); maType.setCreateTime(DateUtils.getNowDate());
if (parentId == 0) {
maType.setCompanyId("101");
} else {
maType.setCompanyId(maType1.getCompanyId());
}
int i = maTypeMapper.insertType(maType); int i = maTypeMapper.insertType(maType);
Long typeId = maType.getTypeId(); Long typeId = maType.getTypeId();
// 图片路径保存 // 图片路径保存
@ -93,22 +88,22 @@ public class MaTypeServiceImpl implements ITypeService {
typeFileMapper.insertMaTypeFile(typeFile1); typeFileMapper.insertMaTypeFile(typeFile1);
} }
// 库管员配置 // 库管员配置
if (Objects.nonNull(maType.getKeeperUserId())) { // if (Objects.nonNull(maType.getKeeperUserId())) {
MaTypeKeeper typeKeeper = new MaTypeKeeper(); // MaTypeKeeper typeKeeper = new MaTypeKeeper();
typeKeeper.setUserId(maType.getKeeperUserId()); // typeKeeper.setUserId(maType.getKeeperUserId());
typeKeeper.setTypeId(typeId); // typeKeeper.setTypeId(typeId);
typeKeeper.setCreateTime(DateUtils.getNowDate()); // typeKeeper.setCreateTime(DateUtils.getNowDate());
maTypeMapper.insertKeeper(typeKeeper); // maTypeMapper.insertKeeper(typeKeeper);
} // }
// 维修员配置 // 维修员配置
if (Objects.nonNull(maType.getRepairUserId())) { // if (Objects.nonNull(maType.getRepairUserId())) {
MaTypeRepair typeRepair = new MaTypeRepair(); // MaTypeRepair typeRepair = new MaTypeRepair();
typeRepair.setUserId(maType.getRepairUserId()); // typeRepair.setUserId(maType.getRepairUserId());
typeRepair.setTypeId(typeId); // typeRepair.setTypeId(typeId);
typeRepair.setCreateTime(DateUtils.getNowDate()); // typeRepair.setCreateTime(DateUtils.getNowDate());
maTypeMapper.insertRepair(typeRepair); // maTypeMapper.insertRepair(typeRepair);
} // }
// 资产属性配置 // 资产属性配置
if (maType.getPropId() > 0) { if (maType.getPropId() > 0) {
@ -165,24 +160,24 @@ public class MaTypeServiceImpl implements ITypeService {
typeFileMapper.insertMaTypeFile(typeFile1); typeFileMapper.insertMaTypeFile(typeFile1);
} }
// 库管员配置 // 库管员配置
if (maType.getKeeperUserId() != null) { // if (maType.getKeeperUserId() != null) {
maTypeMapper.deleteKeeperByTypeId(typeId); // maTypeMapper.deleteKeeperByTypeId(typeId);
MaTypeKeeper typeKeeper = new MaTypeKeeper(); // MaTypeKeeper typeKeeper = new MaTypeKeeper();
typeKeeper.setUserId(maType.getKeeperUserId()); // typeKeeper.setUserId(maType.getKeeperUserId());
typeKeeper.setTypeId(typeId); // typeKeeper.setTypeId(typeId);
typeKeeper.setCreateTime(DateUtils.getNowDate()); // typeKeeper.setCreateTime(DateUtils.getNowDate());
typeKeeper.setUpdateTime(DateUtils.getNowDate()); // typeKeeper.setUpdateTime(DateUtils.getNowDate());
maTypeMapper.insertKeeper(typeKeeper); // maTypeMapper.insertKeeper(typeKeeper);
} // }
// 维修员配置 // 维修员配置
if (maType.getRepairUserId() != null) { // if (maType.getRepairUserId() != null) {
maTypeMapper.deleteTypeByTypeId(typeId); // maTypeMapper.deleteTypeByTypeId(typeId);
MaTypeRepair typeRepair = new MaTypeRepair(); // MaTypeRepair typeRepair = new MaTypeRepair();
typeRepair.setUserId(maType.getRepairUserId()); // typeRepair.setUserId(maType.getRepairUserId());
typeRepair.setTypeId(typeId); // typeRepair.setTypeId(typeId);
maTypeMapper.insertRepair(typeRepair); // maTypeMapper.insertRepair(typeRepair);
} // }
// 资产属性配置 // 资产属性配置
if (maType.getPropId() >= 0L) { if (maType.getPropId() >= 0L) {
maTypeMapper.deletePropSetByTypeId(typeId); maTypeMapper.deletePropSetByTypeId(typeId);
@ -205,7 +200,7 @@ public class MaTypeServiceImpl implements ITypeService {
@Override @Override
public int deleteMaTypeByTypeId(Long typeId) throws Exception { public int deleteMaTypeByTypeId(Long typeId) throws Exception {
List<MaType> listByParentId = maTypeMapper.getListByParentId(typeId, ""); List<MaType> listByParentId = maTypeMapper.getListByParentId(typeId, "");
if (listByParentId.size() > 0) { if (!listByParentId.isEmpty()) {
throw new Exception("子级类型不为空!!!"); throw new Exception("子级类型不为空!!!");
} }
return maTypeMapper.deleteTypeById(typeId); return maTypeMapper.deleteTypeById(typeId);
@ -215,9 +210,8 @@ public class MaTypeServiceImpl implements ITypeService {
public List<TreeSelect> getMaTypeList(String typeName, String parentId) { public List<TreeSelect> getMaTypeList(String typeName, String parentId) {
List<MaType> maTypes = maTypeMapper.selectMaTypeTree(parentId); List<MaType> maTypes = maTypeMapper.selectMaTypeTree(parentId);
//填充自定义属性 //填充自定义属性
List<TreeSelect> treeSelectList = buildDeptTreeSelect(fillProperties(maTypes));
//如果没有查询到那么返回空 //如果没有查询到那么返回空
return treeSelectList; return buildDeptTreeSelect(fillProperties(maTypes));
} }
private List<MaType> fillProperties(List<MaType> maTypes) { private List<MaType> fillProperties(List<MaType> maTypes) {
@ -235,9 +229,8 @@ public class MaTypeServiceImpl implements ITypeService {
@Override @Override
public List<TreeSelect> getMaTypeSelect(String typeName, String parentId) { public List<TreeSelect> getMaTypeSelect(String typeName, String parentId) {
List<MaType> maTypes = maTypeMapper.getMaTypeSelect(parentId); List<MaType> maTypes = maTypeMapper.getMaTypeSelect(parentId);
List<TreeSelect> treeSelectList = buildDeptTreeSelect(maTypes);
//如果没有查询到那么返回空 //如果没有查询到那么返回空
return treeSelectList; return buildDeptTreeSelect(maTypes);
} }
@ -294,7 +287,7 @@ public class MaTypeServiceImpl implements ITypeService {
} }
} }
//如果还有父级递归查询 //如果还有父级递归查询
if (parentList.size() > 0) { if (!parentList.isEmpty()) {
return getTypeListByMaType(parentList, oldMaTypes, newMaTypes); return getTypeListByMaType(parentList, oldMaTypes, newMaTypes);
} else { } else {
List<MaType> result = new ArrayList<>(); List<MaType> result = new ArrayList<>();
@ -481,8 +474,8 @@ public class MaTypeServiceImpl implements ITypeService {
} }
@Override @Override
public List<MaType> getList(String typeName, Integer level) { public List<MaType> getList(String typeName, Integer level, Integer parentId) {
List<MaType> list = maTypeMapper.getList(typeName, level); List<MaType> list = maTypeMapper.getList(typeName, level, parentId);
return fillProperties(list); return fillProperties(list);
} }

View File

@ -69,12 +69,6 @@ public class MaType extends BaseEntity {
@ApiModelProperty(value = "实时库存") @ApiModelProperty(value = "实时库存")
private Integer storageNum; private Integer storageNum;
/**
* 计量单位id
*/
@ApiModelProperty(value = "计量单位id")
private String unitId;
/** /**
* 计量单位 * 计量单位
*/ */
@ -259,6 +253,12 @@ public class MaType extends BaseEntity {
@ApiModelProperty(value = "维修员名称") @ApiModelProperty(value = "维修员名称")
private String repairUserName; private String repairUserName;
/**
* 是否国网体系
*/
@ApiModelProperty(value = "0否 1是")
private Boolean isStateGrid;
/** /**
* 资产属性id * 资产属性id
*/ */

View File

@ -8,9 +8,7 @@
<result property="typeName" column="type_name"/> <result property="typeName" column="type_name"/>
<result property="parentId" column="parent_id"/> <result property="parentId" column="parent_id"/>
<result property="storageNum" column="storage_num"/> <result property="storageNum" column="storage_num"/>
<result property="companyId" column="company_id"/>
<result property="code" column="code"/> <result property="code" column="code"/>
<result property="unitId" column="unit_id"/>
<result property="unitName" column="unit_name"/> <result property="unitName" column="unit_name"/>
<result property="manageType" column="manage_type"/> <result property="manageType" column="manage_type"/>
<result property="leasePrice" column="lease_price"/> <result property="leasePrice" column="lease_price"/>
@ -43,7 +41,6 @@
storage_num, storage_num,
company_id, company_id,
code, code,
unit_id,
unit_name, unit_name,
manage_type, manage_type,
lease_price, lease_price,
@ -71,16 +68,13 @@
from ma_type from ma_type
</sql> </sql>
<insert id="insertType" parameterType="com.bonus.material.ma.vo.MaType" useGeneratedKeys="true" <insert id="insertType" parameterType="com.bonus.material.ma.vo.MaType" useGeneratedKeys="true" keyProperty="typeId">
keyProperty="typeId">
insert into ma_type insert into ma_type
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">type_name,</if> <if test="typeName != null and typeName != ''">type_name,</if>
<if test="parentId != null">parent_id,</if> <if test="parentId != null">parent_id,</if>
<if test="storageNum != null">storage_num,</if> <if test="storageNum != null">storage_num,</if>
<if test="companyId != null">company_id,</if> <if test="code != null">`code`,</if>
<if test="code != null">code,</if>
<if test="unitId != null">unit_id,</if>
<if test="unitName != null">unit_name,</if> <if test="unitName != null">unit_name,</if>
<if test="manageType != null">manage_type,</if> <if test="manageType != null">manage_type,</if>
<if test="leasePrice != null">lease_price,</if> <if test="leasePrice != null">lease_price,</if>
@ -88,7 +82,7 @@
<if test="rentPrice != null">rent_price,</if> <if test="rentPrice != null">rent_price,</if>
<if test="buyPrice != null">buy_price,</if> <if test="buyPrice != null">buy_price,</if>
<if test="payPrice != null">pay_price,</if> <if test="payPrice != null">pay_price,</if>
<if test="level != null">level,</if> <if test="level != null">`level`,</if>
<if test="ratedLoad != null">rated_load,</if> <if test="ratedLoad != null">rated_load,</if>
<if test="testLoad != null">test_load,</if> <if test="testLoad != null">test_load,</if>
<if test="holdingTime != null">holding_time,</if> <if test="holdingTime != null">holding_time,</if>
@ -99,6 +93,7 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="isPlan != null">is_plan,</if> <if test="isPlan != null">is_plan,</if>
<if test="isStateGrid != null">is_state_grid,</if>
<if test="isAncuo != null">is_ancuo,</if> <if test="isAncuo != null">is_ancuo,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="facModel != null">fac_model,</if> <if test="facModel != null">fac_model,</if>
@ -109,9 +104,7 @@
<if test="typeName != null and typeName != ''">#{typeName},</if> <if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="parentId != null">#{parentId},</if> <if test="parentId != null">#{parentId},</if>
<if test="storageNum != null">#{storageNum},</if> <if test="storageNum != null">#{storageNum},</if>
<if test="companyId != null">#{companyId},</if>
<if test="code != null">#{code},</if> <if test="code != null">#{code},</if>
<if test="unitId != null">#{unitId},</if>
<if test="unitName != null">#{unitName},</if> <if test="unitName != null">#{unitName},</if>
<if test="manageType != null">#{manageType},</if> <if test="manageType != null">#{manageType},</if>
<if test="leasePrice != null">#{leasePrice},</if> <if test="leasePrice != null">#{leasePrice},</if>
@ -130,6 +123,7 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="isPlan != null">#{isPlan},</if> <if test="isPlan != null">#{isPlan},</if>
<if test="isStateGrid != null">#{isStateGrid},</if>
<if test="isAncuo != null">#{isAncuo},</if> <if test="isAncuo != null">#{isAncuo},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="facModel != null">#{facModel},</if> <if test="facModel != null">#{facModel},</if>
@ -148,7 +142,6 @@
<if test="fileType != null and fileType != 0">file_type,</if> <if test="fileType != null and fileType != 0">file_type,</if>
<if test="userId != null and userId != 0">user_id,</if> <if test="userId != null and userId != 0">user_id,</if>
<if test="status != null and status != 0">status,</if> <if test="status != null and status != 0">status,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time create_time
)values( )values(
<if test="typeId != null and typeId != 0">#{typeId},</if> <if test="typeId != null and typeId != 0">#{typeId},</if>
@ -158,7 +151,6 @@
<if test="fileType != null and fileType != ''">#{fileType},</if> <if test="fileType != null and fileType != ''">#{fileType},</if>
<if test="userId != null and userId != 0">#{userId},</if> <if test="userId != null and userId != 0">#{userId},</if>
<if test="status != null and status != ''">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate() sysdate()
) )
</insert> </insert>
@ -169,7 +161,6 @@
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if> <if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="parentId != null">parent_id = #{parentId},</if> <if test="parentId != null">parent_id = #{parentId},</if>
<if test="storageNum != null">storage_num = #{storageNum},</if> <if test="storageNum != null">storage_num = #{storageNum},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="unitName != null">unit_name = #{unitName},</if> <if test="unitName != null">unit_name = #{unitName},</if>
<if test="manageType != null">manage_type = #{manageType},</if> <if test="manageType != null">manage_type = #{manageType},</if>
<if test="leasePrice != null">lease_price = #{leasePrice},</if> <if test="leasePrice != null">lease_price = #{leasePrice},</if>
@ -190,7 +181,6 @@
<if test="isPlan != null">is_plan = #{isPlan},</if> <if test="isPlan != null">is_plan = #{isPlan},</if>
<if test="isAncuo != null">is_ancuo = #{isAncuo},</if> <if test="isAncuo != null">is_ancuo = #{isAncuo},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="facModel != null">fac_model = #{facModel},</if> <if test="facModel != null">fac_model = #{facModel},</if>
<if test="intelligentCode != null">intelligent_code = #{intelligentCode},</if> <if test="intelligentCode != null">intelligent_code = #{intelligentCode},</if>
<if test="maintenanceAlarmDay != null">maintenance_alarm_day = #{maintenanceAlarmDay},</if> <if test="maintenanceAlarmDay != null">maintenance_alarm_day = #{maintenanceAlarmDay},</if>
@ -220,12 +210,12 @@
</delete> </delete>
<select id="selectMaTypeList" parameterType="String" resultMap="MaTypeResult"> <select id="selectMaTypeList" parameterType="String" resultMap="MaTypeResult">
select DISTINCT m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_id, m.unit_name, m.manage_type, select DISTINCT m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_name, m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl, m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId, mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time, su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id ,m.type_id id , m.type_name label, m.maintenance_alarm_day m.remark, m.company_id ,m.type_id id , m.type_name label, m.maintenance_alarm_day,m.is_state_grid
from ma_type m from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0' left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0'
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0' left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0'
@ -270,14 +260,12 @@
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="companyId != null">company_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if> <if test="typeId != null">#{typeId},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="companyId != null">#{companyId},</if>
</trim> </trim>
</insert> </insert>
@ -288,14 +276,12 @@
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="companyId != null">company_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if> <if test="typeId != null">#{typeId},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="companyId != null">#{companyId},</if>
</trim> </trim>
</insert> </insert>
@ -311,7 +297,6 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="propId != null">#{propId},</if> <if test="propId != null">#{propId},</if>
@ -323,7 +308,6 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
</trim> </trim>
</insert> </insert>
@ -332,7 +316,6 @@
m.type_name, m.type_name,
m.parent_id, m.parent_id,
m.storage_num, m.storage_num,
m.unit_id,
m.unit_name, m.unit_name,
m.manage_type, m.manage_type,
m.lease_price, m.lease_price,
@ -406,7 +389,6 @@
m.type_name, m.type_name,
m.parent_id, m.parent_id,
m.storage_num, m.storage_num,
m.unit_id,
m.unit_name, m.unit_name,
m.manage_type, m.manage_type,
m.lease_price, m.lease_price,
@ -429,7 +411,7 @@
where del_flag = '0' where del_flag = '0'
</select> </select>
<select id="getMaTypeSelect" resultType="com.bonus.material.ma.vo.MaType"> <select id="getMaTypeSelect" resultType="com.bonus.material.ma.vo.MaType">
select m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_id, m.manage_type, select m.type_id, m.type_name, m.parent_id, m.storage_num, m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id, m.maintenance_alarm_day m.remark, m.company_id, m.maintenance_alarm_day
@ -440,7 +422,7 @@
</select> </select>
<select id="getListByParentId" resultMap="MaTypeResult"> <select id="getListByParentId" resultMap="MaTypeResult">
select DISTINCT m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_id, m.unit_name, m.manage_type, select DISTINCT m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_name, m.manage_type,
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl, m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId, mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
@ -460,7 +442,7 @@
</select> </select>
<select id="selectMaTypeTreeByLevel" resultMap="MaTypeResult" parameterType="java.lang.String"> <select id="selectMaTypeTreeByLevel" resultMap="MaTypeResult" parameterType="java.lang.String">
select m.type_id, m.type_name, m.parent_id, m.storage_num, m.unit_id, m.manage_type, select m.type_id, m.type_name, m.parent_id, m.storage_num, m.manage_type,
m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.maintenance_alarm_day, m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.maintenance_alarm_day,
m.remark, m.company_id,mtf.file_url photoUrl m.remark, m.company_id,mtf.file_url photoUrl
@ -477,7 +459,6 @@
m.type_name, m.type_name,
m.parent_id, m.parent_id,
m.storage_num, m.storage_num,
m.unit_id,
m.manage_type, m.manage_type,
m.lease_price, m.lease_price,
m.eff_time, m.eff_time,
@ -572,12 +553,12 @@
from ma_type_properties from ma_type_properties
order by must_have desc order by must_have desc
</select> </select>
<select id="getList" resultMap="MaTypeResult"> <select id="getList" resultMap="MaTypeResult">
select m.type_id, select m.type_id,
m.type_name, m.type_name,
m.parent_id, m.parent_id,
m.storage_num, m.storage_num,
m.unit_id,
m.unit_name, m.unit_name,
m.manage_type, m.manage_type,
m.lease_price, m.lease_price,
@ -594,28 +575,24 @@
m.create_by, m.create_by,
m.create_time, m.create_time,
m.remark, m.remark,
m.company_id,
m.maintenance_alarm_day, m.maintenance_alarm_day,
m3.type_name AS subProcedure, m6.type_name AS subProcedure,
m2.type_name AS mainProcedure, m5.type_name AS mainProcedure,
m1.type_name AS major m4.type_name AS major
FROM ma_type m FROM ma_type m
LEFT JOIN ma_type m3 ON m3.type_id = m.parent_id LEFT JOIN ma_type m6 ON m6.type_id = m.parent_id
LEFT JOIN ma_type m5 ON m5.type_id = m6.parent_id
LEFT JOIN ma_type m4 ON m4.type_id = m5.parent_id
LEFT JOIN ma_type m3 ON m3.type_id = m4.parent_id
LEFT JOIN ma_type m2 ON m2.type_id = m3.parent_id LEFT JOIN ma_type m2 ON m2.type_id = m3.parent_id
LEFT JOIN ma_type m1 ON m1.type_id = m2.parent_id LEFT JOIN ma_type m1 ON m1.type_id = m2.parent_id
WHERE m.LEVEL = '4' WHERE m.LEVEL = '7'
and m.del_flag = 0 and m.del_flag = 0
<if test="level == 1"> and m.parent_id = #{parentId}
and m1.type_name = #{typeName} <if test="level == 6">
</if> <if test="typeName != null and typeName != ''">
<if test="level == 2"> and m6.type_name = #{typeName}
and m2.type_name = #{typeName} </if>
</if>
<if test="level == 3">
and m3.type_name = #{typeName}
</if>
<if test="level == 4">
and m.type_name = #{typeName}
</if> </if>
</select> </select>
<select id="selectMaTypeTreeBy5Level" resultType="com.bonus.material.ma.vo.MaType"> <select id="selectMaTypeTreeBy5Level" resultType="com.bonus.material.ma.vo.MaType">