insert into plan_need_info
unit_id,
create_by,
remark,
company_id,
create_time
#{unitId},
#{createBy},
#{remark},
#{companyId},
now()
insert into plan_borrow_info
need_unit_id,
borrow_unit_id,
create_by,
remark,
create_time
#{needUnitId},
#{borrowUnitId},
#{createBy},
#{remark},
now()
insert into ma_whole_set
type_id,
parent_id,
part_num,
whole_type_name,
create_by,
create_time,
status
#{item.id},
#{item.parentId},
#{item.totalNum},
#{item.wholeTypeName},
#{item.createBy},
#{item.createTime},
1
delete from ma_whole_set
where parent_id = #{id}
select COUNT(*) from ma_whole_set
where parent_id = #{parentId}
SELECT
mws.parent_id AS id,
mws.whole_type_name AS wholeTypeName,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(mws.part_num) AS totalNum
FROM ma_whole_set mws
JOIN ma_type mt ON mws.parent_id = mt.type_id
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE
mt.`status` = '0'
AND mt.del_flag = '0'
and (
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%')
)
GROUP BY mws.parent_id
SELECT
mws.parent_id AS id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mws.part_num AS totalNum
FROM
ma_whole_set mws
JOIN ma_type mt ON mws.type_id = mt.type_id
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE
mws.parent_id = #{id}
and (
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%')
)
SELECT
mt4.type_id AS firstId,
mt3.type_id AS secondId,
mt2.type_id AS threeId,
mt.type_id AS fourId
FROM
ma_type mt
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE
mt.`status` = '0'
AND mt.del_flag = '0'
AND mt.type_id = #{id}
select type_id from ma_whole_set
where parent_id = #{id}
SELECT
mt.type_id AS id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mws.part_num AS totalNum
FROM
ma_whole_set mws
JOIN ma_type mt ON mws.type_id = mt.type_id
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE
mws.parent_id = #{id}
SELECT
mt4.type_id AS firstId,
mt3.type_id AS secondId,
mt2.type_id AS threeId,
mt.type_id AS fourId
FROM
ma_type mt
JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE
mt.`status` = '0'
AND mt.del_flag = '0'
AND mt.type_id in
#{item}