|
@@ -77,8 +77,8 @@
|
77
|
77
|
</resultMap>
|
78
|
78
|
|
79
|
79
|
<sql id="selectCmcContractVo">
|
80
|
|
- select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name, p.project_number, p.project_name,
|
81
|
|
- p.project_source, c.party_a_id, pa.party_a_name, t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person,
|
|
80
|
+ select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name,
|
|
81
|
+ c.party_a_id, pa.party_a_name, t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person,
|
82
|
82
|
sum(cp.paid_amount) as paid_amount, case c.amount when 0 then 0 else round(sum(cp.paid_amount) / c.amount * 100, 2) end as paid_percentage,
|
83
|
83
|
sum(ci.invoice_amount) as invoice_amount, case c.amount when 0 then 0 else round(sum(ci.invoice_amount) / c.amount * 100, 2) end as invoice_percentage,
|
84
|
84
|
t.agent_phone as agent_phone, c.amount, c.deposit, c.contract_document, c.drafter, u.nick_name as draft_nick_name, c.draft_time, c.remark, c.sign_date, c.sign_remark, c.sign_scan,
|
|
@@ -88,8 +88,6 @@
|
88
|
88
|
left join sys_user as u2 on u2.user_id = c.gm_user_id
|
89
|
89
|
left join cmc_tender as t on t.tender_id = c.tender_id
|
90
|
90
|
left join cmc_party_a as pa on pa.party_a_id = c.party_a_id
|
91
|
|
- left join cmc_project_contract as pc on pc.contract_id = c.contract_id
|
92
|
|
- left join cmc_project as p on pc.project_id = p.project_id
|
93
|
91
|
left join cmc_contract_paid as cp on cp.contract_id = c.contract_id
|
94
|
92
|
left join cmc_contract_invoice as ci on ci.contract_id = c.contract_id
|
95
|
93
|
</sql>
|
|
@@ -120,21 +118,62 @@
|
120
|
118
|
order by c.draft_time desc
|
121
|
119
|
</select>
|
122
|
120
|
|
123
|
|
- <select id="selectCmcContractListFuzzy" parameterType="CmcContract" resultMap="CmcContractResult">
|
124
|
|
- select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name, p.project_number, p.project_name,
|
125
|
|
- p.project_source, c.party_a_id, pa.party_a_name, t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person,
|
|
121
|
+ <select id="selectCmcContractListP" parameterType="CmcContract" resultMap="CmcContractResult">
|
|
122
|
+ select distinct t1.contract_id, t1.contract_code, t1.contract_name, t1.contract_number, t1.tender_id, t1.t_project_name,t1.party_a_id, t1.party_a_name, t1.a_person,
|
|
123
|
+ t1.a_phone, t1.agent, t1.agent_person,t1.paid_amount, t1.paid_percentage, t1.invoice_amount, t1.invoice_percentage, p.project_number, p.project_name, p.project_source,
|
|
124
|
+ t1.agent_phone, t1.amount, t1.deposit, t1.contract_document, t1.drafter, t1.draft_nick_name, t1.draft_time, t1.remark, t1.sign_date, t1.sign_remark, t1.sign_scan,
|
|
125
|
+ t1.comment_type, t1.manager_comment, t1.manager_user_id, t1.manager_nick_name, t1.manager_time, t1.gm_user_id, t1.gm_nick_name, t1.gm_time, t1.gm_comment from
|
|
126
|
+ (select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name,c.party_a_id, pa.party_a_name,
|
|
127
|
+ t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person, t.agent_phone as agent_phone,
|
126
|
128
|
sum(cp.paid_amount) as paid_amount, case c.amount when 0 then 0 else round(sum(cp.paid_amount) / c.amount * 100, 2) end as paid_percentage,
|
127
|
129
|
sum(ci.invoice_amount) as invoice_amount, case c.amount when 0 then 0 else round(sum(ci.invoice_amount) / c.amount * 100, 2) end as invoice_percentage,
|
128
|
|
- t.agent_phone as agent_phone, c.amount, c.deposit, c.contract_document, c.drafter, u.nick_name as draft_nick_name, c.draft_time, c.remark, c.sign_date, c.sign_remark, c.sign_scan,
|
|
130
|
+ c.amount, c.deposit, c.contract_document, c.drafter, u.nick_name as draft_nick_name, c.draft_time, c.remark, c.sign_date, c.sign_remark, c.sign_scan,
|
129
|
131
|
c.comment_type, c.manager_comment, c.manager_user_id, u1.nick_name as manager_nick_name, c.manager_time, c.gm_user_id, u2.nick_name as gm_nick_name, c.gm_time, c.gm_comment from cmc_contract as c
|
130
|
132
|
left join sys_user as u on u.user_id = c.drafter
|
131
|
133
|
left join sys_user as u1 on u1.user_id = c.manager_user_id
|
132
|
134
|
left join sys_user as u2 on u2.user_id = c.gm_user_id
|
133
|
135
|
left join cmc_tender as t on t.tender_id = c.tender_id
|
134
|
136
|
left join cmc_party_a as pa on pa.party_a_id = c.party_a_id
|
135
|
|
- left join cmc_project_contract as pc on pc.contract_id = c.contract_id
|
136
|
|
- left join cmc_project as p on pc.project_id = p.project_id
|
137
|
137
|
left join cmc_contract_paid as cp on cp.contract_id = c.contract_id
|
|
138
|
+ left join cmc_contract_invoice as ci on ci.contract_id = c.contract_id
|
|
139
|
+ group by c.contract_id)
|
|
140
|
+ as t1
|
|
141
|
+ left join cmc_project_contract as pc on pc.contract_id = t1.contract_id
|
|
142
|
+ left join cmc_project as p on pc.project_id = p.project_id
|
|
143
|
+ <where>
|
|
144
|
+ <if test="contractId != null and contractId != ''"> and c.contract_id like concat('%', #{contractId}, '%')</if>
|
|
145
|
+ <if test="contractName!= null and contractName != ''"> and c.contract_name like concat('%', #{contractName}, '%')</if>
|
|
146
|
+ <if test="contractCode!= null and contractCode != ''"> and c.contract_code like concat('%', #{contractCode}, '%')</if>
|
|
147
|
+ <if test="tenderId != null and tenderId != ''"> and c.tender_id = #{tenderId}</if>
|
|
148
|
+ <if test="contractNumber != null and contractNumber != ''"> and c.contract_number = #{contractNumber}</if>
|
|
149
|
+ <if test="partyAId != null and partyAId != ''"> and c.party_a_id = #{partyAId}</if>
|
|
150
|
+ <if test="amount != null "> and c.amount = #{amount}</if>
|
|
151
|
+ <if test="deposit != null "> and c.deposit = #{deposit}</if>
|
|
152
|
+ <if test="contractDocument != null and contractDocument != ''"> and c.contract_document = #{contractDocument}</if>
|
|
153
|
+ <if test="drafter != null "> and c.drafter = #{drafter}</if>
|
|
154
|
+ <if test="draftTime != null "> and c.draft_time = #{draftTime}</if>
|
|
155
|
+ <if test="signDate != null "> and YEAR(c.sign_date) = YEAR(#{signDate})</if>
|
|
156
|
+ <if test="signRemark != null and signRemark != ''"> and c.sign_remark = #{signRemark}</if>
|
|
157
|
+ <if test="signScan != null and signScan != ''"> and c.sign_scan = #{signScan}</if>
|
|
158
|
+ <if test="commentType != null and commentType != ''"> and c.comment_type = #{commentType}</if>
|
|
159
|
+ <if test="projectSource != null and projectSource != ''"> and p.project_source = #{projectSource}</if>
|
|
160
|
+ <if test="projectName != null and projectName != ''"> and p.project_name like concat('%', #{projectName}, '%')</if>
|
|
161
|
+ <if test="partyAName != null and partyAName != ''"> and pa.party_a_name like concat('%', #{partyAName}, '%')</if>
|
|
162
|
+ </where>
|
|
163
|
+ group by t1.contract_id
|
|
164
|
+ order by t1.draft_time desc
|
|
165
|
+ </select>
|
|
166
|
+
|
|
167
|
+ <select id="selectCmcContractListFuzzy" parameterType="CmcContract" resultMap="CmcContractResult">
|
|
168
|
+ select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name,
|
|
169
|
+ c.party_a_id, pa.party_a_name, t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person,
|
|
170
|
+ t.agent_phone as agent_phone, c.amount, c.deposit, c.contract_document, c.drafter, u.nick_name as draft_nick_name, c.draft_time, c.remark, c.sign_date, c.sign_remark, c.sign_scan,
|
|
171
|
+ c.comment_type, c.manager_comment, c.manager_user_id, u1.nick_name as manager_nick_name, c.manager_time, c.gm_user_id, u2.nick_name as gm_nick_name, c.gm_time, c.gm_comment from cmc_contract as c
|
|
172
|
+ left join sys_user as u on u.user_id = c.drafter
|
|
173
|
+ left join sys_user as u1 on u1.user_id = c.manager_user_id
|
|
174
|
+ left join sys_user as u2 on u2.user_id = c.gm_user_id
|
|
175
|
+ left join cmc_tender as t on t.tender_id = c.tender_id
|
|
176
|
+ left join cmc_party_a as pa on pa.party_a_id = c.party_a_id
|
138
|
177
|
left join cmc_contract_work as cw on cw.contract_id = c.contract_id
|
139
|
178
|
<where>
|
140
|
179
|
cw.content like concat('%', #{queryString}, '%')
|
|
@@ -162,7 +201,21 @@
|
162
|
201
|
</select>
|
163
|
202
|
|
164
|
203
|
<select id="selectCmcContractListByRange" parameterType="CmcContract" resultMap="CmcContractResult">
|
165
|
|
- <include refid="selectCmcContractVo"/>
|
|
204
|
+ select distinct c.contract_id, c.contract_code, c.contract_name, c.contract_number, c.tender_id, t.project_name as t_project_name, p.project_number, p.project_name,
|
|
205
|
+ p.project_source, c.party_a_id, pa.party_a_name, t.a_person as a_person, t.a_phone as a_phone, t.agent as agent, t.agent_person as agent_person,
|
|
206
|
+ sum(cp.paid_amount) as paid_amount, case c.amount when 0 then 0 else round(sum(cp.paid_amount) / c.amount * 100, 2) end as paid_percentage,
|
|
207
|
+ sum(ci.invoice_amount) as invoice_amount, case c.amount when 0 then 0 else round(sum(ci.invoice_amount) / c.amount * 100, 2) end as invoice_percentage,
|
|
208
|
+ t.agent_phone as agent_phone, c.amount, c.deposit, c.contract_document, c.drafter, u.nick_name as draft_nick_name, c.draft_time, c.remark, c.sign_date, c.sign_remark, c.sign_scan,
|
|
209
|
+ c.comment_type, c.manager_comment, c.manager_user_id, u1.nick_name as manager_nick_name, c.manager_time, c.gm_user_id, u2.nick_name as gm_nick_name, c.gm_time, c.gm_comment from cmc_contract as c
|
|
210
|
+ left join sys_user as u on u.user_id = c.drafter
|
|
211
|
+ left join sys_user as u1 on u1.user_id = c.manager_user_id
|
|
212
|
+ left join sys_user as u2 on u2.user_id = c.gm_user_id
|
|
213
|
+ left join cmc_tender as t on t.tender_id = c.tender_id
|
|
214
|
+ left join cmc_party_a as pa on pa.party_a_id = c.party_a_id
|
|
215
|
+ left join cmc_project_contract as pc on pc.contract_id = c.contract_id
|
|
216
|
+ left join cmc_project as p on pc.project_id = p.project_id
|
|
217
|
+ left join cmc_contract_paid as cp on cp.contract_id = c.contract_id
|
|
218
|
+ left join cmc_contract_invoice as ci on ci.contract_id = c.contract_id
|
166
|
219
|
<where>
|
167
|
220
|
<if test="contractId != null and contractId != ''"> and c.contract_id like concat('%', #{contractId}, '%')</if>
|
168
|
221
|
<if test="contractName!= null and contractName != ''"> and c.contract_name like concat('%', #{contractName}, '%')</if>
|