lyfO_o
2021-09-16 0dfab938c5116c8fa0191cadf36a47f5bb4f2936
src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
@@ -12,6 +12,28 @@
    <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result>
    <result property="createTime" column="create_time"></result>
    <result property="updateTime" column="update_time"></result>
    <result property="department" column="department"></result>
  </resultMap>
  <resultMap id="SysWarehouseDto" type="com.nanometer.smartlab.entity.dto.SysWarehouseDto">
    <id property="id" column="id"/>
    <result property="type" column="type"/>
    <result property="name" column="name"/>
    <result property="infoCode" column="info_code"/>
    <result property="barCode" column="bar_code"/>
    <result property="location1" column="location1"/>
    <result property="location2" column="location2"/>
    <collection property="sysWarehouseContainer" ofType="com.nanometer.smartlab.entity.dto.SysWarehouseContainerDto" fetchType="lazy">
      <id property="id" column="wc_id"/>
      <result property="type" column="wc_type"/>
      <result property="name" column="wc_name"/>
      <result property="containerCode" column="container_code"/>
      <result property="infoCode" column="info_code"/>
      <result property="structure" column="structure"/>
      <result property="warehouseContainerName" column="wc_name"/>
      <result property="warehouseContainerType" column="wc_type"/>
      <result property="controllerCode" column="controller_code"/>
    </collection>
  </resultMap>
  <sql id="queryWhereSql">
@@ -57,13 +79,13 @@
  </select>
  <insert id="insertSysWarehouse" parameterType="com.nanometer.smartlab.entity.SysWarehouse">
    insert into sys_warehouse(id, type, name, info_code, bar_code, location1, location2, valid_flag, create_time, update_time)
    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1, now(), now())
    insert into sys_warehouse(id, type, name, info_code, bar_code, location1, location2, valid_flag, create_time, update_time,department)
    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1, now(), now(),#{department})
  </insert>
  <update id="updateSysWarehouse" parameterType="com.nanometer.smartlab.entity.SysWarehouse">
    update sys_warehouse set type=#{type}, name=#{name}, info_code=#{infoCode}, bar_code=#{barCode}, location1=#{location1}, location2=#{location2},
    update_time=now()
    update_time=now(),department=#{department}
    where id=#{id}
  </update>
@@ -79,4 +101,31 @@
    select * from sys_warehouse
    where bar_code = #{barCode}
  </select>
  <select id="selectWarehouse" resultMap="SysWarehouseDto">
 SELECT
   sw.id,
   bm1.meta_value type,
   sw.`name` name ,
   sw.info_code,
   sw.bar_code,
   sw.location1,
   sw.location2,
   swc.id wc_id,
   bm2.meta_value wc_type,
   swc.`name` wc_name,
   swc.info_code ,
   swc.controller_code,
   bm3.meta_value structure,
   swc.container_code
FROM
   `sys_warehouse` sw
   LEFT JOIN base_meta bm1 ON bm1.id = sw.type
   LEFT JOIN sys_warehouse_container swc ON swc.warehouse_id = sw.id
   LEFT JOIN base_meta bm2 ON bm2.id = swc.type
   LEFT JOIN base_meta bm3 ON bm3.id = swc.structure
   where sw.valid_flag = 1
   AND swc.valid_flag = 1
  </select>
</mapper>