|
@@ -67,14 +67,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
67
|
67
|
select distinct sc.sub_contract_id, sc.sub_contract_name, sc.sub_amount, sc.partner_id, pa.partner_name, sc.contact_person, sc.telephone, sc.contract_document, sc.drafter,
|
68
|
68
|
sum(cp.paid_amount) as paid_amount, case sc.sub_amount when 0 then 0 else round(sum(cp.paid_amount) / sc.sub_amount * 100, 2) end as paid_percentage,
|
69
|
69
|
sum(ci.invoice_amount) as invoice_amount, case sc.sub_amount when 0 then 0 else round(sum(ci.invoice_amount) / sc.sub_amount * 100, 2) end as invoice_percentage,
|
70
|
|
- p.project_number, p.project_name, p.project_source,u.nick_name as draft_nick_name, sc.draft_time, sc.remark, sc.sign_date, sc.sign_remark, sc.sign_scan, sc.comment_type, sc.manager_comment,
|
|
70
|
+ u.nick_name as draft_nick_name, sc.draft_time, sc.remark, sc.sign_date, sc.sign_remark, sc.sign_scan, sc.comment_type, sc.manager_comment,
|
71
|
71
|
sc.manager_user_id, u1.nick_name as manager_nick_name, sc.manager_time, sc.gm_user_id, u2.nick_name as gm_nick_name, sc.gm_time, sc.gm_comment from cmc_sub_contract as sc
|
72
|
72
|
left join sys_user as u on u.user_id = sc.drafter
|
73
|
73
|
left join sys_user as u1 on u1.user_id = sc.manager_user_id
|
74
|
74
|
left join sys_user as u2 on u2.user_id = sc.gm_user_id
|
75
|
75
|
left join cmc_partner as pa on pa.partner_id = sc.partner_id
|
76
|
|
- left join cmc_project_sub_contract as psc on psc.sub_contract_id = sc.sub_contract_id
|
77
|
|
- left join cmc_project as p on psc.project_id = p.project_id
|
78
|
76
|
left join cmc_contract_paid as cp on cp.contract_id = sc.sub_contract_id
|
79
|
77
|
left join cmc_contract_invoice as ci on ci.contract_id = sc.sub_contract_id
|
80
|
78
|
</sql>
|
|
@@ -94,37 +92,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
94
|
92
|
<if test="signRemark != null and signRemark != ''"> and sc.sign_remark = #{signRemark}</if>
|
95
|
93
|
<if test="signScan != null and signScan != ''"> and sc.sign_scan = #{signScan}</if>
|
96
|
94
|
<if test="commentType != null and commentType != ''"> and sc.comment_type = #{commentType}</if>
|
97
|
|
- <if test="projectSource != null and projectSource != ''"> and p.project_source = #{projectSource}</if>
|
98
|
95
|
</where>
|
99
|
96
|
group by sc.sub_contract_id
|
100
|
97
|
order by sc.draft_time desc
|
101
|
98
|
</select>
|
102
|
99
|
|
|
100
|
+ <select id="selectCmcSubContractListP" parameterType="CmcSubContract" resultMap="CmcSubContractResult">
|
|
101
|
+ select distinct t1.sub_contract_id, t1.sub_contract_name, t1.sub_amount, t1.partner_id, t1.partner_name, t1.contact_person, t1.telephone, t1.contract_document, t1.drafter,
|
|
102
|
+ t1.paid_amount, t1.paid_percentage, t1.invoice_amount, t1.invoice_percentage, t1.draft_nick_name, t1.draft_time, t1.remark, t1.sign_date, t1.sign_remark, t1.sign_scan,
|
|
103
|
+ 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, p.project_number, p.project_name, p.project_source from
|
|
104
|
+ (select distinct sc.sub_contract_id, sc.sub_contract_name, sc.sub_amount, sc.partner_id, pa.partner_name, sc.contact_person, sc.telephone, sc.contract_document, sc.drafter,
|
|
105
|
+ sum(cp.paid_amount) as paid_amount, case sc.sub_amount when 0 then 0 else round(sum(cp.paid_amount) / sc.sub_amount * 100, 2) end as paid_percentage,
|
|
106
|
+ sum(ci.invoice_amount) as invoice_amount, case sc.sub_amount when 0 then 0 else round(sum(ci.invoice_amount) / sc.sub_amount * 100, 2) end as invoice_percentage,
|
|
107
|
+ u.nick_name as draft_nick_name, sc.draft_time, sc.remark, sc.sign_date, sc.sign_remark, sc.sign_scan, sc.comment_type, sc.manager_comment,
|
|
108
|
+ sc.manager_user_id, u1.nick_name as manager_nick_name, sc.manager_time, sc.gm_user_id, u2.nick_name as gm_nick_name, sc.gm_time, sc.gm_comment from cmc_sub_contract as sc
|
|
109
|
+ left join sys_user as u on u.user_id = sc.drafter
|
|
110
|
+ left join sys_user as u1 on u1.user_id = sc.manager_user_id
|
|
111
|
+ left join sys_user as u2 on u2.user_id = sc.gm_user_id
|
|
112
|
+ left join cmc_partner as pa on pa.partner_id = sc.partner_id
|
|
113
|
+ left join cmc_contract_paid as cp on cp.contract_id = sc.sub_contract_id
|
|
114
|
+ left join cmc_contract_invoice as ci on ci.contract_id = sc.sub_contract_id
|
|
115
|
+ group by sc.sub_contract_id)
|
|
116
|
+ as t1
|
|
117
|
+ left join cmc_project_sub_contract as psc on psc.sub_contract_id = t1.sub_contract_id
|
|
118
|
+ left join cmc_project as p on psc.project_id = p.project_id
|
|
119
|
+ <where>
|
|
120
|
+ <if test="subContractName != null and subContractName != ''"> and t1.sub_contract_name like concat('%', #{subContractName}, '%')</if>
|
|
121
|
+ <if test="subAmount != null "> and t1.sub_amount = #{subAmount}</if>
|
|
122
|
+ <if test="partnerId != null and partnerId != ''"> and t1.partner_id = #{partnerId}</if>
|
|
123
|
+ <if test="contactPerson != null and contactPerson != ''"> and t1.contact_person = #{contactPerson}</if>
|
|
124
|
+ <if test="telephone != null and telephone != ''"> and t1.telephone = #{telephone}</if>
|
|
125
|
+ <if test="contractDocument != null and contractDocument != ''"> and t1.contract_document = #{contractDocument}</if>
|
|
126
|
+ <if test="drafter != null "> and t1.drafter = #{drafter}</if>
|
|
127
|
+ <if test="draftTime != null "> and t1.draft_time = #{draftTime}</if>
|
|
128
|
+ <if test="signDate != null "> and YEAR(t1.sign_date) = YEAR(#{signDate})</if>
|
|
129
|
+ <if test="signRemark != null and signRemark != ''"> and t1.sign_remark = #{signRemark}</if>
|
|
130
|
+ <if test="signScan != null and signScan != ''"> and t1.sign_scan = #{signScan}</if>
|
|
131
|
+ <if test="commentType != null and commentType != ''"> and t1.comment_type = #{commentType}</if>
|
|
132
|
+ <if test="projectSource != null and projectSource != ''"> and p.project_source = #{projectSource}</if>
|
|
133
|
+ </where>
|
|
134
|
+ group by t1.sub_contract_id
|
|
135
|
+ order by t1.draft_time desc
|
|
136
|
+ </select>
|
|
137
|
+
|
103
|
138
|
<select id="selectCmcSubContractListByRange" parameterType="CmcSubContract" resultMap="CmcSubContractResult">
|
104
|
|
- <include refid="selectCmcSubContractVo"/>
|
|
139
|
+ select distinct t1.sub_contract_id, t1.sub_contract_name, t1.sub_amount, t1.partner_id, t1.partner_name, t1.contact_person, t1.telephone, t1.contract_document, t1.drafter,
|
|
140
|
+ t1.paid_amount, t1.paid_percentage, t1.invoice_amount, t1.invoice_percentage, t1.draft_nick_name, t1.draft_time, t1.remark, t1.sign_date, t1.sign_remark, t1.sign_scan,
|
|
141
|
+ 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, p.project_number, p.project_name, p.project_source from
|
|
142
|
+ (select distinct sc.sub_contract_id, sc.sub_contract_name, sc.sub_amount, sc.partner_id, pa.partner_name, sc.contact_person, sc.telephone, sc.contract_document, sc.drafter,
|
|
143
|
+ sum(cp.paid_amount) as paid_amount, case sc.sub_amount when 0 then 0 else round(sum(cp.paid_amount) / sc.sub_amount * 100, 2) end as paid_percentage,
|
|
144
|
+ sum(ci.invoice_amount) as invoice_amount, case sc.sub_amount when 0 then 0 else round(sum(ci.invoice_amount) / sc.sub_amount * 100, 2) end as invoice_percentage,
|
|
145
|
+ u.nick_name as draft_nick_name, sc.draft_time, sc.remark, sc.sign_date, sc.sign_remark, sc.sign_scan, sc.comment_type, sc.manager_comment,
|
|
146
|
+ sc.manager_user_id, u1.nick_name as manager_nick_name, sc.manager_time, sc.gm_user_id, u2.nick_name as gm_nick_name, sc.gm_time, sc.gm_comment from cmc_sub_contract as sc
|
|
147
|
+ left join sys_user as u on u.user_id = sc.drafter
|
|
148
|
+ left join sys_user as u1 on u1.user_id = sc.manager_user_id
|
|
149
|
+ left join sys_user as u2 on u2.user_id = sc.gm_user_id
|
|
150
|
+ left join cmc_partner as pa on pa.partner_id = sc.partner_id
|
|
151
|
+ left join cmc_contract_paid as cp on cp.contract_id = sc.sub_contract_id
|
|
152
|
+ left join cmc_contract_invoice as ci on ci.contract_id = sc.sub_contract_id
|
|
153
|
+ group by sc.sub_contract_id)
|
|
154
|
+ as t1
|
|
155
|
+ left join cmc_project_sub_contract as psc on psc.sub_contract_id = t1.sub_contract_id
|
|
156
|
+ left join cmc_project as p on psc.project_id = p.project_id
|
105
|
157
|
<where>
|
106
|
|
- <if test="subContractName != null and subContractName != ''"> and sc.sub_contract_name like concat('%', #{subContractName}, '%')</if>
|
107
|
|
- <if test="subAmount != null "> and sc.sub_amount = #{subAmount}</if>
|
108
|
|
- <if test="partnerId != null and partnerId != ''"> and sc.partner_id = #{partnerId}</if>
|
109
|
|
- <if test="contactPerson != null and contactPerson != ''"> and sc.contact_person = #{contactPerson}</if>
|
110
|
|
- <if test="telephone != null and telephone != ''"> and sc.telephone = #{telephone}</if>
|
111
|
|
- <if test="contractDocument != null and contractDocument != ''"> and sc.contract_document = #{contractDocument}</if>
|
112
|
|
- <if test="drafter != null "> and sc.drafter = #{drafter}</if>
|
113
|
|
- <if test="draftTime != null "> and sc.draft_time = #{draftTime}</if>
|
114
|
|
- <if test="signDate != null "> and YEAR(sc.sign_date) = YEAR(#{signDate})</if>
|
115
|
|
- <if test="signRemark != null and signRemark != ''"> and sc.sign_remark = #{signRemark}</if>
|
116
|
|
- <if test="signScan != null and signScan != ''"> and sc.sign_scan = #{signScan}</if>
|
117
|
|
- <if test="commentType != null and commentType != ''"> and sc.comment_type = #{commentType}</if>
|
|
158
|
+ <if test="subContractName != null and subContractName != ''"> and t1.sub_contract_name like concat('%', #{subContractName}, '%')</if>
|
|
159
|
+ <if test="subAmount != null "> and t1.sub_amount = #{subAmount}</if>
|
|
160
|
+ <if test="partnerId != null and partnerId != ''"> and t1.partner_id = #{partnerId}</if>
|
|
161
|
+ <if test="contactPerson != null and contactPerson != ''"> and t1.contact_person = #{contactPerson}</if>
|
|
162
|
+ <if test="telephone != null and telephone != ''"> and t1.telephone = #{telephone}</if>
|
|
163
|
+ <if test="contractDocument != null and contractDocument != ''"> and t1.contract_document = #{contractDocument}</if>
|
|
164
|
+ <if test="drafter != null "> and t1.drafter = #{drafter}</if>
|
|
165
|
+ <if test="draftTime != null "> and t1.draft_time = #{draftTime}</if>
|
|
166
|
+ <if test="signDate != null "> and YEAR(t1.sign_date) = YEAR(#{signDate})</if>
|
|
167
|
+ <if test="signRemark != null and signRemark != ''"> and t1.sign_remark = #{signRemark}</if>
|
|
168
|
+ <if test="signScan != null and signScan != ''"> and t1.sign_scan = #{signScan}</if>
|
|
169
|
+ <if test="commentType != null and commentType != ''"> and t1.comment_type = #{commentType}</if>
|
118
|
170
|
<if test="projectSource != null and projectSource != ''"> and p.project_source = #{projectSource}</if>
|
119
|
171
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
120
|
|
- and date_format(sc.sign_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
172
|
+ and date_format(t1.sign_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
121
|
173
|
</if>
|
122
|
174
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
123
|
|
- and date_format(sc.sign_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
175
|
+ and date_format(t1.sign_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
124
|
176
|
</if>
|
125
|
177
|
</where>
|
126
|
|
- group by sc.sub_contract_id
|
127
|
|
- order by sc.draft_time desc
|
|
178
|
+ group by t1.sub_contract_id
|
|
179
|
+ order by t1.draft_time desc
|
128
|
180
|
</select>
|
129
|
181
|
|
130
|
182
|
<select id="selectCmcSubContractBySubContractId" parameterType="String" resultMap="CmcSubContractResult">
|