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
77
78
79
80
81
82
<?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.ComProjectAssignDAO">
<sql id="allColumns">
t.id as id, t.expert_id as expertId, t.proj_id as projId, t.assign_year as assignYear, t.total_score as gradeScore, t.remark as remark, t.created as created, t.updated as updated
</sql>
<select id="getListByPage" resultType="com.yiboshi.science.param.dto.ComProjectAssignDTO">
SELECT a.*, c.person_name,c.cert_id,c.sex,c.birthday,c.mobile,c.email,c.education,c.title,g.unit_name
,d.name education_name,e.name title_name,f.proj_name,f.app_no,f.proj_no,h.total_funding
FROM com_project_assign 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 com_unit g ON c.unit_id = g.id
left join system_parameter d on c.education=d.id and d.type_id=8
left join system_parameter e on c.title=e.id and e.type_id=7
left join com_project f on a.proj_id=f.id
left join com_project_basic h on f.id = h.proj_id
<where>
${ew.sqlSegment}
</where>
ORDER BY f.id,a.created ASC
</select>
<select id="getAssignExpertListByProjectId" resultType="com.yiboshi.science.param.dto.ComProjectAssignDTO">
SELECT a.*, c.person_name,c.cert_id,c.sex,c.birthday,c.mobile,c.email,c.education,c.title,g.unit_name
,d.name education_name,e.name title_name
FROM com_project_assign 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 com_unit g ON c.unit_id = g.id
left join system_parameter d on c.education=d.id and d.type_id=8
left join system_parameter e on c.title=e.id and e.type_id=7
where a.proj_id = #{projectId}
</select>
<select id="getAssignExpertList" resultType="com.yiboshi.science.param.dto.ComProjectAssignDTO">
SELECT
a.*, c.person_name as personName
FROM com_project_assign a
LEFT JOIN com_expert b ON a.expert_id = b.id
LEFT JOIN com_person c ON b.person_id = c.id
where a.proj_id = #{projectId}
</select>
<select id="getAssignExpertById" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectAssignDTO">
SELECT a.*, c.person_name,c.cert_id,c.sex,c.birthday,c.mobile,c.email,c.education,c.title,g.unit_name
,d.name education_name,e.name title_name,f.proj_name,f.proj_no
FROM com_project_assign 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 com_unit g ON c.unit_id = g.id
left join system_parameter d on c.education=d.id and d.type_id=8
left join system_parameter e on c.title=e.id and e.type_id=7
left join com_project f on a.proj_id=f.id
where a.id = #{id}
</select>
<select id="getAssignCount" parameterType="java.lang.String" resultType="com.yiboshi.science.entity.AssignCount">
SELECT assign_year year,count(*) assignCount
FROM com_project_assign a
where expert_id=#{expertId}
group by assign_year
</select>
<select id="getProjectGroupAssignById" resultType="com.yiboshi.science.param.dto.ComProjectGroupDTO">
select a.*, b.proj_id, c.expert_id, d.id as assign_id from com_project_group a
left join com_project_group_detail b on a.id = b.group_id
left join com_project_group_assign c on a.id = c.group_id
left join com_project_assign d on b.proj_id = d.proj_id and c.expert_id = d.expert_id
where a.id = #{id} and c.expert_id = #{expertId} and d.id is not null
</select>
<update id="updateAssignState">
update com_project
<set>
assign_state = #{assignState},
completed = #{completed},
total_score = #{totalScore},
average_score = #{averageScore},
updated = #{updated,jdbcType=TIMESTAMP},
</set>
where id = #{id}
</update>
</mapper>