<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<mapper namespace="com.yuanchu.mom.mapper.MbomMapper">
|
<!--根据型号id查询所有版本-->
|
<select id="selectVerByMbom" resultType="java.lang.Integer">
|
select distinct version
|
from mom_ocean.mbom
|
where state = 1
|
and technology_id in (select id
|
from mom_ocean.technology
|
where technology.state = 1
|
and specifications_id = #{specificationsId})
|
order by version desc
|
</select>
|
|
<!--右侧数据展示 物料清单-->
|
<resultMap id="oneMap" type="map">
|
<id property="father" column="father"/>
|
<collection property="children" resultMap="twoMap" javaType="List"/>
|
</resultMap>
|
<resultMap id="twoMap" type="map">
|
<id property="tname" column="tname"/>
|
<collection property="children" resultMap="threeMap" javaType="List"/>
|
</resultMap>
|
<resultMap id="threeMap" type="map">
|
<id property="id" column="mid"/>
|
<result property="mname" column="mname"/>
|
<result property="specifications" column="specifications"/>
|
<result property="unit" column="unit"/>
|
<result property="num" column="num"/>
|
</resultMap>
|
<select id="selectAllMbom" resultMap="oneMap">
|
select m.id mid,
|
m.name mname,
|
unit,
|
num,
|
specifications,
|
t.name tname,
|
father
|
from mom_ocean.mbom m
|
left join mom_ocean.technology t on m.technology_id = t.id
|
where m.state = 1
|
and m.version = #{version}
|
and specifications_id = #{specificationsId}
|
<if test="message!=null and message!=''">
|
and m.name like concat('%',#{message},'%')
|
</if>
|
</select>
|
</mapper>
|