<?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.test_state as testState, t.test_content as testContent, t.budget_count as budgetCount, t.budget_gov_count as budgetGovCount, t.start_date as startDate,
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,b.test_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.test_state < 1 or b.id is null) then 1 else 0 end),0) count1,
ifnull(sum(case when c.proj_state=50 and b.test_state =30 then 1 else 0 end),0) count2,
ifnull(sum(case when c.proj_state=50 and b.test_state in(1,10,20) then 1 else 0 end),0) count3,
ifnull(sum(case when c.proj_state=50 then 1 else 0 end),0) count4
from com_project c
left join com_project_test b on b.proj_id=c.id
<where>
${ew.sqlSegment}
</where>
</select>
</mapper>
-
徐俊 authoredd3497d84