123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <?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.fuzamei.mapperInterface.ContractManagementMapper">
- <!-- 根据条件查询所有符合条件的合同状态跟踪(contract_status_tracking)信息 -->
- <select id="queryContractStatusTracking" resultType="com.fuzamei.entity.ContractStatusTracking">
- select
- sct.id,
- sct.business_id,
- sct.contract_id,
- att.attachment_name as contract_name,
- att.url as url,
- sct.contract_party,
- sct.update_time,
- sct.status_id,
- s.status_name
- from
- contract_status_tracking sct
- left join
- status s
- on
- sct.status_id=s.status_id
- left join
- attachment att
- on
- sct.contract_id=att.attachment_id
- <where>
- <if test="businessId!=null">
- sct.business_id=#{businessId}
- </if>
- <if test="contractParty!='' and contractParty!=null">
- and sct.contract_party=#{contractParty}
- </if>
- <if test="startTime!=null and endTime!=null">
- and sct.update_time between #{startTime} and #{endTime}
- </if>
- </where>
- order by
- sct.update_time desc
- limit
- #{startPage},#{rowNum}
- </select>
-
- <!-- 根据条件查询所有符合条件的合同状态跟踪信息(contract_status_tracking)条数 -->
- <select id="findAllContractStatusTrackingInformation" resultType="int">
- select
- count(*)
- from
- contract_status_tracking
- <where>
- <if test="businessId!=null">
- business_id=#{businessId}
- </if>
- <if test="contractParty!='' and contractParty!=null">
- and contract_party=#{contractParty}
- </if>
- <if test="startTime!=null and endTime!=null">
- and update_time between #{startTime} and #{endTime}
- </if>
- </where>
- </select>
-
- <!-- 根据条件查询所有符合条件的合同记录表(contract_record)表信息 -->
- <select id="queryContractRecord" resultType="com.fuzamei.entity.ContractRecord">
- select
- cr.id,
- cr.business_id,
- cr.contract_id,
- cr.contract_name,
- cr.version,
- cr.contract_party,
- cr.upload_department,
- cr.upload_person,
- cr.modify_opinion,
- cr.unconfirm_department,
- s.status_name,
- cr.status_id,
- cr.commit_time,
- cr.hash
- from
- contract_record cr
- left join
- status s
- on
- s.status_id=cr.status_id
- where
- cr.business_id=#{businessId}
- order by
- cr.commit_time desc
- limit
- #{startPage},#{rowNum}
- </select>
-
- <!-- 根据条件查询所有符合条件的合同记录表(contract_record)信息条数 -->
- <select id="findAllContractRecordInformation" resultType="int">
- select
- count(*)
- from
- contract_record
- where
- business_id=#{businessId}
- </select>
-
- <!-- 根据业务id查询ContractStatusTracking的详细信息 -->
- <select id="getContractStatusTrackingByBusinessId" resultType="com.fuzamei.entity.ContractStatusTracking">
- select
- sct.id,
- sct.business_id,
- sct.contract_id,
- att.attachment_name as contract_name,
- att.url as url,
- sct.contract_party,
- sct.update_time,
- sct.status_id,
- s.status_name
- from
- contract_status_tracking sct
- left join
- status s
- on
- sct.status_id=s.status_id
- left join
- attachment att
- on
- sct.contract_id=att.attachment_id
- where
- sct.business_id=#{businessId}
- </select>
-
- <!-- 将数据插入附件表中 -->
- <insert id="insertInformationToAttachment">
- insert into
- attachment(attachment_id,
- attachment_name,
- url,
- upload_person_id,
- create_time)
- values(#{attachmentId},
- #{attachmentName},
- #{url},
- #{userId},
- #{createTime})
- </insert>
-
- <!-- 将信息插入到操作记录表中 -->
- <insert id="insertInformationToOperationHistory">
- insert into
- operation_history(operator_type_id,
- operator_account,
- operator_role,
- operator_person,
- operator_time,
- hash)
- values(#{operatorTypeId},
- #{operatorAccount},
- #{operatorRole},
- #{operatorPerson},
- #{operatorTime},
- #{hash})
- </insert>
-
- <!-- 根据业务id号获取最新的合同记录表中的一条信息 -->
- <select id="getLatestContractRecordByBusinessId" resultType="com.fuzamei.entity.ContractRecord">
- select
- cr.id,
- cr.business_id,
- cr.contract_id,
- cr.contract_name,
- cr.version,
- cr.contract_party,
- cr.upload_department,
- cr.upload_person,
- cr.modify_opinion,
- cr.unconfirm_department,
- s.status_name,
- cr.status_id,
- cr.commit_time,
- cr.hash
- from
- contract_record cr
- left join
- status s
- on
- s.status_id=cr.status_id
- where
- cr.business_id=#{businessId}
- order by
- cr.version desc
- limit 1
- </select>
-
- <!-- 将合同记录信息插入到合同记录表中 -->
- <insert id="insertInformationToContractRecord">
- insert into
- contract_record(business_id,
- contract_id,
- contract_name,
- version,
- contract_party,
- upload_department,
- upload_person,
- modify_opinion,
- unconfirm_department,
- status_id,
- commit_time,
- hash)
- values(#{businessId},
- #{contractId},
- #{contractName},
- #{version},
- #{contractParty},
- #{uploadDepartment},
- #{uploadPerson},
- #{modifyOpinion},
- #{uncomfirmDepartment},
- #{statusId}
- #{commitTime},
- #{hash})
- </insert>
-
- <!-- 对合同状态跟踪表中的更新时间和合同id号进行修改 -->
- <update id="updateContractStatusTracking">
- update
- contract_status_tracking
- set
- contract_id=#{contractId},
- update_time=#{updateTime}
- where
- business_id=#{businessId}
- </update>
-
- <!-- 根据业务id和版本号获取当前的一条合同记录详细信息 -->
- <select id="getCurrentContractRecordByBusinessId" resultType="com.fuzamei.entity.ContractRecord">
- select
- cr.id,
- cr.business_id,
- cr.contract_id,
- cr.contract_name,
- cr.version,
- cr.contract_party,
- cr.upload_department,
- cr.upload_person,
- cr.modify_opinion,
- cr.unconfirm_department,
- s.status_name,
- cr.status_id,
- cr.commit_time,
- cr.hash
- from
- contract_record cr
- left join
- status s
- on
- s.status_id=cr.status_id
- where
- cr.business_id=#{businessId}
- and cr.version=#{version}
- </select>
-
- <!-- 更新合同记录表的信息 -->
- <update id="updateContractRecord">
- update
- contract_record
- set
- commit_time=#{commitTime},
- unconfirm_department=#{unconfirmed},
- status_id=#{statusId}
- where
- business_id=#{businessId}
- and version=#{version}
- </update>
-
- <!-- 在指定业务id下将除了目标version以外的所有信息全部置为作废 -->
- <update id="updateOtherContractRecord">
- update
- contract_record
- set
- status_id=#{statusId},
- commit_time=#{commitTime}
- where
- business_id=#{businessId}
- and version not in(#{version})
- </update>
-
- <!-- 当整个合同被确认以后,更新合同状态跟踪表中的状态,时间和合同id号 -->
- <update id="updateContractStatusTrackingStatusAndContractId">
- update
- contract_status_tracking
- set
- contract_id=#{contractId},
- update_time=#{updateTime},
- status_id=#{statusId}
- where
- business_id=#{businessId}
- </update>
- </mapper>
|