Blame view

src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java 2.44 KB
1
2
package com.huaheng.pc.config.statusFlow.service;
3
4
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5
import com.huaheng.common.exception.service.ServiceException;
pengcheng authored
6
import com.huaheng.common.utils.security.ShiroUtils;
7
import com.huaheng.pc.config.statusFlow.mapper.StatusFlowDetailMapper;
8
9
10
11
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader;
import com.huaheng.pc.config.statusFlow.mapper.StatusFlowHeaderMapper;
12
13
import javax.annotation.Resource;
14
15
16
17
import java.util.List;
import java.util.Map;

@Service("StatusFlow")
18
19
public class StatusFlowHeaderService extends ServiceImpl<StatusFlowHeaderMapper, StatusFlowHeader> {
20
21
22
23
24
25
    @Resource
    private StatusFlowHeaderMapper statusFlowHeaderMapper;
    @Resource
    private StatusFlowDetailMapper statusFlowDetailMapper;
26
    public List<Map<String, Object>> flowList(String recordType){
27
        LambdaQueryWrapper<StatusFlowHeader> lambda = Wrappers.lambdaQuery();
28
        lambda.select(StatusFlowHeader::getCode, StatusFlowHeader::getName)
29
                .eq(StatusFlowHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
30
            .eq(StatusFlowHeader::getRecordType, recordType);
31
32
        return this.listMaps(lambda);
    }
pengcheng authored
33
34
35
36
37
38
39
40
41


    //根据模块区分出入库流程
    public List<StatusFlowHeader> shipmentStatusFlowHeaders(String moduleType){
        LambdaQueryWrapper<StatusFlowHeader> lambda = Wrappers.lambdaQuery();
        lambda.eq(StatusFlowHeader::getModuleType,moduleType)
                .eq(StatusFlowHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
        return this.list(lambda);
    }
42
43
44
45


    //复制流程
    public Boolean statusFlowCopy(String code,String newCode){
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
        int i = 0;
        //复制流程主表
        i = statusFlowHeaderMapper.statusFlowHeaderCopy(code,newCode);
        if(i < 1){
            throw new ServiceException("复制菜单数据失败");
        }

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

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