123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652 |
- <?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.projectcontentinfo.dao.ProjectReportDataDao">
-
- <sql id="projectReportDataColumns">
- a.id AS "id",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.company_id AS "companyId",
- a.office_id AS "officeId",
- a.project_id AS "project.id",
- a.name AS "name",
- a.number AS "number",
- a.type AS "type",
- a.achievement_type AS "achievementType",
- a.review_standard AS "reviewStandard",
- a.sign_cost_one AS "signCostOne.id",
- a.sign_cost_two AS "signCostTwo.id",
- a.master AS "master.id",
- a.report_date AS "reportDate",
- a.file_status AS "fileStatus",
- a.status AS "status",
- a.invalid_status AS "invalidStatus",
- a.report_type AS "reportType",
- a.process_instance_id AS "processInstanceId",
- a.invalid_process_instance_id AS "invalidProcessInstanceId",
- m.name AS "master.name",
- a.number_path as "numberPath",
- a.update_process_instance_id as "upId",
- a.review_fee AS "reviewFee",
- a.approval_fee AS "approvalFee",
- a.contract_fee AS "contractFee",
- a.verify_fee AS "verifyFee",
- a.verify_rate AS "verifyRate",
- a.consult_fee AS "consultFee",
- a.building_fee AS "buildingFee",
- a.install_fee AS "installFee"
- </sql>
-
- <sql id="projectReportDataJoins">
- LEFT JOIN sys_user m ON m.id = a.master
- </sql>
-
-
- <select id="get" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findByNum" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- WHERE a.number = #{number}
- </select>
- <select id="getNoInvalid" resultType="ProjectReportData" >
- SELECT
- a.id AS "id",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.company_id AS "companyId",
- a.office_id AS "officeId",
- a.project_id AS "project.id",
- a.name AS "name",
- a.number AS "number",
- a.type AS "type",
- a.achievement_type AS "achievementType",
- a.review_standard AS "reviewStandard",
- a.sign_cost_one AS "signCostOne.id",
- a.sign_cost_two AS "signCostTwo.id",
- a.master AS "master.id",
- a.report_date AS "reportDate",
- a.file_status AS "fileStatus",
- a.status AS "status",
- a.report_type AS "reportType",
- a.process_instance_id AS "processInstanceId",
- m.name AS "master.name",
- a.number_path as "numberPath",
- a.review_fee AS "reviewFee",
- a.approval_fee AS "approvalFee",
- a.contract_fee AS "contractFee",
- a.verify_fee AS "verifyFee",
- a.verify_rate AS "verifyRate",
- a.consult_fee AS "consultFee",
- a.building_fee AS "buildingFee",
- a.install_fee AS "installFee"
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="getNumber" resultType="ProjectReportData" >
- SELECT
- a.id AS "id",
- a.number AS "number"
- FROM project_report_data a
- WHERE
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.project_id = #{project.id}
- ORDER BY a.number DESC
- limit 1
- </select>
- <select id="getChangeId" resultType="java.lang.String" >
- SELECT
- a.id AS "id"
- FROM project_report_change a
- WHERE
- a.del_flag = '0'
- AND a.report_id = #{id}
- ORDER BY a.before_count DESC
- limit 1
- </select>
- <select id="findList" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="project != null and project.id != null and project.id != ''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="name != null and name != ''">
- AND a.name like
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
- </if>
- <if test="number != null and number != ''">
- AND a.number = #{number}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="master!=null and master.id != null and master.id != ''">
- AND a.master = #{master.id}
- </if>
- <if test="startDate != null and startDate != ''">
- AND a.report_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- AND a.report_date <= #{endDate}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findInfoList" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>,
- wci.contract_num AS "contractNum",
- wci.name AS "contractName",
- wct.name AS "clientName",
- o.top_company AS "officeName",
- uo.name AS "signCostOne.name",
- ut.name AS "signCostTwo.name",
- r.project_name AS "project.projectName",
- r.project_id AS "project.projectId"
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- LEFT JOIN sys_office o ON o.id = a.office_id
- LEFT JOIN sys_user uo ON uo.id = a.sign_cost_one
- LEFT JOIN sys_user ut ON ut.id = a.sign_cost_two
- LEFT JOIN project_records r ON r.id = a.project_id
- LEFT JOIN work_contract_info wci on r.contract_id = wci.id
- LEFT JOIN work_client_info wct on wci.client_id = wct.id
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="project != null and project.id != null and project.id != ''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="name != null and name != ''">
- AND a.name like
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
- </if>
- <if test="number != null and number != ''">
- AND a.number like
- <if test="dbName == 'oracle'">'%'||#{number}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{number}, '%')</if>
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="achievementType != null and achievementType != ''">
- AND a.achievement_type = #{achievementType}
- </if>
- <if test="signCostOne!=null and signCostOne.id != null and signCostOne.id != ''">
- AND a.sign_cost_one = #{signCostOne.id}
- </if>
- <if test="signCostTwo!=null and signCostTwo.id != null and signCostTwo.id != ''">
- AND a.sign_cost_two = #{signCostTwo.id}
- </if>
- <if test="master!=null and master.id != null and master.id != ''">
- AND a.master = #{master.id}
- </if>
- <if test="reviewStandard != null and reviewStandard != ''">
- AND a.review_standard = #{reviewStandard}
- </if>
- <if test="startDate != null and startDate != ''">
- AND a.report_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- AND a.report_date <= #{endDate}
- </if>
- <if test="fileStatus != null and fileStatus != ''">
- AND a.file_status = #{fileStatus}
- </if>
- <if test="officeId != null and officeId != ''">
- AND a.office_id = #{officeId}
- </if>
- <if test="createStartDate != null and createStartDate != ''">
- AND a.create_date >= #{createStartDate}
- </if>
- <if test="createEndDate != null and createEndDate != ''">
- AND a.create_date <= #{createEndDate}
- </if>
- <if test="project!=null and project.projectName != null and project.projectName != ''">
- AND r.project_name like
- <if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{project.projectName}, '%')</if>
- </if>
- <if test="contractNum != null and contractNum != ''">
- AND wci.contract_num like
- <if test="dbName == 'oracle'">'%'||#{contractNum}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{contractNum}, '%')</if>
- </if>
- <if test="clientName != null and clientName != ''">
- AND wct.name like
- <if test="dbName == 'oracle'">'%'||#{clientName}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{clientName}, '%')</if>
- </if>
- <if test="projectMasterId != null and projectMasterId != ''">
- AND #{projectMasterId} in (select user_id from work_project_user pm WHERE pm.project_id = a.project_id AND is_master = '1' AND pm.del_flag = '0')
- </if>
- ${sqlMap.dsf}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findInfoListByStatus" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>,
- wci.contract_num AS "contractNum",
- wci.name AS "contractName",
- wct.name AS "clientName",
- o.name AS "officeName",
- uo.name AS "signCostOne.name",
- ut.name AS "signCostTwo.name",
- r.project_name AS "project.projectName",
- r.project_id AS "project.projectId"
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- LEFT JOIN sys_office o ON o.id = a.office_id
- LEFT JOIN sys_user uo ON uo.id = a.sign_cost_one
- LEFT JOIN sys_user ut ON ut.id = a.sign_cost_two
- LEFT JOIN project_records r ON r.id = a.project_id
- LEFT JOIN work_contract_info wci on r.contract_id = wci.id
- LEFT JOIN work_client_info wct on wci.client_id = wct.id
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="project != null and project.id != null and project.id != ''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="name != null and name != ''">
- AND a.name like
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
- </if>
- <if test="number != null and number != ''">
- AND a.number like
- <if test="dbName == 'oracle'">'%'||#{number}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{number}, '%')</if>
- </if>
- <if test="achievementType != null and achievementType != ''">
- AND a.achievement_type = #{achievementType}
- </if>
- <if test="signCostOne!=null and signCostOne.id != null and signCostOne.id != ''">
- AND a.sign_cost_one = #{signCostOne.id}
- </if>
- <if test="signCostTwo!=null and signCostTwo.id != null and signCostTwo.id != ''">
- AND a.sign_cost_two = #{signCostTwo.id}
- </if>
- <!--<if test="master!=null and master.id != null and master.id != ''">-->
- <!--AND a.master = #{master.id}-->
- <!--</if>-->
- <if test="reviewStandard != null and reviewStandard != ''">
- AND a.review_standard = #{reviewStandard}
- </if>
- <if test="startDate != null and startDate != ''">
- AND a.report_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- AND a.report_date <= #{endDate}
- </if>
- <if test="fileStatus != null and fileStatus != ''">
- AND a.file_status = #{fileStatus}
- </if>
- <if test="officeId != null and officeId != ''">
- AND a.office_id = #{officeId}
- </if>
- <if test="createStartDate != null and createStartDate != ''">
- AND a.create_date >= #{createStartDate}
- </if>
- <if test="createEndDate != null and createEndDate != ''">
- AND a.create_date <= #{createEndDate}
- </if>
- <if test="project!=null and project.projectName != null and project.projectName != ''">
- AND r.project_name like
- <if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{project.projectName}, '%')</if>
- </if>
- <if test="contractNum != null and contractNum != ''">
- AND wci.contract_num like
- <if test="dbName == 'oracle'">'%'||#{contractNum}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{contractNum}, '%')</if>
- </if>
- <if test="clientName != null and clientName != ''">
- AND wct.name like
- <if test="dbName == 'oracle'">'%'||#{clientName}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{clientName}, '%')</if>
- </if>
- <if test="projectMasterId != null and projectMasterId != ''">
- AND #{projectMasterId} in (select user_id from work_project_user pm WHERE pm.project_id = a.project_id AND is_master = '1' AND pm.del_flag = '0')
- </if>
- AND a.status in ('5','7')
- AND a.create_by = #{createBy.id}
- ${sqlMap.dsf}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findInvalidList" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} AND a.status IN ('6','7')
- <if test="project != null and project.id != null and project.id != ''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="name != null and name != ''">
- AND a.name like
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
- </if>
- <if test="number != null and number != ''">
- AND a.number = #{number}
- </if>
- <if test="master!=null and master.id != null and master.id != ''">
- AND a.master = #{master.id}
- </if>
- <if test="startDate != null and startDate != ''">
- AND a.report_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- AND a.report_date <= #{endDate}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert">
- INSERT INTO project_report_data(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- company_id,
- office_id,
- project_id,
- name,
- number,
- type,
- achievement_type,
- review_standard,
- sign_cost_one,
- sign_cost_two,
- master,
- report_date,
- file_status,
- status,
- invalid_status,
- report_type,
- number_path,
- review_fee,
- approval_fee,
- contract_fee,
- verify_fee,
- verify_rate,
- consult_fee,
- building_fee,
- install_fee
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{companyId},
- #{officeId},
- #{project.id},
- #{name},
- #{number},
- #{type},
- #{achievementType},
- #{reviewStandard},
- #{signCostOne.id},
- #{signCostTwo.id},
- #{master.id},
- #{reportDate},
- #{fileStatus},
- #{status},
- #{invalidStatus},
- #{reportType},
- #{numberPath},
- #{reviewFee},
- #{approvalFee},
- #{contractFee},
- #{verifyFee},
- #{verifyRate},
- #{consultFee},
- #{buildingFee},
- #{installFee}
- )
- </insert>
-
- <update id="update">
- UPDATE project_report_data SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- company_id = #{companyId},
- office_id = #{officeId},
- project_id = #{project.id},
- name = #{name},
- number = #{number},
- type = #{type},
- achievement_type = #{achievementType},
- review_standard = #{reviewStandard},
- sign_cost_one = #{signCostOne.id},
- sign_cost_two = #{signCostTwo.id},
- master = #{master.id},
- report_date = #{reportDate},
- status = #{status},
- invalid_status = #{invalidStatus},
- report_type = #{reportType},
- number_path = #{numberPath},
- review_fee = #{reviewFee},
- approval_fee = #{approvalFee},
- contract_fee = #{contractFee},
- verify_fee = #{verifyFee},
- verify_rate = #{verifyRate},
- consult_fee = #{consultFee},
- building_fee = #{buildingFee},
- install_fee = #{installFee}
- WHERE id = #{id}
- </update>
- <update id="updateFileStatus">
- UPDATE project_report_data SET
- file_status = #{fileStatus}
- WHERE id = #{id}
- </update>
- <update id="saveInvalid">
- UPDATE project_report_data SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- <if test="invalidStatus != null and invalidStatus != ''">
- invalid_status = #{invalidStatus},
- </if>
- status = #{status}
- WHERE id = #{id}
- </update>
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM project_report_data
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE project_report_data SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="ProjectReportData" statementType="STATEMENT">
- select * FROM project_report_data where ${propertyName} = '${value}'
- </select>
- <update id="updateProcessInstanceId">
- UPDATE project_report_data SET
- process_instance_id = #{processInstanceId}
- WHERE id = #{id}
- </update>
- <!-- 获取流程ID -->
- <select id="getByProcessInstanceId" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- WHERE a.process_instance_id = #{processInstanceId}
- </select>
- <update id="updateInvalidProcessInstanceId">
- UPDATE project_report_data SET
- invalid_process_instance_id = #{invalidProcessInstanceId}
- WHERE id = #{id}
- </update>
- <update id="deleteReportDataInfo">
- DELETE FROM project_report_content WHERE report_id = #{reportId} AND type = '1'
- </update>
- <update id="deleteReportDataBased">
- DELETE FROM project_report_content WHERE report_id = #{reportId} AND type = '3'
- </update>
- <update id="deleteContentChange">
- DELETE FROM project_content_change WHERE info_id = #{infoId}
- </update>
- <update id="reportNumber">
- UPDATE project_report_data SET
- number = #{number},number_path = #{url}
- WHERE id = #{reportId}
- </update>
- <!-- 获取流程ID -->
- <select id="getByInvalidProcessInstanceId" resultType="ProjectReportData" >
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- WHERE a.invalid_process_instance_id = #{invalidProcessInstanceId}
- </select>
- <update id="updateUpId">
- update project_report_data
- set update_process_instance_id = #{upId}
- <where>
- id = #{id}
- </where>
- </update>
- <select id="findByProjectId" parameterType="String" resultType="ProjectReportData">
- SELECT
- <include refid="projectReportDataColumns"/>
- FROM project_report_data a
- <include refid="projectReportDataJoins"/>
- <where>
- project_id = #{projectId}
- </where>
- </select>
- <select id="getInvoiceByProjectId" resultType="com.jeeplus.modules.workinvoice.entity.WorkInvoice">
- select a.id as "id",
- a.process_instance_id as "processInstanceId",
- a.number as "number",
- a.project_id as "projectId",
- a.money as "money",
- a.invoice_date as "invoiceDate",
- a.invoice_state as "invoiceState",
- a.create_date as "createDate",
- b.number as "workAccountNumber",
- b.tax_money as "taxMoney",
- w.name as "client.name"
- from work_invoice a
- left join work_invoice_detail b on a.id=b.invoice_id
- left join work_client_info w on w.id = a.client_id
- where a.project_id = #{projectId}
- order by a.invoice_date desc, b.create_by asc,a.create_by asc
- </select>
- </mapper>
|