kongzy
2023-11-28 59d9ea33f503e363f2e2941c7c00cc9dd9d9d1c7
src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml
@@ -13,6 +13,7 @@
    <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="project" column="project"></result>
  </resultMap>
  <sql id="queryWhereSql">
@@ -31,10 +32,18 @@
    <if test="department != null and department != ''">
      and su.department = #{department}
    </if>
    <if test="project != null and project != ''">
      and su.project like concat("%",#{project},"%")
    </if>
  </sql>
  <select id="getSysLaboratory" parameterType="java.lang.String"  resultMap="SysLaboratory" >
    select * from sys_laboratory
    where id = #{id} and valid_flag = 1
  </select>
  <select id="getSysLaboratorySimpleInfo" parameterType="java.lang.String"  resultMap="SysLaboratory">
    select id,name from sys_laboratory
    where id = #{id} and valid_flag = 1
  </select>
@@ -43,6 +52,18 @@
    where su.valid_flag = 1
    <include refid="queryWhereSql"/>
    order by su.name ASC
    <if test="first != null and pageSize != null">
      limit #{first}, #{pageSize}
    </if>
  </select>
  <select id="getSysLaboratorySimpleInfoList" parameterType="java.util.Map" resultMap="SysLaboratory">
    select su.id,su.name,su.info_code,su.bar_code,su.location1,su.location2,su.project,su.create_time,su.update_time,bm1.meta_value as type,bm2.meta_value as department from sys_laboratory as su
    left join base_meta as bm1 on bm1.id=su.type
    left join base_meta as bm2 on bm2.id=su.department
    where su.valid_flag = 1
    <include refid="queryWhereSql"/>
    order by su.create_time desc
    <if test="first != null and pageSize != null">
      limit #{first}, #{pageSize}
    </if>
@@ -58,7 +79,8 @@
    CONCAT(location1,'-',location2)
    END
    location,
    bm2.meta_value department
    bm2.meta_value department,
    sl.project
    from sys_laboratory as sl
    LEFT JOIN base_meta bm1 on bm1.id = sl.type
    left JOIN base_meta bm2 on bm2.id = sl.department
@@ -68,6 +90,9 @@
    </if>
    <if test="type != null and type != ''">
      and sl.type = #{type};
    </if>
    <if test="project != null and project != ''">
      and sl.project like concat("%",#{project},"%")
    </if>
  </select>
@@ -84,13 +109,13 @@
  </select>
  <insert id="insertSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
    insert into sys_laboratory(id, type, name, info_code, bar_code, location1, location2, valid_flag,department, create_time, update_time)
    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now())
    insert into sys_laboratory(id, type, name, info_code, bar_code, location1, location2, valid_flag,department, create_time, update_time,project)
    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now(),#{project})
  </insert>
  <update id="updateSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
    update sys_laboratory set type=#{type}, name=#{name}, info_code=#{infoCode}, bar_code=#{barCode}, location1=#{location1}, location2=#{location2},department=#{department},
    update_time=now()
    update_time=now(),project = #{project}
    where id=#{id}
  </update>
@@ -112,7 +137,31 @@
    where bar_code = #{barCode}
    and valid_flag=1
  </select>
  <select id="getLaboratoryByProject" resultType="com.nanometer.smartlab.entity.dto.LaboratoryVo$Laboratory">
    SELECT
    CONCAT('楼号:',sl.location1,'-地址号:',sl.location2) as address,
    bm.meta_value as department
    FROM
   sys_laboratory as sl
    LEFT JOIN base_meta bm on bm.id = sl.department
    WHERE
   sl.project LIKE CONCAT('%',#{project},'%')
  </select>
  <select id="getSysLaboratoryByName"  resultMap="SysLaboratory">
    select *
    from  sys_laboratory
    where name = #{0}
    and valid_flag = 1
  </select>
  <select id="getPersonInCharge" resultType="java.util.Map">
    select su.phone
    from sys_user as su
    left join base_role as br on su.role_id = br.id
    where su.project like concat("%",#{project},"%")
    and su.valid_flag = 1
    and br.`name` = '实验负责人'
  </select>
  <update id="updateLabExport" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
    update sys_laboratory set
    type=#{type},