| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean update(PowerPriceMainDTO mainDTO) { |
| | | if (!CollectionUtils.isEmpty(mainDTO.getDetList())) { |
| | | |
| | | PowerPriceMainEntity powerPriceMainEntity = powerPriceMainDao.selectById(mainDTO.getId()); |
| | | powerPriceMainEntity.setCreator(SecurityFrameworkUtils.getLoginUser().getId()); |
| | | powerPriceMainEntity.setCreateDate(new Date()); |
| | | powerPriceMainDao.updateById(powerPriceMainEntity); |
| | | |
| | | QueryWrapper queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("main_id", powerPriceMainEntity.getId()); |
| | | powerPriceDetDao.delete(queryWrapper); |
| | | |
| | | for (int i = 0; i < mainDTO.getDetList().size(); i++) { |
| | | PowerPriceDetEntity powerPriceDetEntity = ConvertUtils.sourceToTarget(mainDTO.getDetList().get(i), PowerPriceDetEntity.class); |
| | | powerPriceDetEntity.setMainId(powerPriceMainEntity.getId()); |
| | | powerPriceDetEntity.setSort(i + 1); |
| | | powerPriceDetDao.insert(powerPriceDetEntity); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |