gdg
2020-12-23 6207311d7df3d47d27fdd78de33f49875550f52f
src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml
@@ -30,7 +30,7 @@
  </select>
  <select id="getSysLaboratoryContainer" parameterType="java.lang.String"  resultMap="SysLaboratoryContainer" >
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType  from sys_laboratory_container as su
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project_id projectId from sys_laboratory_container as su
    left join sys_laboratory as ss on su.laboratory_id = ss.id
    where su.id = #{id} and su.valid_flag = 1
  </select>
@@ -40,11 +40,24 @@
    where container_code = #{containerCode} and valid_flag = 1
  </select>
  <select id="updateSysLabContainer" parameterType="java.util.Map" >
    update sys_laboratory_container slc
    set slc.controller_code = #{code}
    WHERE  slc.controller_code =  (
    SELECT  sc.controller_code
    from sys_controller sc
    WHERE sc.id = #{id}
    and sc.valid_flag = 1)
    and slc.valid_flag  = 1
  </select>
  <select id="getSysLaboratoryContainerList" parameterType="java.util.Map" resultMap="SysLaboratoryContainer">
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName  from sys_laboratory_container as su
    select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName,su.project_id as projectId  from sys_laboratory_container as su
    left join sys_laboratory as ss on su.laboratory_id = ss.id
    left join sys_controller sc on sc.controller_code=su.controller_code
    where su.valid_flag = 1
    AND sc.valid_flag = 1
    AND ss.valid_flag = 1
    <if test="laboratoryType != null and laboratoryType != ''">
      and ss.type = #{laboratoryType}
    </if>
@@ -60,11 +73,45 @@
    </if>
  </select>
  <select id="exportExcelList" parameterType="java.util.Map" resultType="java.util.Map">
    SELECT
    bm2.meta_value labType,
    sl.NAME labName,
    sc.controller_name controlName,
    slc.container_code containerCode,
    bm1.meta_value containerType ,
    slc.info_code infoCode ,
    bm3.meta_value structure,
    slc.`name` name
    FROM
    sys_laboratory_container slc
    LEFT JOIN base_meta bm1 ON bm1.id = slc.type
    LEFT JOIN sys_laboratory sl ON sl.id = slc.laboratory_id
    LEFT JOIN base_meta bm2 ON bm2.id = sl.type
    LEFT JOIN sys_controller sc ON slc.controller_code = sc.controller_code
    LEFT JOIN base_meta bm3 on bm3.id = slc.structure
    WHERE
    slc.valid_flag = 1
    AND sc.valid_flag = 1
    AND sl.valid_flag = 1
    <if test="type != null and type != ''">
     and sl.type = #{type}
    </if>
    <if test="name != null and name != ''">
      and sl.name like concat("%",#{name},"%")
    </if>
    order by sl.name ASC,sc.controller_name,slc.container_code,slc.name
  </select>
  <select id="getSysLaboratoryContainerTotalCount" parameterType="java.util.Map" resultType="int">
    select count(1) from sys_laboratory_container as su
    left join sys_laboratory as ss on su.laboratory_id = ss.id
    left join sys_controller sc on sc.controller_code=su.controller_code
    where su.valid_flag = 1
    AND sc.valid_flag = 1
    AND ss.valid_flag = 1
    <if test="laboratoryType != null and laboratoryType != ''">
      and ss.type = #{laboratoryType}
    </if>
@@ -83,14 +130,14 @@
  </select>
  <insert id="insertSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer">
    insert into sys_laboratory_container(id, laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code)
    values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode})
    insert into sys_laboratory_container(id, laboratory_id, type, container_code, info_code, structure, name, valid_flag, character_left, character_right, create_time, update_time, controller_code,project_id)
    values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{projectId})
  </insert>
  <update id="updateSysLaboratoryContainer" parameterType="com.nanometer.smartlab.entity.SysLaboratoryContainer">
    update sys_laboratory_container set laboratory_id=#{laboratoryId}, type=#{type}, container_code=#{containerCode}, info_code=#{infoCode},
    structure=#{structure}, name=#{name}, character_left=#{characterLeft}, character_right=#{characterRight},controller_code=#{controllerCode},
    update_time=now()
    update_time=now(),project_id = #{projectId}
    where id=#{id}
  </update>