puzhibing
2023-12-08 e825aefcd7285facc06fcb5bf69cdd5afc402b2d
cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
@@ -191,48 +191,37 @@
        group by a.appUserId, a.studentId, a.coursePackageId
    </select>
    <select id="pacQueryDto" resultType="map">
        SELECT
        coursePackageId,
        SUM( cashPayment ) AS cashPayment,
        SUM( totalClassHours ) AS totalClassHours,
        SUM( totalClassHours - laveClassHours ) AS hasHours,
        ROUND( SUM(( totalClassHours - laveClassHours ) * ( cashPayment / totalClassHours )), 2 ) AS lavePay,
        cp.`name` ,
        cp.province,
        cp.city,
        cp.storeId,cp.cityCode,cp.provinceCode,py.insertTime
        FROM
        t_course_package_payment py
        LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
        <where>
            <if test="storeIds != null and storeIds.size()>0">
                AND cp.id IN
                <foreach collection="storeIds" separator="," item="id" open="(" close=")">
                    #{id}
        select
        id,
        name,
        province,
        city,
        storeId,
        count(1) as number
        from (
            select
            b.id,
            b.`name`,
            b.province,
            b.city,
            b.storeId
            from t_course_package_scheduling a
            left join t_course_package b on (a.coursePackageId = b.id)
            where a.`status` != 4 and b.status != 4 and b.auditStatus = 2 and b.state = 1
            <if test="null != storeIds and storeIds.size() > 0">
                and b.storeId in
                <foreach collection="storeIds" item="item" index="index" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="null != start and '' != start and null != end and '' != end">
                py.insertTime between #{start} and #{end}
                and DATE_FORMAT(a.classDate, '%Y-%m-%d') between #{start} and #{end}
            </if>
            <if test="null != cityCode and '' != cityCode">
                and cityCode =#{cityCode}
            </if>
            <if test="null != provinceCode and '' != provinceCode">
                and provinceCode =#{provinceCode}
            </if>
            <if test="null != name and '' != name">
                and name like CONCAT('%', #{name}, '%')
                and b.name like CONCAT('%', #{name}, '%')
            </if>
        </where>
        GROUP BY
        coursePackageId
            order by classDate
        ) as aa group by aa.id, aa.name, aa.province, aa.city, aa.storeId
    </select>
    <select id="listOne" resultType="com.dsh.course.entity.TCoursePackagePayment">