rk
昨天 7869fa712c19c351a48bfb0af11b0fe87b17c184
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.doumee.dao.business;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.Shop;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.math.BigDecimal;
 
/**
 * @author 江蹄蹄
 * @date 2023/03/21 15:48
 */
public interface ShopMapper extends BaseMapper<Shop> {
 
 
    /**
     * 添加积分
     * @param shopId
     * @param integral
     */
    @Select(" update shop set INTEGRAL = ifNull( INTEGRAL,0) + #{integral} , TOTAL_INTEGRAL = ifNull(TOTAL_INTEGRAL,0) +  #{titleIntegral}   , EDIT_DATE = now()  where id = #{shopId}  ")
    void addIntegral(@Param("shopId") Integer shopId , @Param("integral") BigDecimal integral , @Param("titleIntegral")BigDecimal titleIntegral);
 
    /**
     * 减少积分
     * @param shopId
     * @param integral
     */
    @Select(" update shop set INTEGRAL = ifNull( INTEGRAL,0) - #{integral} , EDIT_DATE = now()   where id = #{shopId}  ")
    void subtractIntegral(@Param("shopId") Integer shopId , @Param("integral")BigDecimal integral);
 
 
    /**
     * 添加余额
     * @param shopId
     * @param amount
     */
    @Select(" update shop set AMOUNT = ifNull(AMOUNT,0) + #{amount} , TOTAL_AMOUNT = ifNull(TOTAL_AMOUNT,0) + #{titleAmount}   , EDIT_DATE = now()  where id = #{shopId}  ")
    void addAmount(@Param("shopId") Integer shopId , @Param("amount") BigDecimal amount , @Param("titleAmount")BigDecimal titleAmount);
 
    /**
     * 减少余额
     * @param shopId
     * @param amount
     */
    @Select(" update shop set AMOUNT = ifNull( AMOUNT,0) - #{amount} , EDIT_DATE = now()   where id = #{shopId}  ")
    void subtractAmount(@Param("shopId") Integer shopId , @Param("amount")BigDecimal amount);
 
}