Helius
2021-06-28 c49f58ebe531030ee406c82b569c381261c2ba11
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
package com.xzx.gc.order.service;
 
import cn.hutool.core.convert.Convert;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.PlatformAccountInfo;
import com.xzx.gc.order.mapper.PlatformAccountInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
 
import java.util.List;
 
@Service
@Transactional
public class PlatformAccountInfoService {
 
    @Autowired
    private PlatformAccountInfoMapper platformAccountInfoMapper;
 
    /**
     * 更新环保币
     */
    public void updateHbb(String money){
        platformAccountInfoMapper.updateHbb(Convert.toBigDecimal(money,Constants.MONEY_INIT));
    }
 
    /**
     * 更新积分
     */
    public void updateScore(String score){
        platformAccountInfoMapper.updateScore(Convert.toBigDecimal(score,Constants.MONEY_INIT));
    }
 
    public List<PlatformAccountInfo> find(){
        PlatformAccountInfo platformAccountInfo=new PlatformAccountInfo();
        platformAccountInfo.setDelFlag(Convert.toShort(0));
        return platformAccountInfoMapper.select(platformAccountInfo);
    }
 
    public PlatformAccountInfo findByKey(String key){
        Example example=new Example(PlatformAccountInfo.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("fieldKey",key);
        criteria.andEqualTo("delFlag",Constants.DEL_NOT_FLAG);
        PlatformAccountInfo platformAccountInfo = platformAccountInfoMapper.selectOneByExample(example);
        return platformAccountInfo;
    }
}