ComExpertSpecDAO.xml 3.44 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.yiboshi.science.dao.ComExpertSpecDAO">
    <sql id="allColumns">
        t.id as id, t.expert_id as expertId, t.spec_id as specId, t.created as created, t.updated as updated
    </sql>
    <select id="getIdListByExpertId" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT a.spec_id
        FROM com_expert_spec a
        where expert_id=#{expertId}
    </select>
    <select id="getListByExpertId" parameterType="java.lang.String"  resultType="com.yiboshi.science.param.dto.ComExpertSpecDTO">
        SELECT a.spec_id,b.name specName
        FROM com_expert_spec a
        left join system_parameter b on a.spec_id=b.id and b.type_id=42
        where expert_id=#{expertId}
    </select>
    <select id="getExpertListBySpecId"  resultType="com.yiboshi.science.param.dto.ComExpertDTO">
        select distinct  a.expert_id id,c.person_name,c.cert_id,c.sex,c.birthday,e.unit_name as work_unit
        from com_expert_spec a
        left join com_expert b on a.expert_id=b.id
        left join com_person c on b.person_id=c.id
        left join system_parameter d on a.spec_id=d.id
        left join com_unit e on c.unit_id = e.id
        <where>
            ${ew.sqlSegment}
        </where>
    </select>

    <select id="getExpertListBySpecIdProjId" resultType="com.yiboshi.science.param.dto.ComExpertDTO">
        select distinct  a.expert_id id,c.person_name,c.cert_id,c.sex,c.birthday,e.unit_name as work_unit
        from com_expert_spec a
        left join com_expert b on a.expert_id=b.id
        left join com_person c on b.person_id=c.id
        left join system_parameter d on a.spec_id=d.id
        left join com_unit e on c.unit_id = e.id
        where b.person_id not in (
        select b.id from com_expert a left join com_person b on a.person_id = b.id
        where b.unit_id in (select app_unit_id from com_project where id in
        <foreach collection="porjIds" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>))
        <if test=' specIds != null '>
            and a.spec_id in
            <foreach collection="specIds" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>
    
    <select id="getExpertListByExpertSpecIds" resultType="com.yiboshi.science.param.dto.ComExpertDTO">
        select distinct  a.expert_id id,c.person_name,c.cert_id,c.sex,c.birthday,e.unit_name as work_unit
        from com_expert_spec a
                 left join com_expert b on a.expert_id=b.id
                 left join com_person c on b.person_id=c.id
                 left join system_parameter d on a.spec_id=d.id
                 left join com_unit e on c.unit_id = e.id
        <if test=' specIds != null '>
            where a.spec_id in
            <foreach collection="specIds" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="parentIds != null">
            where d.parent_id in
            <foreach collection="parentIds" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="personName != null">
            where c.person_name like CONCAT('%',#{personName},'%')
        </if>
    </select>
</mapper>