| | |
| | | <resultMap id="SysLaboratory" type="com.nanometer.smartlab.entity.SysLaboratory"> |
| | | <id property="id" column="id"/> |
| | | <result property="type" column="type"></result> |
| | | <result property="typeName" column="type_name"></result> |
| | | <result property="name" column="name"></result> |
| | | <result property="infoCode" column="info_code"></result> |
| | | <result property="barCode" column="bar_code"></result> |
| | | <result property="location1" column="location1"></result> |
| | | <result property="location2" column="location2"></result> |
| | | <result property="location" column="location"></result> |
| | | <result property="department" column="department"></result> |
| | | <result property="departmentName" column="department_name"></result> |
| | | <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> |
| | | <collection property="projects" ofType="com.nanometer.smartlab.entity.SysProject" select="getProjectsByIds" column="{projectIds=project}"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="laboratoryAndContainerMap" type="com.nanometer.smartlab.entity.SysLaboratory" extends="SysLaboratory"> |
| | | <collection property="laboratoryContainers" ofType="com.nanometer.smartlab.entity.SysLaboratoryContainer" select="getContaninerByLabId" column="{labId=id}"/> |
| | | <collection property="projects" ofType="com.nanometer.smartlab.entity.SysProject" select="getProjectsByIds" column="{projectIds=project}"/> |
| | | </resultMap> |
| | | |
| | | <sql id="queryWhereSql"> |
| | |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="getSysLaboratory" parameterType="java.lang.String" resultMap="SysLaboratory" > |
| | | <select id="getSysLaboratory" 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="getSysLaboratorySimpleInfo" resultType="com.nanometer.smartlab.entity.SysLaboratory"> |
| | | select id,name from sys_laboratory |
| | | where id = #{id} and valid_flag = 1 |
| | | </select> |
| | |
| | | </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 |
| | | select su.id,su.type,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_name,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 |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="exportLabList" parameterType="java.util.Map" resultType="java.util.Map"> |
| | | SELECT bm1.meta_value type ,sl.name,sl.info_code infoCode,sl.bar_code barCode, |
| | | <select id="exportLabList" parameterType="java.util.Map" resultMap="SysLaboratory"> |
| | | SELECT sl.id,bm1.meta_value type_name ,sl.name,sl.info_code info_code,sl.bar_code bar_code, |
| | | CASE |
| | | WHEN (ISNULL(location1)=1) || (LENGTH(trim(location1))=0) |
| | | THEN |
| | |
| | | CONCAT(location1,'-',location2) |
| | | END |
| | | location, |
| | | bm2.meta_value department, |
| | | bm2.meta_value department_name, |
| | | sl.project |
| | | from sys_laboratory as sl |
| | | LEFT JOIN base_meta bm1 on bm1.id = sl.type |
| | |
| | | order by name asc |
| | | </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,project) |
| | | values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now(),#{project}) |
| | | <insert id="insertSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory" useGeneratedKeys = "true" keyProperty = "id"> |
| | | insert into sys_laboratory( type, name, info_code, bar_code, location1, location2, valid_flag,department, create_time, update_time,project) |
| | | values ( #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now(),#{project}) |
| | | </insert> |
| | | |
| | | <update id="updateSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory"> |
| | |
| | | </foreach> |
| | | </update> |
| | | |
| | | <select id="getSysLaboratoryByBarCode" parameterType="java.lang.String" resultMap="SysLaboratory" > |
| | | <select id="getSysLaboratoryByBarCode" resultMap="SysLaboratory" > |
| | | select * from sys_laboratory |
| | | where bar_code = #{barCode} and valid_flag=1 |
| | | </select> |
| | | |
| | | <select id="getSysLaboratoryByBarCodeForExport" parameterType="java.lang.String" resultMap="SysLaboratory" > |
| | | <select id="getSysLaboratoryByBarCodeForExport" resultMap="SysLaboratory" > |
| | | select * from sys_laboratory |
| | | where bar_code = #{barCode} |
| | | and valid_flag=1 |
| | |
| | | sys_laboratory as sl |
| | | LEFT JOIN base_meta bm on bm.id = sl.department |
| | | WHERE |
| | | sl.project LIKE CONCAT('%',#{project},'%') |
| | | find_in_set(#{projectId},sl.project) |
| | | </select> |
| | | <select id="getSysLaboratoryByName" resultMap="SysLaboratory"> |
| | | select * |
| | |
| | | update_time=now() |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <select id="getLaboratoryByProjectId" resultMap="laboratoryAndContainerMap"> |
| | | select sl.*,bm.meta_value as type_name from sys_laboratory sl |
| | | left join base_meta bm on bm.id=sl.type |
| | | where find_in_set(#{projectId},project) |
| | | </select> |
| | | |
| | | <select id="getContaninerByLabId" resultType="com.nanometer.smartlab.entity.SysLaboratoryContainer"> |
| | | select * from sys_laboratory_container where laboratory_id=#{labId} |
| | | </select> |
| | | |
| | | <select id="getProjectsByIds" resultType="com.nanometer.smartlab.entity.SysProject"> |
| | | select id,project_no as projectNo,project_name as projectName,sys_user_id as sysUserId,project from sys_project where id in |
| | | <foreach item="item" index="index" collection="projectIds.split(',')" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |