puzhibing
2023-12-01 ddcef762ff4a159e132c68dfec512c60a68a53e6
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.IncomeMapper;
import com.stylefeng.guns.modular.system.model.Income;
import com.stylefeng.guns.modular.system.service.IIncomeService;
import com.stylefeng.guns.modular.system.util.DateUtil;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
 
 
@Service
public class IncomeServiceImpl extends ServiceImpl<IncomeMapper, Income> implements IIncomeService {
 
    @Resource
    private IncomeMapper incomeMapper;
 
 
 
 
 
    /**
     * 添加数据
     * @param userType
     * @param objectId
     * @param type
     * @param incomeId
     * @param money
     * @throws Exception
     */
    @Override
    public void saveData(Integer userType, Integer objectId, Integer type, Integer incomeId, Integer orderType, Double money) throws Exception {
        Income income = new Income();
        income.setUserType(userType);
        income.setObjectId(objectId);
        income.setType(type);
        income.setIncomeId(incomeId);
        income.setOrderType(orderType);
        income.setMoney(money);
        income.setInsertTime(new Date());
        this.insert(income);
    }
 
 
    /**
     * 获取列表数据
     * @param userType
     * @param objectId
     * @param type
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> query(Integer language, Integer userType, Integer objectId, Integer type, Integer pageNum, Integer size) throws Exception {
        pageNum = (pageNum - 1) * size;
        List<Map<String, Object>> query = incomeMapper.query(userType, objectId, type, pageNum, size);
        for (Map<String, Object> map : query) {
            String time = map.get("time").toString();
            map.put("time", DateUtil.conversionFormat(language, time));
        }
        return query;
    }
 
    @Override
    public List<Income> queryData(Integer userType, Integer objectId, Integer type, Integer incomeId, Integer orderType) {
        return incomeMapper.queryData(userType, objectId, type, incomeId, orderType);
    }
}