物资类型管理--修改mapper
This commit is contained in:
parent
bd1716a2d3
commit
a11b03b12e
|
|
@ -35,6 +35,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="intelligentCode" column="intelligent_code" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.bonus.material.ma.vo.MaTypeListVo" id="MaTypeListVoResult">
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="typeName" column="type_name" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="storageNum" column="storage_num" />
|
||||
<result property="typeCode" column="type_code" />
|
||||
<result property="modelCode" column="model_code" />
|
||||
<result property="unitId" column="unit_id" />
|
||||
<result property="manageType" column="manage_type" />
|
||||
<result property="leasePrice" column="lease_price" />
|
||||
<result property="effTime" column="eff_time" />
|
||||
<result property="rentPrice" column="rent_price" />
|
||||
<result property="buyPrice" column="buy_price" />
|
||||
<result property="payRatio" column="pay_ratio" />
|
||||
<result property="level" column="level" />
|
||||
<result property="ratedLoad" column="rated_load" />
|
||||
<result property="testLoad" column="test_load" />
|
||||
<result property="holdingTime" column="holding_time" />
|
||||
<result property="warnNum" column="warn_num" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isPlan" column="is_plan" />
|
||||
<result property="isAncuo" column="is_ancuo" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="facModel" column="fac_model" />
|
||||
<result property="intelligentCode" column="intelligent_code" />
|
||||
<result property="parentOneLevelName" column="parentFourLevelName" />
|
||||
<result property="parentTwoLevelName" column="parentThreeLevelName" />
|
||||
<result property="parentThreeLevelName" column="parentTwoLevelName" />
|
||||
<result property="parentFourLevelName" column="parentOneLevelName" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTypeVo">
|
||||
select
|
||||
type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price,
|
||||
|
|
@ -75,6 +110,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectTypeVo"/>
|
||||
where type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="selectParentId" resultType="java.lang.Integer">
|
||||
SELECT DISTINCT
|
||||
mt2.type_id
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
<where>
|
||||
<if test="level == 1">
|
||||
and mt4.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level == 2">
|
||||
and mt3.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level == 3">
|
||||
and mt2.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level == 0">
|
||||
and mt.level = 4
|
||||
</if>
|
||||
and mt2.type_id is not null
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertType" parameterType="com.bonus.material.ma.domain.Type" useGeneratedKeys="true" keyProperty="typeId">
|
||||
insert into ma_type
|
||||
|
|
@ -187,7 +247,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where del_flag = 0 and level != #{level}
|
||||
</select>
|
||||
|
||||
<select id="selectTypeListAndParent" resultType="com.bonus.material.ma.vo.MaTypeListVo">
|
||||
<select id="selectTypeListAndParent" resultMap="MaTypeListVoResult">
|
||||
SELECT
|
||||
a.*, -- 当前层级的所有字段
|
||||
a.type_name AS parentFourLevelName, -- 当前层级名称
|
||||
|
|
@ -227,4 +287,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and a.del_flag = '0'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getListByParentId" resultMap="TypeResult">
|
||||
select DISTINCT m.type_id, m.type_name, m.parent_id, m.manage_type,
|
||||
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.level, m.rated_load, m.test_load,
|
||||
m.holding_time, m.warn_num,
|
||||
mtk.user_id keeperUserId,
|
||||
mpi.prop_name, m.del_flag, m.create_by, m.create_time,
|
||||
m.remark, m.fac_model as facModel,m.intelligent_code
|
||||
from ma_type m
|
||||
left join ma_prop_set mps on m.type_id = mps.type_id
|
||||
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
|
||||
left join ma_type_keeper mtk on m.type_id = mtk.type_id
|
||||
where m.parent_id = #{typeId} and m.del_flag = '0'
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue