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
<?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.ComProjectTaskDAO">
<sql id="allColumns">
t.id as id, t.proj_id as projId, t.report_year as reportYear, t.task_state as taskState, t.end_date as endDate, t.created as created, t.updated as updated
</sql>
<select id="getListByPage" resultType="com.yiboshi.science.param.dto.ComProjectTaskDTO">
select b.id,ifnull(b.task_state,0) task_state,b.start_date,b.end_date,
c.id as proj_id,c.proj_name,c.proj_no,c.version_no,c.proj_class,c.report_year,c.start_date proj_start,c.end_date proj_end,
c.proj_state,d.unit_name app_unit_name,e.person_name app_person_name
from com_project c
left join com_project_task b on b.proj_id=c.id
left join com_unit d on c.app_unit_id=d.id
left join com_person e on c.app_person_id=e.id
<where>
${ew.sqlSegment}
</where>
</select>
<select id="getCount" resultType="com.yiboshi.science.param.dto.DataStatisticsDTO">
SELECT ifnull(sum(case when c.proj_state=50 and (b.task_state in(-10,10) or b.id is null) then 1 else 0 end),0)count1,
ifnull(sum(case when c.proj_state=50 and b.task_state =30 then 1 else 0 end),0) count2,
ifnull(sum(case when c.proj_state=50 and b.task_state in(20,40,50) then 1 else 0 end),0) count3,
ifnull(count(*),0) count4
from com_project c
left join com_project_task b on b.proj_id=c.id
<where>
${ew.sqlSegment}
</where>
</select>
<select id="getByProjId" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectTaskDTO">
SELECT ifnull(pt.task_state,0) task_state,
pt.id,pt.report_year,pt.start_date,pt.end_date,pt.unit_type,pt.organization_code,pt.unit_address,pt.registered_address,pt.post_code,
pt.legal_person,pt.workforce,pt.specialized_personnel,pt.research_personnel,
pt.deposit_bank,pt.bank_account,pt.deposit_bank_address,pt.interbank_number,
pt.key_areas,pt.proj_work,pt.telephone,pt.fax,
pt.link_name,pt.link_mobile,pt.link_fax,pt.link_email,
pt.is_technology_report,pt.project_report,pt.progress_report,pt.special_report,pt.final_report,
a.proj_name,a.proj_no,a.start_date projStart,a.end_date projEnd,a.app_person_id,a.app_unit_id,a.proj_type,
b.name knowledge_name,
ic.proj_id,ic.job_time,ic.main_research_areas,ic.address,
ic.unit_link_name,ic.unit_link_mobile,ic.unit_link_email,ic.unit_link_fax,ic.subject_scope,ic.proj_abstract,ic.proj_keywords,
ic.total_funding,ic.gov_funding,ic.unit_funding,ic.self_funding,ic.other_funding,
ic.research_content,ic.technology_target, ic.economy_target, ic.achievement_target, ic.technology_reports_target, ic.other_target,
ic.proj_attribute,ic.remark,ic.year_target,ic.year1_goal,ic.year2_goal,ic.year3_goal,ic.file_id,
c.id download_id,c.download_url,c.file_name
from com_project a
left join com_project_task pt on pt.proj_id=a.id
left join com_project_basic ic on a.id=ic.proj_id
left join system_parameter b on a.knowledge_id=b.id and b.type_id=68
left join com_download c on ic.file_id=c.id
where a.id = #{id}
</select>
</mapper>