czt
2025-05-30 9bc5f4d58da606c6a465e152d05a1c31b0611f74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.fzzy.igds.sys.pr;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.igds.dzhwk.constant.Constant;
import com.fzzy.igds.dzhwk.domain.Dept;
import com.fzzy.igds.sys.CoreDeptService;
import com.fzzy.igds.sys.SysDeptService;
import com.ruoyi.common.core.domain.entity.SysDept;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @Description 库区信息
 * @Author CZT
 * @Date 2024/11/21 18:01
 */
@Component("deptPR")
public class DeptPR {
 
    @Resource
    private CoreDeptService coreDeptService;
    @Resource
    private SysDeptService sysDeptService;
 
    /**
     * 获取组织下所有库区
     * ${dorado.getDataProvider("deptPR#loadParents").getResult()}
     *
     * @return
     */
    @DataProvider
    public List<SysDept> loadParents() {
        return sysDeptService.getAllDeptByCompanyId(null);
    }
 
    /**
     * 查询设备,将操作信息调整为空,默认包括分库参数
     *
     * deptPR#getData
     *
     * @return
     */
    @DataProvider
    public List<Dept> getData() {
        List<Dept> deptList = coreDeptService.getAllData(null);
        if(null == deptList){
            List<SysDept> list = sysDeptService.getDeptByType(Constant.DEPT_TYPE_20);
            if(null == list){
                return null;
            }
            Dept dept;
            for (SysDept sysDept : list) {
                dept = coreDeptService.getDataById(sysDept.getDeptId() +"");
                if(null == dept){
                    dept = coreDeptService.initDeptData(sysDept);
                }
                deptList.add(dept);
            }
        }
        return deptList;
    }
 
 
    /**
     * deptPR#saveData
     */
    @DataResolver
    public void saveData(Dept data) {
        Dept dept = new Dept();
        BeanUtils.copyProperties(data, dept);
        coreDeptService.saveOrUpdate(dept);
    }
 
    /**
     * deptPR#delData
     */
    @Expose
    public String delData(Dept data) {
        Dept dept = new Dept();
        BeanUtils.copyProperties(data, dept);
        coreDeptService.delData(dept);
        return null;
    }
}