/* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.application.service.impl; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.modules.application.entity.*; import org.springblade.modules.application.service.*; import org.springblade.modules.application.vo.ApplicationVO; import org.springblade.modules.application.mapper.ApplicationMapper; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.modules.application.wrapper.ApplicationWrapper; import org.springblade.modules.enterprise.wrapper.EnterpriseWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.transaction.annotation.Transactional; /** * 申请表 服务实现类 * * @author BladeX * @since 2022-12-13 */ @Service @AllArgsConstructor public class ApplicationServiceImpl extends BaseServiceImpl implements IApplicationService { private final IBasicInfoService basicInfoService; private final IPlanService planService; private final ISchemeService schemeService; private final IGoodsService goodsService; private final ICarService carService; @Override public IPage selectApplicationPage(IPage page, ApplicationVO application) { return page.setRecords(baseMapper.selectApplicationPage(page, application)); } @Transactional @Override public Boolean saveVo(ApplicationEntity application, BasicInfoEntity basicInfoEntity, CarEntity carEntity, PlanEntity planEntity, SchemeEntity schemeEntity, GoodsEntity goodsEntity) { boolean save = super.save(application); basicInfoEntity.setApplicationId(application.getId().toString()); boolean b = basicInfoService.save(basicInfoEntity); planEntity.setApplicationId(application.getId().toString()); boolean p = planService.save(planEntity); schemeEntity.setApplicationId(application.getId().toString()); boolean s = schemeService.save(schemeEntity); goodsEntity.setApplicationId(application.getId().toString()); boolean g = goodsService.save(goodsEntity); carEntity.setApplicationId(application.getId().toString()); boolean c = carService.save(carEntity); return b&&p&&s&&g&&c&&save; } @Override public ApplicationVO getVo(ApplicationEntity application) { ApplicationVO applicationVO = ApplicationWrapper.build().entityVO(application); String applicationId = applicationVO.getId().toString(); applicationVO.setBasicInfoEntity(basicInfoService.getOne(Condition.getQueryWrapper(new BasicInfoEntity(applicationId)))); applicationVO.setSchemeEntity(schemeService.getOne(Condition.getQueryWrapper(new SchemeEntity(applicationId)))); applicationVO.setPlanEntity(planService.getOne(Condition.getQueryWrapper(new PlanEntity(applicationId)))); applicationVO.setCarEntity(carService.getOne(Condition.getQueryWrapper(new CarEntity(applicationId)))); applicationVO.setBasicInfoEntity(basicInfoService.getOne(Condition.getQueryWrapper(new BasicInfoEntity(applicationId)))); GoodsEntity goods = goodsService.getOne(Condition.getQueryWrapper(new GoodsEntity(applicationId))); applicationVO.setGoodsEntity(goods); applicationVO.setGoodsEntity(goods); return applicationVO; } @Override @Transactional public Boolean updateVoById(ApplicationEntity application, BasicInfoEntity basicInfoEntity, CarEntity carEntity, PlanEntity planEntity, SchemeEntity schemeEntity, GoodsEntity goodsEntity) { // basicInfoEntity.setId(application.getBasicInfoId()); // carEntity.setId(application.getCarId()); // planEntity.setId(Long.parseLong(application.getPlanId())); // schemeEntity.setId(Long.parseLong(application.getSchemeId())); // goodsEntity.setId(application.getGoodsId()); boolean b = basicInfoService.updateById(basicInfoEntity); boolean c = carService.updateById(carEntity); boolean p = planService.updateById(planEntity); boolean s = schemeService.updateById(schemeEntity); boolean g = goodsService.updateById(goodsEntity); boolean update = super.updateById(application); return b&&p&&s&&g&&c&&update; } }