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
<?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.ComProjectDAO">
<sql id="allColumns">
t.id as id, t.proj_name as projName, t.proj_no as projNo, t.proj_class as projClass, t.app_no as appNo, t.version_no as versionNo, t.report_year as reportYear, t.proj_state as projState,
t.app_unit_id as appUnitId, t.app_person_id as appPersonId, t.start_date as startDate, t.end_date as endDate, t.apply_money as applyMoney, t.proj_content as projContent, t.research_projects as researchProjects,
t.knowledge_id as knowledgeId, t.mem_count as memCount, t.mem_high_count as memHighCount, t.mem_middle_count as memMiddleCount, t.mem_low_count as memLowCount, t.mem_other_count as memOtherCount, t.mem_bs_count as memBsCount, t.mem_ss_count as memSsCount,
t.mem_degree1 as memDegree1, t.mem_degree2 as memDegree2, t.proj_keywords as projKeywords, t.proj_basis as projBasis, t.research_content as researchContent, t.research_plan as researchPlan, t.study_plan as studyPlan, t.main_features as mainFeatures,
t.expected_results as expectedResults, t.work_foundation as workFoundation, t.working_conditions as workingConditions, t.mem_resume as memResume, t.proj_doc as projDoc, t.file_id as fileId, t.remark as remark, t.created as created,
t.updated as updated
</sql>
<select id="getListByPage" resultType="com.yiboshi.science.param.dto.ComProjectDTO">
SELECT
c.id,c.report_year,c.proj_name,c.proj_no,c.version_no,c.proj_class,c.start_date,c.end_date,c.proj_state,d.unit_name
app_unit_name,e.person_name app_person_name,f.name knowledge_name
from com_project c
left join com_unit d on c.app_unit_id=d.id
left join com_person e on c.app_person_id=e.id
left join system_parameter f on c.knowledge_id = f.id
<where>
${ew.sqlSegment}
</where>
</select>
<select id="getProjectNo" parameterType="java.lang.String" resultType="java.lang.String">
SELECT right(CONCAT('000',cast((ifnull(SUBSTR(max(proj_no),LENGTH(max(proj_no))-3),0)+1) as char)),4) code from com_project where proj_no like concat(#{code},'%')
</select>
<select id="getCount" resultType="com.yiboshi.science.param.dto.DataStatisticsDTO">
SELECT ifnull(sum(case when proj_state in(-10,10) then 1 else 0 end),0) count1,
ifnull(sum(case when proj_state =30 then 1 else 0 end),0) count2,
ifnull(sum(case when proj_state in(20,22,24,26,28,40,50) then 1 else 0 end),0) count3,
ifnull(sum(case when proj_state is not null then 1 else 0 end),0) count4
FROM com_project c
left join com_unit d on c.app_unit_id=d.id
<where>
${ew.sqlSegment}
</where>
</select>
<select id="getById" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectDTO">
SELECT a.*,b.name knowledge_name,
ic.proj_id,ic.app_unit_name,ic.unit_type,ic.organization_code,ic.address,
ic.registered_address,ic.post_code,ic.legal_person,ic.workforce,ic.specialized_personnel,ic.research_personnel,ic.deposit_bank,
ic.bank_account,ic.deposit_bank_address,ic.interbank_number,ic.research_total,ic.is_research_active,ic.research_count,
ic.research_person_count,ic.lead_unit,ic.recommend_unit,ic.technology_innovation_base,ic.total_funding,ic.gov_funding,ic.unit_funding,ic.self_funding,ic.other_funding,ic.link_name,ic.link_mobile,ic.link_email,ic.proj_abstract,
ic.proj_keywords,ic.proj_content,ic.mem_resume, ic.research_progress,
ic.research_content,ic.technology_target,ic.economy_target,ic.achievement_target,
ic.other_target,ic.proj_basis,ic.research_plan,ic.main_features,ic.expected_results,ic.research_projects,ic.proj_attribute,ic.remark,
ic.year_target,ic.year1_goal,ic.year2_goal,ic.year3_goal
from com_project a
left join com_project_basic ic on a.id=ic.proj_id
left join system_parameter b on a.knowledge_id=b.id
where a.id = #{id}
</select>
<select id="getProjectReportCountByGov" resultType="com.yiboshi.science.param.dto.DataStatisticsDTO">
select count(*) as count1 from com_project where proj_state = 26 and proj_type = 1 and app_unit_id in (
select id from com_unit where tree_code like CONCAT('',#{treeCode},'%') and unit_type <> 0
)
</select>
<select id="getProjectReportCountByUnitId" resultType="com.yiboshi.science.param.dto.DataStatisticsDTO">
select count(*) as count1 from com_project where proj_state = 26 and proj_type = 1 and app_unit_id = #{appUnitId}
</select>
</mapper>