xiaoyong931011
2021-11-09 d6778b4c38c3c9dd70da46715efdaaafc366ab5f
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
package com.xzx.gc.pay.service;
 
 
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.PlatformAccountInfo;
import com.xzx.gc.pay.mapper.PlatformAccountInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
 
@Service
@Transactional
@Slf4j
public class PlatformAccountInfoService {
 
    @Autowired
    private PlatformAccountInfoMapper platformAccountInfoMapper;
 
    public void add(PlatformAccountInfo platformAccountInfo){
        platformAccountInfo.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
        platformAccountInfo.setCreateTime(DateUtil.now());
        platformAccountInfoMapper.insertSelective(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;
    }
 
    public void updateMoney(String money){
        platformAccountInfoMapper.updateMoney(Convert.toBigDecimal(money,Constants.MONEY_INIT));
    }
 
    public void updateHbb(String money){
        platformAccountInfoMapper.updateHbb(Convert.toBigDecimal(money,Constants.MONEY_INIT));
    }
}