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;
|
}
|
}
|