<?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.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.proj_content, ic.proj_attribute,ic.remark,ic.year_target,ic.year1_goal,ic.year2_goal,ic.year3_goal, c.id download_id,c.download_url,c.file_name 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 and b.type_id=68 left join com_download c on ic.file_id=c.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>