XiaoRuby
2023-09-07 c28d3bb363dde2afb44c168b93379b2bf6b1f67f
standard-server/src/main/resources/mapper/MaterialMapper.xml
@@ -26,38 +26,38 @@
        <id property="id" column="spid"/>
        <result property="name" column="spname"/>
    </resultMap>
    <select id="selectTreeByMaterial" resultMap="selectTreeByMaterialMap" >
        select m.type, #一级类型
               father, #二级产品大类(4大类)
               m.id    mid, #三级物料id
    <select id="selectTreeByMaterial" resultMap="selectTreeByMaterialMap">
        select m.type,        #一级类型
               father,        #二级产品大类(4大类)
               m.id    mid,   #三级物料id
               m.name  mname, #三级样品名称
               s.id    sid, #四级标准id
               s.id    sid,   #四级标准id
               s.name  sname, #四级标准名
               sp.id   spid, #五级型号id
               sp.id   spid,  #五级型号id
               sp.name spname #五级型号名
        from (select type, id, name,father from mom_ocean.material where state = 1) m
                 left join (select id, name, material_id from mom_ocean.standard where state = 1) s on m.id = s.material_id
        from (select type, id, name, father from mom_ocean.material where state = 1) m
                 left join (select id, name, material_id from mom_ocean.standard where state = 1) s
                           on m.id = s.material_id
                 left join (select id, name, standard_id from mom_ocean.specifications where state = 1) sp
                           on sp.standard_id = s.id
    </select>
    <select id="selectMcodeId" resultType="com.yuanchu.mom.pojo.Material">
        select id, code
    <!--根据标准id查询物料-->
    <select id="selFath" resultType="com.yuanchu.mom.pojo.Material">
        select *
        from mom_ocean.material
        where name = #{name}
        where state = 1
          and id = (select material_id
                    from mom_ocean.standard
                    where standard.state = 1
                      and standard.id = #{id})
    </select>
    <select id="selectIdByCoNa" resultType="java.util.Map">
        select m.id     '物料id',
               st.id    '规格id',
               st.name  '规格名称',
               sp.name  '型号名称'
        from mom_ocean.material m,
             mom_ocean.standard st,
             mom_ocean.specifications sp
        where m.id = material_id
          and material_id = standard_id
          and m.name = #{name}
          and code = #{code}
    <!--根据物料名称查询成品产品编号-->
    <select id="selMcode" resultType="java.lang.String">
        select code
        from mom_ocean.material
        where state = 1
          and type = 1
          and name = #{name}
    </select>
</mapper>