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
<?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.ComProjectMembersDAO">
<sql id="allColumns">
t.id as id, t.object_id as objectId, t.name as name, t.birthday as birthday, t.degree as degree, t.title as title, t.research_direction as researchDirection, t.work_unit as workUnit,
t.proj_work as projWork, t.for_months as forMonths, t.show_index as showIndex, t.role as role, t.created as created
</sql>
<select id="getMemWorkCountByObjectId" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(distinct(work_unit)) workCount from com_project_members where object_id=#{objectId}
</select>
<select id="getListByObjectId" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectMembersDTO">
SELECT a.*,b.name certificate_type_name,c.name nation_name,d.name title_name,e.name degree_name,f.name spec_name
,g.id download_id,g.download_url,g.convert_url,g.file_name
FROM com_project_members a
left join system_parameter b on a.certificate_type=b.id and b.type_id=49
left join system_parameter c on a.nation=c.id and c.type_id=11
left join system_parameter d on a.title = d.id and d.type_id=7
left join system_parameter e on a.degree=e.id and e.type_id=9
left join system_parameter f on a.spec=f.id and f.type_id=68
left join com_download g on a.file_id=g.id
where object_id=#{objectId}
order by a.show_index asc
</select>
<select id="getMemCountById" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectMembersDTO">
select IFNULL(count(*),0)mem_count,
IFNULL(sum(case when d.gb_Code='1' then 1 else 0 end),0)mem_high_count,
IFNULL(sum(case when d.gb_Code='2' then 1 else 0 end),0)mem_middle_count,
IFNULL(sum(case when d.gb_Code='3' then 1 else 0 end),0)mem_low_count,
IFNULL(sum(case when c.gb_Code='1' then 1 else 0 end),0)mem_bsh_count,
IFNULL(sum(case when c.gb_Code='2' then 1 else 0 end),0)mem_bs_count,
IFNULL(sum(case when c.gb_Code='3' then 1 else 0 end),0)mem_ss_count,
IFNULL(sum(case when c.gb_Code='4' then 1 else 0 end),0)mem_xs_count
from com_project_members a
left join system_parameter b on a.title=b.id and b.type_id=7
left join system_parameter d on b.parent_id=d.id and d.type_id=6
left join system_parameter c on a.degree=c.id and c.type_id=9
where object_id=#{objectId}
</select>
</mapper>