123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242 |
- <?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.workcontractinfo.dao.WorkContractInfoDao">
-
- <sql id="workContractInfoColumns">
- a.id AS "id",
- a.create_by AS "createBy.id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.project_id AS "project.id",
- a.project_name AS "projectName",
- a.ext AS "ext",
- p.project_name AS "project.projectName",
- p.project_number AS "project.projectNumber",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.create_name AS "createName",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.company_id AS "companyId",
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.process_instance_id AS "processInstanceId",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.common_flag AS "commonFlag",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alterbefore_id AS "alterBeforeId",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.completion_status AS "completionStatus",
- a.signature_status as "signatureStatus",
- a.office_id AS "officeId",
- (select count(1) from work_contract_info c where c.total_contract_id = a.id) cnt
- </sql>
-
- <sql id="workContractInfoJoins">
- LEFT JOIN work_client_info client ON client.id = a.client_id
- LEFT JOIN sys_user u on u.id = a.create_by
- LEFT JOIN sys_office o ON o.id = a.office_id
- LEFT JOIN work_bid_project p ON p.id = a.project_id
- LEFT JOIN sys_office s ON s.id = a.company_id
- </sql>
-
-
- <select id="get" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- a.project_id AS "project.id",
- a.project_name AS "project.name",
- a.ext AS "ext",
- u.name AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.alterbefore_id AS "alterBeforeId",
- a.completion_status AS "completionStatus",
- a.common_flag AS "commonFlag",
- a.office_id AS "officeId",
- a.signature_status as "signatureStatus"
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findByReport" resultType="java.lang.Integer" >
- SELECT
- count(*)
- FROM work_contract_info a
- LEFT JOIN project_records r ON r.contract_id = a.id
- LEFT JOIN project_report_data d ON d.project_id = r.id
- WHERE a.id = #{id} AND (d.status != '5' or d.file_status != '3')
- </select>
- <select id="getByBeforeId" resultType="WorkContractInfo" >
- SELECT
- a.*,
- a.project_id AS "project.id",
- p.project_name AS "project.projectName",
- p.project_number AS "project.projectNumber",
- a.create_by AS "createBy.id",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- client.id AS "client.id",
- a.alter_state AS "alterState",
- a.alterbefore_id AS "alterBeforeId",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- client.name AS "client.name"
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE a.alterbefore_id = #{alterBeforeId} and a.del_flag = 0 and contract_state is null
- </select>
- <select id="getClientInfoByClientId" parameterType="java.lang.String" resultType="WorkClientInfo" >
- SELECT
- id As "id",
- name As "name",
- name_for_short AS "nameForShort",
- or_unicode AS "orUnicode",
- company_type AS "companyType",
- company_industry AS "companyIndustry",
- client_type AS "clientType",
- credit_rank AS "creditRank",
- area_id AS "area",
- zip_code AS "zipCode",
- fax AS "fax",
- tax_id AS "taxId",
- email AS "email",
- address AS address,
- register_address AS registerAddress,
- company_url AS companyUrl
- FROM
- work_client_info
- WHERE id=#{id} and del_flag = 0
- </select>
- <select id="findList" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- u.name AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.alterbefore_id AS "alterBeforeId",
- a.completion_status AS "completionStatus",
- a.common_flag AS "commonFlag",
- a.signature_status as "signatureStatus"
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and (a.alter_state is null or a.alter_state ="")
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="client != null and client.id != null and client.id != ''">
- AND a.client_id = #{client.id}
- </if>
- <if test="client != null and client.name != null and client.name != ''">
- AND client.name LIKE concat('%',#{client.name},'%')
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="totalContractIds != null and totalContractIds != ''">
- AND a.total_contract_ids LIKE
- <if test="dbName == 'oracle'">'%'||#{totalContractIds}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{totalContractIds}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{totalContractIds},'%')</if>
- </if>
- <!--<if test="totalContractId != null and totalContractId != ''">
- AND a.total_contract_id =#{totalContractId}
- </if>-->
- <if test="beginInvestmentAmount != null and endInvestmentAmount != null and beginInvestmentAmount != '' and endInvestmentAmount != ''">
- AND a.investment_amount >= #{beginInvestmentAmount} AND a.investment_amount <= #{endInvestmentAmount}
- </if>
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price like concat('%',#{contractPrice},'%')
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num like concat('%',#{contractNum},'%')
- </if>
- <if test="isTotal != null and isTotal != ''">
- AND a.is_total = #{isTotal}
- </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.contract_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="queryCount" resultType="int" >
- SELECT count(1)
- FROM work_contract_info a
- <if test="client != null and client.name != null and client.name != ''">
- LEFT JOIN work_client_info client ON client.id = a.client_id
- </if>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and (a.alter_state is null or a.alter_state ="")
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="client != null and client.id != null and client.id != ''">
- AND a.client_id = #{client.id}
- </if>
- <if test="client != null and client.name != null and client.name != ''">
- AND client.name LIKE concat('%',#{client.name},'%')
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="totalContractIds != null and totalContractIds != ''">
- AND a.total_contract_ids LIKE
- <if test="dbName == 'oracle'">'%'||#{totalContractIds}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{totalContractIds}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{totalContractIds},'%')</if>
- </if>
- <!--<if test="totalContractId != null and totalContractId != ''">
- AND a.total_contract_id =#{totalContractId}
- </if>-->
- <if test="beginInvestmentAmount != null and endInvestmentAmount != null and beginInvestmentAmount != '' and endInvestmentAmount != ''">
- AND a.investment_amount >= #{beginInvestmentAmount} AND a.investment_amount <= #{endInvestmentAmount}
- </if>
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price = #{contractPrice}
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num = #{contractNum}
- </if>
- <if test="isTotal != null and isTotal != ''">
- AND a.is_total = #{isTotal}
- </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.contract_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListReceipts" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.completion_status AS "completionStatus",
- a.alterbefore_id AS "alterBeforeId",
- (select name from work_contract_info where id = a.total_contract_id) AS "totalContractName",
- a.common_flag AS "commonFlag",
- (select count(1) from work_contract_info c where c.total_contract_id = a.id) cnt
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and (a.alter_state is null or a.alter_state ="")
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="createBy != null and createBy.id != null and createBy.id != '' and
- chargeCompany != null and chargeCompany != ''
- ">
- AND (a.create_by = #{createBy.id} or a.office_id= #{chargeCompany})
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.contract_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="ifindList" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.completion_status AS "completionStatus",
- a.alterbefore_id AS "alterBeforeId",
- (select name from work_contract_info where id = a.total_contract_id) AS "totalContractName",
- a.common_flag AS "commonFlag",
- (select count(1) from work_contract_info c where c.total_contract_id = a.id) cnt
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and (a.contract_state = 6 or a.contract_state = 7)
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="client != null and client.id != null and client.id != ''">
- AND a.client_id = #{client.id}
- </if>
- <if test="client != null and client.name != null and client.name != ''">
- AND client.name LIKE concat('%',#{client.name},'%')
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="totalContractIds != null and totalContractIds != ''">
- AND a.total_contract_ids LIKE
- <if test="dbName == 'oracle'">'%'||#{totalContractIds}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{totalContractIds}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{totalContractIds},'%')</if>
- </if>
- <!--<if test="totalContractId != null and totalContractId != ''">
- AND a.total_contract_id =#{totalContractId}
- </if>-->
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price like concat('%',#{contractPrice},'%')
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num like concat('%',#{contractNum},'%')
- </if>
- <!--<if test="isTotal != null and isTotal != ''">
- AND a.is_total = #{isTotal}
- </if>-->
- <choose>
- <when test="queryCon != null and queryCon != ''">
- AND (
- find_in_set(#{queryCon},a.create_bys)
- ${sqlMap.dsf}
- )
- </when>
- <otherwise>
- ${sqlMap.dsf}
- </otherwise>
- </choose>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.contract_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="afindList" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.construction_project_type AS "constructionProjectType",
- a.invalidate_process_instance_id AS "invalidateProcessInstanceId",
- a.alter_process_instance_id AS "alterProcessInstanceId",
- a.invalidate_status AS "invalidateStatus",
- a.invalidate_user AS "invalidateUserId",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.alterbefore_id AS "alterBeforeId",
- a.completion_status AS "completionStatus",
- (select name from work_contract_info where id = a.total_contract_id) AS "totalContractName",
- a.common_flag AS "commonFlag",
- (select count(1) from work_contract_info c where c.total_contract_id = a.id) cnt
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and a.alterbefore_id is not null
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="client != null and client.id != null and client.id != ''">
- AND a.client_id = #{client.id}
- </if>
- <if test="client != null and client.name != null and client.name != ''">
- AND client.name LIKE concat('%',#{client.name},'%')
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="totalContractIds != null and totalContractIds != ''">
- AND a.total_contract_ids LIKE
- <if test="dbName == 'oracle'">'%'||#{totalContractIds}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{totalContractIds}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{totalContractIds},'%')</if>
- </if>
- <!--<if test="totalContractId != null and totalContractId != ''">
- AND a.total_contract_id =#{totalContractId}
- </if>-->
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price like concat('%',#{contractPrice},'%')
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num like concat('%',#{contractNum},'%')
- </if>
- <!--<if test="isTotal != null and isTotal != ''">
- AND a.is_total = #{isTotal}
- </if>-->
- <choose>
- <when test="queryCon != null and queryCon != ''">
- AND (
- find_in_set(#{queryCon},a.create_bys)
- ${sqlMap.dsf}
- )
- </when>
- <otherwise>
- ${sqlMap.dsf}
- </otherwise>
- </choose>
- </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="findLists" resultType="WorkContractInfo" >
- SELECT
- a.id AS "id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.name",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path AS "contractNumPath",
- a.create_name AS "createName",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.charge_company_name AS "chargeCompanyName",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- a.contractFeeDoc AS "contractFeeDoc",
- a.contractTypeDoc AS "contractTypeDoc",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId",
- a.status AS "status",
- a.investment_scale AS "investmentScale",
- a.summary_payment AS "summaryPayment",
- a.investment_amount AS "investmentAmount",
- a.create_bys AS "createBys",
- a.alter_state AS "alterState",
- a.alter_sign AS "alterSign",
- a.record_state AS "recordState",
- a.alterbefore_id AS "alterBeforeId",
- a.completion_status AS "completionStatus",
- a.construction_project_type AS "constructionProjectType",
- (select name from work_contract_info where id = a.total_contract_id) AS "totalContractName",
- a.common_flag AS "commonFlag",
- (select count(1) from work_contract_info c where c.total_contract_id = a.id) cnt
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="client != null and client.id != null and client.id != ''">
- AND a.client_id = #{client.id}
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="totalContractIds != null and totalContractIds != ''">
- AND a.total_contract_ids LIKE
- <if test="dbName == 'oracle'">'%'||#{totalContractIds}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{totalContractIds}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{totalContractIds},'%')</if>
- </if>
- <!--<if test="totalContractId != null and totalContractId != ''">
- AND a.total_contract_id =#{totalContractId}
- </if>-->
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price like concat('%',#{contractPrice},'%')
- </if>
- <if test="contractState != null and contractState != ''">
- AND a.contract_state = #{contractState}
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num = #{contractNum}
- </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.contract_date DESC
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="WorkContractInfo" >
- SELECT
- <include refid="workContractInfoColumns"/>
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- <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 work_contract_info(
- id,
- project_id,
- project_name,
- ext,
- create_by,
- create_date,
- update_by,
- update_date,
- del_flag,
- remarks,
- client_id,
- contract_date,
- effective_date,
- closing_date,
- name,
- contract_category,
- contract_num,
- contract_price,
- contract_opposite,
- contract_type,
- contract_fee,
- contract_special,
- contract_state,
- office_id,
- contract_file_id,
- contract_role,
- apply_view,
- process_instance_id,
- create_name,
- create_company,
- company_id,
- contractFeeDoc,
- contractTypeDoc,
- charge_company_name,
- another_contract_num,
- is_total,
- total_contract_id,
- is_total_name,
- total_contract_ids,
- common_flag,
- status,
- investment_scale,
- summary_payment,
- investment_amount,
- construction_project_type,
- create_bys,
- alter_state,
- alter_sign,
- record_state,
- alterbefore_id,
- completion_status,
- sort,
- signature_status,
- contract_num_path
- ) VALUES (
- #{id},
- #{project.id},
- #{projectName},
- #{ext},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{delFlag},
- #{remarks},
- #{client.id},
- #{contractDate},
- #{effectiveDate},
- #{closingDate},
- #{name},
- #{contractCategory},
- #{contractNum},
- #{contractPrice},
- #{contractOpposite},
- #{contractType},
- #{contractFee},
- #{contractSpecial},
- #{contractState},
- #{chargeCompany},
- #{contractFileId},
- #{contractRole},
- #{applyView},
- #{processInstanceId},
- #{createName},
- #{createCompany},
- #{companyId},
- #{contractFeeDoc},
- #{contractTypeDoc},
- #{chargeCompanyName},
- #{anotherContractNum},
- #{isTotal},
- #{totalContractId},
- #{isTotalName},
- #{totalContractIds},
- #{commonFlag},
- #{status},
- #{investmentScale},
- #{summaryPayment},
- #{investmentAmount},
- #{constructionProjectType},
- #{createBys},
- #{alterState},
- #{alterSign},
- #{recordState},
- #{alterBeforeId},
- #{completionStatus},
- #{sort},
- #{signatureStatus},
- #{contractNumPath}
- )
- </insert>
-
- <update id="update">
- UPDATE work_contract_info SET
- update_by = #{updateBy.id},
- project_id = #{project.id},
- project_name = #{projectName},
- ext = #{ext},
- update_date = #{updateDate},
- remarks = #{remarks},
- client_id = #{client.id},
- contract_date = #{contractDate},
- effective_date = #{effectiveDate},
- closing_date = #{closingDate},
- name = #{name},
- contract_category = #{contractCategory},
- contract_num = #{contractNum},
- contract_price = #{contractPrice},
- contract_opposite = #{contractOpposite},
- contract_type = #{contractType},
- contract_fee = #{contractFee},
- contract_special = #{contractSpecial},
- contract_state = #{contractState},
- office_id = #{chargeCompany},
- contract_file_id = #{contractFileId},
- contract_role = #{contractRole},
- apply_view = #{applyView},
- process_instance_id = #{processInstanceId},
- company_id = #{companyId},
- contractFeeDoc = #{contractFeeDoc},
- contractTypeDoc = #{contractTypeDoc},
- charge_company_name = #{chargeCompanyName},
- another_contract_num = #{anotherContractNum},
- is_total = #{isTotal},
- total_contract_id = #{totalContractId},
- status = #{status},
- investment_scale = #{investmentScale},
- summary_payment = #{summaryPayment},
- investment_amount = #{investmentAmount},
- construction_project_type = #{constructionProjectType},
- create_bys = #{createBys},
- invalidate_process_instance_id = #{invalidateProcessInstanceId},
- alter_process_instance_id = #{alterProcessInstanceId},
- invalidate_status = #{invalidateStatus},
- invalidate_user = #{invalidateUserId},
- alter_state = #{alterState},
- alter_sign = #{alterSign},
- record_state = #{recordState},
- alterbefore_id = #{alterBeforeId},
- completion_status = #{completionStatus},
- sort = #{sort},
- signature_status=#{signatureStatus},
- contract_num_path=#{contractNumPath}
- WHERE id = #{id}
- </update>
- <update id="updateId">
- UPDATE work_contract_info SET
- id = #{beforeId}
- WHERE id = #{id}
- </update>
- <update id="updateBeforeId">
- UPDATE work_contract_info SET
- alterbefore_id = #{beforeId}
- WHERE id = #{id}
- </update>
- <!--物理删除-->
- <update id="delete">
- DELETE FROM work_contract_info
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE work_contract_info SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
- <insert id="inertContractManger">
- INSERT INTO work_contract_annex(
- id,
- create_by,
- create_date,
- update_by,
- remarks,
- contract_id,
- name,
- url
- )
- VALUES
- <foreach collection="list" item="item" index="index" separator="," >
- (#{item.id},#{item.createBy.id},#{item.createDate},#{item.updateBy.id},#{item.remarks},
- #{item.contractNoId},#{item.name},#{item.url})
- </foreach>
- </insert>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="WorkContractInfo" statementType="STATEMENT">
- select * FROM work_contract_info where ${propertyName} = '${value}'
- </select>
-
- <select id="findListByclient" resultType="WorkClientInfo">
- SELECT
- a.*
- FROM work_client_info a
- LEFT JOIN work_client_linkman b on a.id = b.client_id
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="companyId != null and companyId != ''">
- AND a.company_id = #{companyId}
- </if>
- <if test="workLinkName != null and workLinkName != ''">
- AND b.name like concat('%',#{workLinkName},'%')
- </if>
- <if test="name != null and name != ''">
- AND a.name like concat('%',#{name},'%')
- </if>
- GROUP BY a.id
- </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>
- <update id="updateInvalidateStatusAndUser">
- <!-- 不要判空,因为有需要置空 -->
- UPDATE work_contract_info SET
- invalidate_status = #{invalidateStatus},
- invalidate_user = #{invalidateUserId}
- WHERE id = #{id}
- </update>
- <!-- 更新作废流程id -->
- <update id="updateInvalidateProcessInstanceId">
- UPDATE work_contract_info SET
- invalidate_process_instance_id = #{invalidateProcessInstanceId}
- WHERE id = #{id}
- </update>
- <!-- 更新作废流程id -->
- <update id="saveContractPrice">
- UPDATE work_contract_info SET
- contract_price = #{contractPrice}
- WHERE id = #{id}
- </update>
- <update id="updatealterProcessInstanceId">
- UPDATE work_contract_info SET
- alter_process_instance_id = #{alterProcessInstanceId}
- WHERE id = #{id}
- </update>
- <!-- 根据合同作废流程ID获取合同信息 -->
- <select id="getByInvalidateProcessInstanceId" resultType="WorkContractInfo">
- SELECT
- <include refid="workContractInfoColumns"/>
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE a.invalidate_process_instance_id = #{invalidateProcessInstanceId}
- </select>
- <!-- 根据合同作废流程ID获取合同信息 -->
- <select id="getByalterProcessInstanceId" resultType="WorkContractInfo">
- SELECT
- <include refid="workContractInfoColumns"/>
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE a.alter_process_instance_id = #{alterProcessInstanceId}
- </select>
- <!--更新审批流程id-->
- <update id="updateProcessInstanceId">
- UPDATE work_contract_info SET
- process_instance_id = #{processInstanceId}
- WHERE id = #{id}
- </update>
- <!-- 获取流程ID -->
- <select id="getByProcessInstanceId" resultType="WorkContractInfo">
- SELECT
- <include refid="workContractInfoColumns"/>
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE a.process_instance_id = #{processInstanceId}
- </select>
- <select id="findWaitAndFinishList" parameterType="map" resultType="WorkContractInfo">
- SELECT
- a.id AS "id",
- (select name from sys_user user where user.id=a.create_by) AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.del_flag AS "delFlag",
- a.remarks AS "remarks",
- a.client_id AS "client.id",
- a.contract_date AS "contractDate",
- a.effective_date AS "effectiveDate",
- a.closing_date AS "closingDate",
- a.name AS "name",
- a.contract_num_path as "contractNumPath",
- a.contract_category AS "contractCategory",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_opposite AS "contractOpposite",
- a.contract_type AS "contractType",
- a.contract_fee AS "contractFee",
- a.contract_special AS "contractSpecial",
- a.contract_state AS "contractState",
- a.office_id AS "chargeCompany",
- a.contract_file_id AS "contractFileId",
- a.contract_role AS "contractRole",
- a.apply_view AS "applyView",
- a.process_instance_id AS "processInstanceId",
- a.company_id as companyId,
- client.name AS "client.name",
- a.contractTypeDoc,
- a.contractFeeDoc,
- a.charge_company_name AS "chargeCompanyName",
- a.another_contract_num AS "anotherContractNum",
- client.name AS "client.name",
- a.is_total AS "isTotal",
- a.total_contract_id AS "totalContractId"
- FROM work_contract_info a
- <include refid="workContractInfoJoins"/>
- WHERE
- process_instance_id in (${procInsIds})
- </select>
- <delete id="deleteFile">
- DELETE FROM work_contract_annex
- WHERE contract_id = #{id}
- </delete>
- <select id="findByList" resultType="WorkContractInfo">
- SELECT
- a.id,a.sort
- FROM work_contract_info a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND (
- a.total_contract_id = #{totalContractId} OR a.id= #{totalContractId})
- </where>
- ORDER BY a.sort DESC
- </select>
- <!--月计划管理选择已签未完成的合同-->
- <select id="findWorkContractInfoPage" resultType="WorkContractInfo">
- SELECT
- a.id AS "id",
- a.contract_date AS "contractDate",
- a.name AS "name",
- a.contract_num AS "contractNum",
- a.contract_price AS "contractPrice",
- a.contract_type AS "contractType",
- c.name AS "client.name",
- a.construction_project_type AS "constructionProjectType"
- FROM work_contract_info a
- left join work_client_info c on c.id=a.client_id
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="client != null and client.name != null and client.name != ''">
- AND c.name LIKE concat('%',#{client.name},'%')
- </if>
- <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
- AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="contractPrice != '' and contractPrice != null">
- AND a.contract_price like concat('%',#{contractPrice},'%')
- </if>
- <if test="contractNum != null and contractNum!= ''">
- AND a.contract_num like concat('%',#{contractNum},'%')
- </if>
- AND a.contract_state = '5'
- and a.office_id=#{officeId}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.contract_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="countByOffice" resultType="int">
- SELECT count(1) FROM work_contract_info a WHERE a.office_id = #{officeId} AND a.del_flag='0'
- </select>
- <update id="updateStatus">
- UPDATE work_contract_info SET
- contract_state = #{contractState}
- WHERE id = #{id}
- </update>
- </mapper>
|