Commit 10017a3d authored by huyuchen's avatar huyuchen

huych-商险到期提醒优化修改

parent 7f8d678b
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceWarnMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAlert">
......@@ -77,7 +77,7 @@
a.DIE_DISABLE_QUOTA,
a.DEPT_ID,
a.POLICY_NO,
if(a.POLICY_END >= curdate(),0,1) IS_OVERDUE,
IF( a.POLICY_END >= curdate(), 0, 1 ) IS_OVERDUE,
a.REMARK,
a.CREATE_BY,
a.DELETE_FLAG,
......@@ -89,10 +89,11 @@
a.CREATE_USER_DEPT_NAME
FROM
t_insurance_detail a
WHERE
a.id IN (
INNER JOIN (
SELECT
l.id
h.endTime,
max( l.POLICY_START ) POLICY_START,
l.EMP_IDCARD_NO
FROM
(
SELECT
......@@ -101,8 +102,10 @@
FROM
t_insurance_detail b
WHERE
b.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
b.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND curdate()
AND b.IS_EFFECT = 0
AND b.DELETE_FLAG = '0'
AND NOT EXISTS (
SELECT
1
......@@ -111,8 +114,11 @@
WHERE
ea.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND ea.IS_EFFECT = 0
AND ea.DELETE_FLAG = '0'
AND ea.POLICY_END >= date_add( curdate(), INTERVAL 1 MONTH )
AND ea.EMP_IDCARD_NO = b.EMP_IDCARD_NO
AND ea.INSURANCE_COMPANY_NAME = b.INSURANCE_COMPANY_NAME
AND ea.INSURANCE_TYPE_NAME = b.INSURANCE_TYPE_NAME
)
GROUP BY
b.EMP_IDCARD_NO,
......@@ -120,9 +126,20 @@
b.INSURANCE_TYPE_NAME
) h
INNER JOIN t_insurance_detail l ON h.EMP_IDCARD_NO = l.EMP_IDCARD_NO
AND l.DELETE_FLAG = '0'
AND h.endTime = l.POLICY_END
AND l.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND curdate()
WHERE
l.EXPIRE_IGNORE_FLAG = '1'
)
GROUP BY
l.EMP_IDCARD_NO,
l.INSURANCE_COMPANY_NAME,
l.INSURANCE_TYPE_NAME,
l.POLICY_END
) ll ON ll.EMP_IDCARD_NO = a.EMP_IDCARD_NO
AND ll.POLICY_START = a.POLICY_START
AND ll.endTime = a.POLICY_END
where a.DELETE_FLAG = '0'
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment