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);
|
}
|
}
|