| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- <!–统计上个月和这个月交社保的人数以及缴纳金额–>--> |
| | | <!-- <select id="selectTo" resultType="java.util.HashMap">--> |
| | | <!-- SELECT IFNULL(A.lastmonth, 0) AS lastmonth,--> |
| | | <!-- IFNULL(B.thismouth, 0) AS thismouth,--> |
| | | <!-- IFNULL(A.amount, 0) AS lastamount,--> |
| | | <!-- IFNULL(B.amount, 0) AS thisamount,--> |
| | | <!-- IFNULL( C.userthismouth, 0 ) AS userthismouth,--> |
| | | <!-- IFNULL( D.userlastmouth, 0 ) AS userlastmouth,--> |
| | | <!-- IFNULL( E.userpcthismouth, 0 ) AS userpcthismouth,--> |
| | | <!-- IFNULL( F.userpclastmouth, 0 ) AS userpclastmouth--> |
| | | <!-- FROM (--> |
| | | <!-- SELECT COUNT(*) AS lastmonth,--> |
| | | <!-- amount,--> |
| | | <!-- deptid--> |
| | | <!-- FROM--> |
| | | <!-- sys_socil--> |
| | | <!-- WHERE--> |
| | | <!-- deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY i.departmentid )--> |
| | | <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( insuredtime, '%Y%m' ) ) = 1--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and deptid =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- amount,--> |
| | | <!-- deptid--> |
| | | <!-- ) A--> |
| | | <!-- left JOIN (--> |
| | | <!-- SELECT COUNT(*) AS thismouth,--> |
| | | <!-- amount,--> |
| | | <!-- deptid--> |
| | | <!-- FROM--> |
| | | <!-- sys_socil--> |
| | | <!-- WHERE--> |
| | | <!-- deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY i.departmentid )--> |
| | | <!-- AND DATE_FORMAT( insuredtime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and deptid =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- amount,--> |
| | | <!-- deptid--> |
| | | <!-- ) B ON A.deptid = B.deptid--> |
| | | <!-- LEFT JOIN (--> |
| | | <!-- SELECT COUNT(*) AS userthismouth,--> |
| | | <!-- dept_id--> |
| | | <!-- FROM--> |
| | | <!-- blade_user--> |
| | | <!-- WHERE--> |
| | | <!-- dept_id IN (--> |
| | | <!-- SELECT--> |
| | | <!-- i.departmentid--> |
| | | <!-- FROM--> |
| | | <!-- sys_information i--> |
| | | <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- i.departmentid--> |
| | | <!-- )--> |
| | | <!-- AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND status=1--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and dept_id =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- dept_id--> |
| | | <!-- ) C ON C.dept_id = A.deptid--> |
| | | <!-- LEFT JOIN(--> |
| | | <!-- SELECT COUNT(*) AS userlastmouth,--> |
| | | <!-- dept_id--> |
| | | <!-- FROM--> |
| | | <!-- blade_user--> |
| | | <!-- WHERE--> |
| | | <!-- dept_id IN (--> |
| | | <!-- SELECT--> |
| | | <!-- i.departmentid--> |
| | | <!-- FROM--> |
| | | <!-- sys_information i--> |
| | | <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- i.departmentid--> |
| | | <!-- )--> |
| | | <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND status=1--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and dept_id =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- dept_id--> |
| | | <!-- ) D ON D.dept_id = A.deptid--> |
| | | <!-- LEFT JOIN (--> |
| | | <!-- SELECT COUNT(*) AS userpcthismouth,--> |
| | | <!-- dept_id--> |
| | | <!-- FROM--> |
| | | <!-- blade_user--> |
| | | <!-- WHERE--> |
| | | <!-- dept_id IN (--> |
| | | <!-- SELECT--> |
| | | <!-- i.departmentid--> |
| | | <!-- FROM--> |
| | | <!-- sys_information i--> |
| | | <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- i.departmentid--> |
| | | <!-- )--> |
| | | <!-- AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND dispatch=0--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and dept_id =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- dept_id--> |
| | | <!-- ) E ON E.dept_id = A.deptid--> |
| | | <!-- LEFT JOIN(--> |
| | | <!-- SELECT COUNT(*) AS userpclastmouth,dept_id--> |
| | | <!-- FROM--> |
| | | <!-- blade_user--> |
| | | <!-- WHERE--> |
| | | <!-- dept_id IN (--> |
| | | <!-- SELECT i.departmentid--> |
| | | <!-- FROM--> |
| | | <!-- sys_information i--> |
| | | <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">--> |
| | | <!-- and i.jurisdiction =#{jurisdiction}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- i.departmentid--> |
| | | <!-- )--> |
| | | <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND dispatch=0--> |
| | | <!-- <if test="deptid!=null and deptid!=''">--> |
| | | <!-- and dept_id =#{deptid}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- dept_id--> |
| | | <!-- ) F ON F.dept_id = A.deptid--> |
| | | <!-- </select> --> |
| | | <!--统计上个月和这个月交社保的人数以及缴纳金额--> |
| | | <select id="selectTo" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(A.lastmonth, 0) AS lastmonth, |
| | | IFNULL(B.thismouth, 0) AS thismouth, |
| | | IFNULL(A.amount, 0) AS lastamount, |
| | | IFNULL(B.amount, 0) AS thisamount, |
| | | IFNULL( C.userthismouth, 0 ) AS userthismouth, |
| | | IFNULL( D.userlastmouth, 0 ) AS userlastmouth, |
| | | IFNULL( E.userpcthismouth, 0 ) AS userpcthismouth, |
| | | IFNULL( F.userpclastmouth, 0 ) AS userpclastmouth |
| | | FROM ( |
| | | IFNULL(C.thisamount, 0) AS thisamount, |
| | | IFNULL(D.lastamount, 0) AS lastamount, |
| | | IFNULL(E.userthismouth, 0) AS userthismouth, |
| | | IFNULL(F.userlastmouth, 0) AS userlastmouth, |
| | | IFNULL(G.userpcthismouth, 0) AS userpcthismouth, |
| | | IFNULL(J.userpclastmouth, 0) AS userpclastmouth |
| | | FROM (SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction) H |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS lastmonth, |
| | | amount, |
| | | deptid |
| | | FROM |
| | | sys_socil |
| | | WHERE |
| | | deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction |
| | | where 1=1 |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY i.departmentid ) |
| | | AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( insuredtime, '%Y%m' ) ) = 1 |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and deptid =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | amount, |
| | | deptid |
| | | ) A |
| | | left JOIN ( |
| | | FROM sys_socil |
| | | WHERE PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(insuredtime, '%Y%m')) = 1 |
| | | GROUP BY deptid |
| | | ) A ON A.deptid = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS thismouth, |
| | | amount, |
| | | deptid |
| | | FROM |
| | | sys_socil |
| | | WHERE |
| | | deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction |
| | | where 1=1 |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY i.departmentid ) |
| | | AND DATE_FORMAT( insuredtime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and deptid =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | amount, |
| | | FROM sys_socil |
| | | WHERE DATE_FORMAT(insuredtime, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | GROUP BY deptid |
| | | ) B ON B.deptid = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT SUM(amount) AS thisamount, |
| | | deptid |
| | | ) B ON A.deptid = B.deptid |
| | | FROM sys_socil |
| | | WHERE DATE_FORMAT(insuredtime, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | GROUP BY deptid |
| | | ) C ON C.deptid = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT SUM(amount) AS lastamount, |
| | | deptid |
| | | FROM sys_socil |
| | | WHERE PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(insuredtime, '%Y%m')) = 1 |
| | | GROUP BY deptid |
| | | ) D ON D.deptid = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS userthismouth, |
| | | dept_id |
| | | FROM |
| | | blade_user |
| | | WHERE |
| | | dept_id IN ( |
| | | SELECT |
| | | i.departmentid |
| | | FROM |
| | | sys_information i |
| | | LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction |
| | | where 1=1 |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY |
| | | i.departmentid |
| | | ) |
| | | AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND status=1 |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and dept_id =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | dept_id |
| | | ) C ON C.dept_id = A.deptid |
| | | LEFT JOIN( |
| | | FROM blade_user |
| | | WHERE DATE_FORMAT(update_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | AND STATUS = 1 |
| | | AND is_deleted = 0 |
| | | GROUP BY dept_id |
| | | ) E ON E.dept_id = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS userlastmouth, |
| | | dept_id |
| | | FROM |
| | | blade_user |
| | | WHERE |
| | | dept_id IN ( |
| | | SELECT |
| | | i.departmentid |
| | | FROM |
| | | sys_information i |
| | | LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction |
| | | where 1=1 |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY |
| | | i.departmentid |
| | | ) |
| | | AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND status=1 |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and dept_id =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | dept_id |
| | | ) D ON D.dept_id = A.deptid |
| | | FROM blade_user |
| | | WHERE PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(update_time, '%Y%m')) = 1 |
| | | AND STATUS = 1 |
| | | AND is_deleted = 0 |
| | | GROUP BY dept_id |
| | | ) F ON F.dept_id = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS userpcthismouth, |
| | | dept_id |
| | | FROM |
| | | blade_user |
| | | WHERE |
| | | dept_id IN ( |
| | | SELECT |
| | | i.departmentid |
| | | FROM |
| | | sys_information i |
| | | LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction |
| | | where 1=1 |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY |
| | | i.departmentid |
| | | ) |
| | | AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND dispatch=0 |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and dept_id =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | FROM blade_user |
| | | WHERE DATE_FORMAT(update_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | AND dispatch = 0 |
| | | AND STATUS = 1 |
| | | AND is_deleted = 0 |
| | | GROUP BY dept_id |
| | | ) G ON G.dept_id = H.departmentid |
| | | LEFT JOIN ( |
| | | SELECT COUNT(*) AS userpclastmouth, |
| | | dept_id |
| | | ) E ON E.dept_id = A.deptid |
| | | LEFT JOIN( |
| | | SELECT COUNT(*) AS userpclastmouth,dept_id |
| | | FROM |
| | | blade_user |
| | | WHERE |
| | | dept_id IN ( |
| | | SELECT i.departmentid |
| | | FROM |
| | | sys_information i |
| | | LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction |
| | | where 1=1 |
| | | FROM blade_user |
| | | WHERE PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(update_time, '%Y%m')) = 1 |
| | | AND dispatch = 0 |
| | | AND STATUS = 1 |
| | | AND is_deleted = 0 |
| | | GROUP BY dept_id |
| | | ) J ON J.dept_id = H.departmentid |
| | | <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> |
| | | and i.jurisdiction =#{jurisdiction} |
| | | and H.jurisdiction =#{jurisdiction} |
| | | </if> |
| | | GROUP BY |
| | | i.departmentid |
| | | ) |
| | | AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND dispatch=0 |
| | | <if test="deptid!=null and deptid!=''"> |
| | | and dept_id =#{deptid} |
| | | and H.departmentid =#{deptid} |
| | | </if> |
| | | GROUP BY |
| | | dept_id |
| | | ) F ON F.dept_id = A.deptid |
| | | </select> |
| | | |
| | | |