|
|
@@ -320,18 +320,27 @@
|
|
|
pc.cover_rule_id,
|
|
|
pc.approved,
|
|
|
pc.is_enabled,
|
|
|
- pc.is_valid,
|
|
|
pc.create_time,
|
|
|
pc.create_by,
|
|
|
pa.agreement_code,
|
|
|
pa.agreement_title,
|
|
|
pa.agreement_abbreviation,
|
|
|
pa.id as ptlAgreementId,
|
|
|
- pr.rule_description
|
|
|
+ pr.rule_description,
|
|
|
+ eic.name as company_name,
|
|
|
+ pa.docking_person,
|
|
|
+ pc.update_time,
|
|
|
+ CASE
|
|
|
+ WHEN NOW() >= pc.effective_time
|
|
|
+ AND (pc.failure_time IS NULL OR NOW() < pc.failure_time)
|
|
|
+ THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END AS is_valid
|
|
|
FROM
|
|
|
ptl_agreement_cost pc
|
|
|
LEFT JOIN ptl_agreement pa ON pa.id = pc.ptl_agreement_id and pa.is_delete = 0
|
|
|
LEFT JOIN ptl_agreement_undwrt_rules pr ON pr.id = pc.cover_rule_id AND pr.agreement_id = pc.ptl_agreement_id and pr.is_delete = 0
|
|
|
+ LEFT JOIN esm_ins_company eic on eic.id = pa.company_id
|
|
|
<where>
|
|
|
pc.is_delete = 0
|
|
|
<if test="costParam.agreement != null and costParam.agreement != ''">
|
|
|
@@ -356,7 +365,19 @@
|
|
|
AND pc.approved = #{costParam.auditStatus}
|
|
|
</if>
|
|
|
<if test="costParam.validState != null and costParam.validState != ''">
|
|
|
- AND pc.is_valid = #{costParam.validState}
|
|
|
+ <choose>
|
|
|
+ <!-- 有效 -->
|
|
|
+ <when test="costParam.validState == 0">
|
|
|
+ AND NOW() >= pc.effective_time
|
|
|
+ AND (pc.failure_time IS NULL OR NOW() < pc.failure_time)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <!-- 无效 -->
|
|
|
+ <when test="costParam.validState == 1">
|
|
|
+ AND ( (pc.failure_time IS NOT NULL AND NOW() >= pc.failure_time)
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
</if>
|
|
|
<if test="costParam.effectiveTime != null and costParam.effectiveTime.size() > 0">
|
|
|
AND pc.effective_time BETWEEN #{costParam.effectiveTime[0]} AND #{costParam.effectiveTime[1]}
|
|
|
@@ -367,6 +388,18 @@
|
|
|
<if test="costParam.createTimeArr != null and costParam.createTimeArr.size() > 0">
|
|
|
AND pc.create_time BETWEEN #{costParam.createTimeArr[0]} AND #{costParam.createTimeArr[1]}
|
|
|
</if>
|
|
|
+ <if test="costParam.companyId != null and costParam.companyId != ''">
|
|
|
+ AND pa.company_id = #{costParam.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="costParam.contactPerson != null and costParam.contactPerson != ''">
|
|
|
+ AND pa.docking_person = #{costParam.contactPerson}
|
|
|
+ </if>
|
|
|
+ <if test="costParam.isEnabled != null and costParam.isEnabled != ''">
|
|
|
+ AND pc.is_enabled = #{costParam.isEnabled}
|
|
|
+ </if>
|
|
|
+ <if test="costParam.updateTimeArr != null and costParam.updateTimeArr.size() > 0">
|
|
|
+ AND pc.update_time BETWEEN #{costParam.updateTimeArr[0]} AND #{costParam.updateTimeArr[1]}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
order by pc.create_time desc
|
|
|
</select>
|