Blame view

LaboratoryDictMapper.xml 1.91 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
<?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>