LostMyth opened a new issue #15162:
URL: https://github.com/apache/shardingsphere/issues/15162


   ### This is application.yml 
   ```
   sharding:
         tables:
           block_order: #block_order表
             actual-data-nodes: master0.block_order_$->{0..9}    
#数据节点,均匀分布,这种是单库多表
             table-strategy: #分表策略
               standard:
                 sharding-column: wallet_address
                 precise-algorithm-class-name: 
com.xxx.MyPreciseShardingAlgorithm
   ```
   ### This is mapper.xml
   ```
   select
           bo.wallet_address as userWalletAddress,
           sum( bo.order_money ) AS orderMoney,
           sum( bo.win_prize_money ) AS winPrizeMoney,
           sum( bo.prize_money ) AS prizeMoney,
           DATE_FORMAT( bo.order_time, "%Y-%m-%d" ) AS day
           from
           block_order bo
           <where>
               <if test="request.walletAddress != null and 
request.walletAddress != ''">
                   and bo.wallet_address = #{request.walletAddress}
               </if>
   
               <if test="request.beginOrderTime != null">
                   and bo.order_time &gt;= #{request.beginOrderTime}
               </if>
               <if test="request.endOrderTime != null">
                   and bo.order_time &lt;= #{request.endOrderTime}
               </if>
           </where>
           GROUP BY bo.wallet_address,
           DATE_FORMAT( bo.order_time, "%Y-%m-%d" )
   ```
   ### Logic SQL:
   ```
   master0 ::: SELECT bo.wallet_address AS userWalletAddress, 
sum(bo.order_money) AS orderMoney, sum(bo.win_prize_money) AS winPrizeMoney, 
sum(bo.prize_money) AS prizeMoney, DATE_FORMAT(bo.order_time, "%Y-%m-%d") AS 
day FROM block_order bo WHERE bo.wallet_address = ? GROUP BY bo.wallet_address, 
DATE_FORMAT(bo.order_time, "%Y-%m-%d")
   ```
   ### Actual SQL:
   ```
   SELECT bo.wallet_address AS userWalletAddress, sum(bo.order_money) AS 
orderMoney, `sum(bo.win_prize_money)` AS winPrizeMoney, sum(bo.prize_money) AS 
prizeMoney, DATE_FORMAT(bo.order_time, "%Y-%m-%d") AS day FROM block_order bo 
WHERE bo.wallet_address = ? GROUP BY bo.wallet_address, 
DATE_FORMAT(bo.order_time, "%Y-%m-%d")
   ```
   
   Please help me , Thank you very much.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to