|
@@ -0,0 +1,263 @@
|
|
|
+<?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.jeeplus.modules.statement.dao.StatementCompanyComprehensiveDao">
|
|
|
+
|
|
|
+ <sql id="projectRecordsColumns">
|
|
|
+ distinct(a.id) AS "id",
|
|
|
+ a.create_date AS "createDate",
|
|
|
+ a.del_flag AS "delFlag",
|
|
|
+ a.office_id AS "officeId",
|
|
|
+ a.year as "year",
|
|
|
+ a.type as "type",
|
|
|
+ a.big_date_type as "bigDateType",
|
|
|
+ a.small_date_type as "smallDateType",
|
|
|
+ a.statement_date as "statementDate",
|
|
|
+ a.office_id as "officeId",
|
|
|
+ a.field1 as "field1",
|
|
|
+ a.field2 as "field2",
|
|
|
+ a.field3 as "field3",
|
|
|
+ a.field4 as "field4",
|
|
|
+ a.field5 as "field5",
|
|
|
+ a.field6 as "field6"
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="findList" resultType="RuralProjectRecords" >
|
|
|
+ SELECT
|
|
|
+ <include refid="projectRecordsColumns"/>
|
|
|
+ ,o.name AS "officeName"
|
|
|
+ FROM statement_company_comprehensive_info a
|
|
|
+ LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
+ <where>
|
|
|
+ <if test="year != null and year != ''">
|
|
|
+ AND a.year = #{year}
|
|
|
+ </if>
|
|
|
+ <if test="type != null and type != ''">
|
|
|
+ AND a.type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="bigDateType != null and bigDateType != ''">
|
|
|
+ AND a.big_date_type = #{bigDateType}
|
|
|
+ </if>
|
|
|
+ <if test="smallDateType != null and smallDateType != ''">
|
|
|
+ AND a.small_date_type = #{smallDateType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ ORDER BY o.offcie_name asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryCount" resultType="int" >
|
|
|
+ SELECT count(DISTINCT a.id)
|
|
|
+ FROM statement_company_comprehensive_info a
|
|
|
+ LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
+ <where>
|
|
|
+ <if test="year != null and year != ''">
|
|
|
+ AND a.year = #{year}
|
|
|
+ </if>
|
|
|
+ <if test="type != null and type != ''">
|
|
|
+ AND a.type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="bigDateType != null and bigDateType != ''">
|
|
|
+ AND a.big_date_type = #{bigDateType}
|
|
|
+ </if>
|
|
|
+ <if test="smallDateType != null and smallDateType != ''">
|
|
|
+ AND a.small_date_type = #{smallDateType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insert">
|
|
|
+ INSERT INTO statement_company_comprehensive_info(
|
|
|
+ id,
|
|
|
+ create_date,
|
|
|
+ year,
|
|
|
+ type,
|
|
|
+ big_date_type,
|
|
|
+ small_date_type,
|
|
|
+ statement_date,
|
|
|
+ office_id,
|
|
|
+ field1,
|
|
|
+ field2,
|
|
|
+ field3,
|
|
|
+ field4,
|
|
|
+ field5,
|
|
|
+ field6
|
|
|
+ ) VALUES (
|
|
|
+ #{id},
|
|
|
+ #{createDate},
|
|
|
+ #{year},
|
|
|
+ #{type},
|
|
|
+ #{bigDateType},
|
|
|
+ #{smallDateType},
|
|
|
+ #{statementDate},
|
|
|
+ #{officeId},
|
|
|
+ #{field1},
|
|
|
+ #{field2},
|
|
|
+ #{field3},
|
|
|
+ #{field4},
|
|
|
+ #{field5},
|
|
|
+ #{field6}
|
|
|
+
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update">
|
|
|
+ UPDATE statement_company_comprehensive_info SET
|
|
|
+
|
|
|
+ year = #{year},
|
|
|
+ year = #{year},
|
|
|
+ big_date_type = #{bigDateType},
|
|
|
+ small_date_type = #{smallDateType},
|
|
|
+ statement_date = #{statementDate},
|
|
|
+ office_id = #{officeId},
|
|
|
+ field1 = #{field1},
|
|
|
+ field2 = #{field2},
|
|
|
+ field3 = #{field3},
|
|
|
+ field4 = #{field4},
|
|
|
+ field5 = #{field5},
|
|
|
+ field6 = #{field6}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getOfficeListInfo" resultType="Office">
|
|
|
+ select o.id,o.name from statement_office_info a
|
|
|
+ left join sys_office o on o.id = a.office_id
|
|
|
+ ORDER BY o.code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAllOfficeListInfo" resultType="Office">
|
|
|
+ select a.id,a.name from sys_office a
|
|
|
+ <where>
|
|
|
+ a.parent_id = 'ffe5af5b557e46f28b000c94716e228a'
|
|
|
+ </where>
|
|
|
+ ORDER BY a.code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertProjectCountByGrade" resultType="java.lang.Integer">
|
|
|
+ select count(1) from rural_project_records a
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.submit_money = #{grade}
|
|
|
+ and a.create_date >= #{beginDate}
|
|
|
+ and a.create_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProjectCountByRecord" resultType="java.lang.Integer">
|
|
|
+ select count(1) from rural_project_records a
|
|
|
+ left join project_report_data prd on a.id = prd.project_id
|
|
|
+ left join rural_project_report_record rprr on prd.id = rprr.report_id
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.record_state = 5
|
|
|
+ and a.over_record_status = 0
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and rprr.status = 5
|
|
|
+ and rprr.del_flag = 0
|
|
|
+ and rprr.accomplish_date >= #{beginDate}
|
|
|
+ and rprr.accomplish_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProjectCountByReported" resultType="java.lang.Integer">
|
|
|
+ select count(1) from rural_project_records a
|
|
|
+ left join rural_project_records_reported rprr on a.id = rprr.id
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.reported_state = 5
|
|
|
+ and a.over_due_status = 0
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and rprr.report_status = 5
|
|
|
+ and rprr.del_flag = 0
|
|
|
+ and rprr.accomplish_date >= #{beginDate}
|
|
|
+ and rprr.accomplish_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getInsertInvoiceCountByOffice" resultType="java.lang.Integer">
|
|
|
+ select count(1) from work_invoice a
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.invoice_state = 5
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.invoice_date >= #{beginDate}
|
|
|
+ and a.invoice_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertInvoiceSumMoneyByOffice" resultType="java.lang.String">
|
|
|
+ select round(sum(money),2) from work_invoice a
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.invoice_state = 5
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.invoice_date >= #{beginDate}
|
|
|
+ and a.invoice_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertInvoiceDetailsCountByOffice" resultType="java.lang.Integer">
|
|
|
+ select count(1) from work_invoice_detail a
|
|
|
+ left join work_invoice wi on a.invoice_id = wi.id
|
|
|
+ <where>
|
|
|
+ wi.del_flag=0
|
|
|
+ and a.del_flag=0
|
|
|
+ and wi.invoice_state = 5
|
|
|
+ and wi.receipt_money = '1'
|
|
|
+ and wi.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and wi.receipt_money_date >= #{beginDate}
|
|
|
+ and wi.receipt_money_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertInvoiceDetailsSumMoneyByOffice" resultType="java.lang.String">
|
|
|
+ select round(sum(a.total_money),2) from work_invoice_detail a
|
|
|
+ left join work_invoice wi on a.invoice_id = wi.id
|
|
|
+ <where>
|
|
|
+ wi.del_flag=0
|
|
|
+ and a.del_flag=0
|
|
|
+ and wi.invoice_state = 5
|
|
|
+ and wi.receipt_money = '1'
|
|
|
+ and wi.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and wi.receipt_money_date >= #{beginDate}
|
|
|
+ and wi.receipt_money_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertReimbursementCountByOffice" resultType="java.lang.Integer">
|
|
|
+ select count(1) from work_reimbursement a
|
|
|
+ <where>
|
|
|
+ and a.del_flag=0
|
|
|
+ and a.status = 5
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.accomplish_date >= #{beginDate}
|
|
|
+ and a.accomplish_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertReimbursementSumMoneyByOffice" resultType="java.lang.String">
|
|
|
+ select round(sum(a.money),2) from work_reimbursement a
|
|
|
+ <where>
|
|
|
+ a.del_flag=0
|
|
|
+ and a.status = 5
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.accomplish_date >= #{beginDate}
|
|
|
+ and a.accomplish_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInsertContractCountByOffice" resultType="java.lang.Integer">
|
|
|
+ select count(1) from work_contract_info a
|
|
|
+ <where>
|
|
|
+ and a.del_flag=0
|
|
|
+ and a.contract_state = 5
|
|
|
+ and a.office_id in(select id from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
|
|
|
+ and a.accomplish_date >= #{beginDate}
|
|
|
+ and a.accomplish_date <= #{endDate}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|