WaveMasterService.java 1.92 KB
package com.huaheng.pc.config.waveMaster.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.pc.config.waveFlowDetail.domain.WaveFlowDetail;
import com.huaheng.pc.config.waveFlowDetail.mapper.WaveFlowDetailMapper;
import com.huaheng.pc.config.waveFlowHeader.domain.WaveFlowHeader;
import com.huaheng.pc.config.waveFlowHeader.mapper.WaveFlowHeaderMapper;
import com.huaheng.pc.config.waveMaster.domain.WaveMaster;
import com.huaheng.pc.config.waveMaster.mapper.WaveMasterMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class WaveMasterService extends ServiceImpl<WaveMasterMapper, WaveMaster> {

    @Resource
    private WaveMasterMapper waveMasterMapper;
    @Resource
    private WaveFlowHeaderMapper waveFlowHeaderMapper;
    @Resource
    private WaveFlowDetailMapper waveFlowDetailMapper;



    //复制波次配置
    @Transactional
    public Boolean waveMasterCopy(String code,String newCode){
        int i = 0;
        //复制波次配置
        i = waveMasterMapper.waveMasterCopy(code,newCode);
        if(i < 1){
            throw new ServiceException("复制菜单数据失败");
        }

        //复制波次流程主表
        i = waveFlowHeaderMapper.waveFlowHeaderCopy(code,newCode);
        if(i < 1){
            throw new ServiceException("复制菜单数据失败");
        }

        //复制波次流程明细
        i = waveFlowDetailMapper.waveFlowDetailCopy(code,newCode);
        if(i < 1){
            throw new ServiceException("复制菜单数据失败");
        }

        //修改波次流程明细headerId
        i = waveFlowDetailMapper.updateHeaderId(newCode);
        if(i < 1){
            throw new ServiceException("复制菜单数据失败");
        }
        return true;
    }

}