Commit 92d94e31 by huluobin

# 更新

parent b634ee16
......@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.common.util.PathUtil;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTypeDao;
import com.blt.other.module.cost.dto.request.ResetReq;
import com.blt.other.module.cost.dto.response.ResetResp;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostDetailService;
......@@ -53,7 +55,8 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
@Resource
CostTypeDao costTypeDao;
@Resource
AccountingSubjectMapper accountingSubjectMapper;
@Override
public ResetResp reset(ResetReq req) {
......@@ -69,9 +72,14 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
}
if (StringUtils.isNotEmpty(req.getTypeNo())) {
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
costDetailDomain.setTypeId(costTypeDomain.getId());
costDetailDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costDetailDomain.setTypeNo(costTypeDomain.getTypeNo());
costDetailDomain.setTypeName(costTypeDomain.getTypeName());
costDetailDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costDetailDomain.setAccountingSubjectName(accountingSubject.getName());
}
baseMapper.updateById(costDetailDomain);
......
......@@ -142,6 +142,8 @@ public abstract class AbstractCostService implements CostService {
CostTemplateBaseColMapper costTemplateBaseColMapper;
@Resource
AccountingSubjectMapper accountingSubjectMapper;
@Resource
CostTypeDao costTypeDao;
@Transactional(rollbackFor = Exception.class)
@Override
......@@ -166,7 +168,7 @@ public abstract class AbstractCostService implements CostService {
if (StringUtils.isNotEmpty(costDomain.getTypeNo())) {
CostTypeDomain costTypeDomain = new CostTypeDomain();
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costDomain.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costDomain.setTypeNo(costDomain.getTypeNo());
......@@ -174,6 +176,7 @@ public abstract class AbstractCostService implements CostService {
costDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costDomain.setAccountingSubjectName(accountingSubject.getName());
}
Integer update = costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment