LaboratoryDictMapper.xml 1.91 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.meishu.mapper.LaboratoryDictMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.LaboratoryDictDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="laboratory_name" property="laboratoryName" />
        <result column="laboratory_type" property="laboratoryType" />
        <result column="max_num" property="maxNum" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, laboratory_name, laboratory_type, max_num
    </sql>

    <select id="getLaboratoryPage" resultType="com.meishu.vo.laboratorySession.LaboratoryDictPageVO">
        select * from laboratory_dict
        <where>
            <if test="laboratoryName != null and laboratoryName != ''">
                and laboratory_name like concat('%', #{laboratoryName} ,'%')
            </if>
            <if test="laboratoryType != null and laboratoryType != ''">
                and laboratory_type = #{laboratoryType}
            </if>
            and delete_date is null
        </where>
    </select>

    <select id="getLaboratoryDicOne" resultType="com.meishu.model.LaboratoryDictDO">
        select
            ld.*
        from laboratory_dict ld
        left join laboratory_session_mapping lsm on lsm.laboratory_dict_id = ld.id
        where lsm.start_date = #{startDate}
        and ld.laboratory_type = #{laboratoryType}
        and lsm.delete_date is null
        and ld.delete_date is null
        GROUP BY ld.laboratory_type
    </select>

</mapper>