From f675672004af0ff9071d21546a0eee0a0c8f3092 Mon Sep 17 00:00:00 2001 From: gdg <764716047@qq.com> Date: 星期五, 29 一月 2021 08:13:30 +0800 Subject: [PATCH] 增加部分搜索 --- src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml index 609ba1f..42a4385 100644 --- a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml +++ b/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 ,su.project_id projectId from sys_laboratory_container as su + select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project project 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> @@ -52,7 +52,7 @@ </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,su.project_id as projectId from sys_laboratory_container as su + select su.*,ss.name as laboratoryName, ss.type as laboratoryType,sc.controller_name as controllerName,su.project as project 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 @@ -66,6 +66,12 @@ </if> <if test="laboratoryName != null and laboratoryName != ''"> and ss.name like #{laboratoryName} + </if> + <if test="project != null and project != ''"> + and su.project like concat("%",#{project},"%") + </if> + <if test="controllerName != null and controllerName != ''"> + and sc.controller_name like concat("%",#{controllerName},"%") </if> order by ss.name ASC,sc.controller_name,su.container_code,su.name <if test="first != null and pageSize != null"> @@ -127,17 +133,23 @@ <if test="editId != null and editId != ''"> and su.id != #{editId} </if> + <if test="project != null and project != ''"> + and su.project like concat("%",#{project},"%") + </if> + <if test="controllerName != null and controllerName != ''"> + and sc.controller_name like concat("%",#{controllerName},"%") + </if> </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,project_id) - values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{projectId}) + 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) + values (#{id}, #{laboratoryId}, #{type}, #{containerCode}, #{infoCode}, #{structure}, #{name}, 1, #{characterLeft}, #{characterRight}, now(), now(), #{controllerCode},#{project}) </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 = #{project} where id=#{id} </update> @@ -213,4 +225,11 @@ and slc.valid_flag = 1 </select> + <select id="selectProjectsByContainerCode" resultType="java.lang.String"> + select project + from sys_laboratory_container + where container_code = #{0} + and valid_flag = 1 + </select> + </mapper> -- Gitblit v1.9.2