|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
|
|
|
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
|
|
|
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
import com.engine.organization.service.FieldDefinedService;
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Author weaver_cl
|
|
|
|
* @Description:
|
|
|
|
* @Date 2022/6/13
|
|
|
|
* @Version V1.0
|
|
|
|
**/
|
|
|
|
public class FieldDefinedServiceImpl extends Service implements FieldDefinedService {
|
|
|
|
private ExtendTitleMapper getExtendTitleMapper() {
|
|
|
|
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
private ExtendInfoMapper getExtendInfoMapper() {
|
|
|
|
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<TypeTreeDTO> getTree(String moduleName) {
|
|
|
|
List<TypeTreeDTO> typeTreeDTOS = new ArrayList<>();
|
|
|
|
//int extendType =
|
|
|
|
return typeTreeDTOS;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getTabInfo(String groupType) {
|
|
|
|
OrganizationAssert.notBlank(groupType, "分组信息有误,请确认");
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
Long groupId = Long.parseLong(groupType);
|
|
|
|
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupId);
|
|
|
|
List<Map<String, Object>> tabs = new ArrayList<>();
|
|
|
|
int idx = 1;
|
|
|
|
for (ExtendTitlePO extendTitle : extendTitleList) {
|
|
|
|
Map<String, Object> tab = new HashMap<>();
|
|
|
|
tab.put("tabkey", idx++);
|
|
|
|
tab.put("title", extendTitle.getTitle());
|
|
|
|
tab.put("isShow", extendTitle.getIsShow());
|
|
|
|
tab.put("groupid", extendTitle.getGroupId());
|
|
|
|
tab.put("viewAttr", extendTitle.getGroupId() < 0 ? 1 : 2);
|
|
|
|
tab.put("editable", editTable(extendTitle.getId()));
|
|
|
|
tabs.add(tab);
|
|
|
|
}
|
|
|
|
datas.put("status", "1");
|
|
|
|
datas.put("tabs", tabs);
|
|
|
|
return datas;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 判断该分组下是否有字段
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
private boolean editTable(Long id) {
|
|
|
|
return getExtendInfoMapper().countFieldsByGroupId(id) > 0;
|
|
|
|
}
|
|
|
|
}
|