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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?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>