| | |
| | | <!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"> |
| | | <sql id="shopBalanceStatementList"> |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_balance, |
| | | variable_amount, |
| | | balance, |
| | | create_time, |
| | | create_user_id, |
| | | object_id |
| | | tsbs.*, |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopManagerName, |
| | | ts.phone |
| | | 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"> |
| | | SELECT |
| | | tsbs.*, |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopManagerName, |
| | | ts.phone |
| | | FROM |
| | | t_shop_balance_statement tsbs |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id AND ts.del_flag = 0 |
| | | t_shop_balance_statement tsbs |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id AND ts.del_flag = 0 |
| | | <where> |
| | | <if test="bs.shopName != null and bs.shopName != ''"> |
| | | AND ts.`name` like concat('%', #{bs.shopName}, '%') |
| | |
| | | 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> |