luodangjia
2024-12-19 60f70f7409ec1ece8905e088fb43e0cb0258a70b
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopBalanceStatementMapper.xml
@@ -2,37 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.other.mapper.ShopBalanceStatementMapper">
    <select id="findLatestChangeByType" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement">
        SELECT
            id,
            shop_id,
            type,
            historical_balance,
            variable_amount,
            balance,
            create_time,
            create_user_id,
            object_id
        FROM
            (
            SELECT
                id,
                shop_id,
                type,
                historical_balance,
                variable_amount,
                balance,
                create_time,
                create_user_id,
                object_id,
                ROW_NUMBER() OVER ( PARTITION BY type, create_user_id ORDER BY create_time DESC ) AS rn
            FROM
                t_shop_balance_statement
            ) AS subquery
        WHERE
            rn = 1
    </select>
    <select id="queryShopBalanceStatementPage" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement">
    <sql id="shopBalanceStatementList">
        SELECT
            tsbs.*,
            ts.`name` shopName,
@@ -58,5 +28,12 @@
                AND tsbs.create_time BETWEEN #{bs.startTime} AND #{bs.endTime}
            </if>
        </where>
    </sql>
    <select id="queryShopBalanceStatementPage" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement">
        <include refid="shopBalanceStatementList"/>
    </select>
    <select id="selectShopBalanceStatementList" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement">
        <include refid="shopBalanceStatementList"/>
    </select>
</mapper>