<?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} order by a.show_index </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=68 where expert_id=#{expertId} order by a.show_index </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.id unit_id, (case when e.unit_name is null then c.work_unit else e.unit_name end) 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.id is not null <if test=' specIds != null and specIds.size() > 0'> and a.spec_id in <foreach collection="specIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="personName != null"> and c.person_name like CONCAT('%',#{personName},'%') </if> </select> <select id="getExpertListByExpertSpecIdOrParentId" 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 p on a.spec_id = p.id left join system_parameter p1 on p.parent_id = p1.id left join system_parameter p2 on p1.parent_id = p2.id left join com_unit e on c.unit_id = e.id <if test=' specId != null '> where a.spec_id = #{specId} </if> <if test=' pkey != null '> where p1.id = #{pkey} </if> <if test=' ppkey != null '> where p2.id = #{ppkey} </if> </select> </mapper>