bug 5452 and 5444
This commit is contained in:
		
							parent
							
								
									e9403316d8
								
							
						
					
					
						commit
						2892b11944
					
				| 
						 | 
				
			
			@ -518,7 +518,7 @@
 | 
			
		|||
        <if test="param.sumType == 2">
 | 
			
		||||
            a.statistic_date,
 | 
			
		||||
        </if>
 | 
			
		||||
        SUBSTRING_INDEX(SUBSTRING_INDEX(concat(g.ancestors, ','),',', #{param.orgLevel}  + 1), ',', -1) as a_org_id,
 | 
			
		||||
        g.dept_id as a_org_id,
 | 
			
		||||
        SUM(IF(a.wallet_id = 1 ,consume_amount + repair_amount - refund_amount,0)) wallet_consume_amount,
 | 
			
		||||
        SUM(IF(a.wallet_id = 2 ,consume_amount + repair_amount - refund_amount,0)) subsidy_consume_amount,
 | 
			
		||||
        SUM(IF(a.wallet_id = 4 ,consume_amount + repair_amount - refund_amount,0)) luck_consume_amount,
 | 
			
		||||
| 
						 | 
				
			
			@ -528,16 +528,11 @@
 | 
			
		|||
        LEFT JOIN sys_user c ON a.cust_id = c.cust_id
 | 
			
		||||
        LEFT JOIN sys_dept g on g.dept_id = c.dept_id
 | 
			
		||||
        WHERE a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
 | 
			
		||||
        <if test="param.orgIdList != null and param.orgIdList.size() > 0">
 | 
			
		||||
            and (
 | 
			
		||||
            <foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
 | 
			
		||||
                     close="">
 | 
			
		||||
                g.ancestors like concat('', #{orgId}, ',%')
 | 
			
		||||
                or g.ancestors like concat('%,', #{orgId}, ',%')
 | 
			
		||||
                or g.ancestors like concat('%,', #{orgId}, '')
 | 
			
		||||
            and g.dept_id in
 | 
			
		||||
            <foreach collection="param.orgIdList" item="orgId" separator="," open="("
 | 
			
		||||
                     close=")">
 | 
			
		||||
                #{orgId}
 | 
			
		||||
            </foreach>
 | 
			
		||||
            )
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="'2'.toString() == authPO.roleType.toString()">
 | 
			
		||||
            and EXISTS (
 | 
			
		||||
            SELECT null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@
 | 
			
		|||
        sys_dept g
 | 
			
		||||
        LEFT JOIN (
 | 
			
		||||
        SELECT
 | 
			
		||||
        CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(concat(g.ancestors, ','),',', #{param.orgLevel}  + 1), ',', -1) as SIGNED) as a_org_id,
 | 
			
		||||
        g.dept_id as a_org_id,
 | 
			
		||||
        sum( consume_num ) AS consume_num,
 | 
			
		||||
        sum( consume_amount ) AS consume_amount,
 | 
			
		||||
        sum( consume_repair_num ) AS consume_repair_num,
 | 
			
		||||
| 
						 | 
				
			
			@ -31,16 +31,11 @@
 | 
			
		|||
        LEFT JOIN sys_dept g on g.dept_id = a.org_id
 | 
			
		||||
        <where>
 | 
			
		||||
            AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
 | 
			
		||||
            <if test="param.orgIdList != null and param.orgIdList.size() > 0">
 | 
			
		||||
                and (
 | 
			
		||||
                <foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
 | 
			
		||||
                         close="">
 | 
			
		||||
                    g.ancestors like concat('', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, '')
 | 
			
		||||
                </foreach>
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            and g.dept_id in
 | 
			
		||||
            <foreach collection="param.orgIdList" item="orgId" separator="," open="("
 | 
			
		||||
                     close=")">
 | 
			
		||||
                #{orgId}
 | 
			
		||||
            </foreach>
 | 
			
		||||
            <if test="'2'.toString() == authPO.roleType.toString()">
 | 
			
		||||
                and EXISTS (
 | 
			
		||||
                SELECT null
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +110,7 @@
 | 
			
		|||
        ) d LEFT JOIN (
 | 
			
		||||
        SELECT
 | 
			
		||||
        statistic_date,
 | 
			
		||||
        CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(concat(g.ancestors, ','),',', #{param.orgLevel}  + 1), ',', -1) as SIGNED) as a_org_id,
 | 
			
		||||
        g.dept_id as a_org_id,
 | 
			
		||||
        sum( consume_num ) AS consume_num,
 | 
			
		||||
        sum( consume_amount ) AS consume_amount,
 | 
			
		||||
        sum( consume_repair_num ) AS consume_repair_num,
 | 
			
		||||
| 
						 | 
				
			
			@ -128,16 +123,11 @@
 | 
			
		|||
        LEFT JOIN sys_dept g on g.dept_id = a.org_id
 | 
			
		||||
        <where>
 | 
			
		||||
            AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
 | 
			
		||||
            <if test="param.orgIdList != null and param.orgIdList.size() > 0">
 | 
			
		||||
                and (
 | 
			
		||||
                <foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
 | 
			
		||||
                         close="">
 | 
			
		||||
                    g.ancestors like concat('', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, '')
 | 
			
		||||
                </foreach>
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            and g.dept_id in
 | 
			
		||||
            <foreach collection="param.orgIdList" item="orgId" separator="," open="("
 | 
			
		||||
                     close=")">
 | 
			
		||||
                #{orgId}
 | 
			
		||||
            </foreach>
 | 
			
		||||
            <if test="'2'.toString() == authPO.roleType.toString()">
 | 
			
		||||
                and EXISTS (
 | 
			
		||||
                SELECT null
 | 
			
		||||
| 
						 | 
				
			
			@ -288,16 +278,11 @@
 | 
			
		|||
        LEFT JOIN sys_dept g on g.dept_id = a.org_id
 | 
			
		||||
        <where>
 | 
			
		||||
            AND a.statistic_date BETWEEN #{param.startDate} AND #{param.endDate}
 | 
			
		||||
            <if test="param.orgIdList != null and param.orgIdList.size() > 0">
 | 
			
		||||
                and (
 | 
			
		||||
                <foreach collection="param.orgIdList" item="orgId" separator=" or " open=""
 | 
			
		||||
                         close="">
 | 
			
		||||
                    g.ancestors like concat('', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, ',%')
 | 
			
		||||
                    or g.ancestors like concat('%,', #{orgId}, '')
 | 
			
		||||
                </foreach>
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            and g.dept_id in
 | 
			
		||||
            <foreach collection="param.orgIdList" item="orgId" separator="," open="("
 | 
			
		||||
                     close=")">
 | 
			
		||||
                #{orgId}
 | 
			
		||||
            </foreach>
 | 
			
		||||
            <if test="'2'.toString() == authPO.roleType.toString()">
 | 
			
		||||
                and EXISTS (
 | 
			
		||||
                SELECT null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue