# Conflicts:
#	bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java
#	bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java
#	bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml
This commit is contained in:
hongchao 2026-01-07 14:47:37 +08:00
commit d767bc22b6
7 changed files with 95 additions and 2 deletions

View File

@ -23,6 +23,9 @@ public class AutomaticInPutDto {
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("物料规格")
private String specification;
@ApiModelProperty("计量单位")
private String unitCode;

View File

@ -180,6 +180,19 @@ public class TypeController extends BaseController {
return success(listByMaType);
}
/**
* 获取领用物资类型连动式下拉框
* @param typeId
* @param typeName
* @return
*/
@ApiOperation(value = "获取领用物资类型连动式下拉框")
@GetMapping("/equipmentTypeLease")
public AjaxResult equipmentTypeLease(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName) {
List<Type> listByMaType = typeService.equipmentTypeLease(typeId, typeName);
return success(listByMaType);
}
/**
* 查询物资类型3级--前端联动式下拉框
* 没有4级规格型号

View File

@ -277,4 +277,12 @@ public interface TypeMapper {
SysUser getUserDeptId(Long userId);
SysDept getDeptIdByUserId(Long deptId);
/**
* 获取领用物资类型连动式下拉框
* @param typeId
* @param typeName
* @return
*/
List<Type> equipmentTypeLease(@Param("typeId") Long typeId, @Param("typeName") String typeName);
}

View File

@ -164,5 +164,13 @@ public interface ITypeService {
*/
List<MaTypeVo> getListByParentIds(List<Integer> parentIds, MaTypeVo maTypeVo);
/**
* 获取领用物资类型连动式下拉框
* @param typeId
* @param typeName
* @return
*/
List<Type> equipmentTypeLease(Long typeId, String typeName);
Long getUserDeptId(SysUser user);
}

View File

@ -322,6 +322,27 @@ public class TypeServiceImpl implements ITypeService {
return typeMapper.getListByParentIds(parentIds, maTypeVo);
}
/**
* 获取领用物资类型连动式下拉框
* @param typeId
* @param typeName
* @return
*/
@Override
public List<Type> equipmentTypeLease(Long typeId, String typeName) {
List<Type> maTypes = typeMapper.equipmentTypeLease(typeId, typeName);
List<Type> roots = maTypes.stream()
.filter(t -> t.getParentId() == 0)
.collect(Collectors.toList());
// 构建树并计算优先级
roots.forEach(root -> buildTreeWithPriority(root, maTypes));
// 对根节点排序含0值处理
roots.sort(this::compareNodes);
return roots;
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {

View File

@ -495,10 +495,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getNumList" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
SELECT
qb.id as id,qb.box_id as boxId,qb.create_by as createBy,
qb.id as id,
qb.box_id as boxId,
qb.create_by as createBy,
mt1.type_name as typeName,
mt.type_name as typeModelName,
qb.ma_code as maCode,mt.type_id as maTypeId
qb.ma_code as maCode,
mt.type_id as maTypeId,
qb.ma_id AS maId,
qb.create_time AS createTime
FROM
bm_qrcode_box_bind qb
LEFT JOIN bm_qrcode_box bqb ON qb.box_id = bqb.box_id

View File

@ -1352,4 +1352,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
sd.dept_id = #{deptId}
</select>
<select id="equipmentTypeLease" resultMap="TypeResult">
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.unit_value,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.holding_time, m.warn_num, m.sort_num,
m.del_flag, m.create_by, m.create_time,
m.remark,m.type_id id , m.type_name label,
CASE m.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(m.storage_num, 0)
END as storage_num,
m.company_id as companyId,
m.jiju_type
from ma_type m
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
<where>
m.del_flag = '0' and m.is_lease = 0
<if test="typeName != null and typeName !=''">
AND m.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeId != null and typeId !=''">
AND m.type_id = #{typeId}
</if>
</where>
</select>
</mapper>