weaver-hrm-organization/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java

72 lines
2.4 KiB
Java
Raw Normal View History

2022-06-14 09:36:47 +08:00
package com.engine.organization.service.impl;
import com.engine.core.impl.Service;
2022-06-14 15:29:22 +08:00
import com.engine.organization.entity.extend.po.ExtendTitlePO;
2022-06-14 09:36:47 +08:00
import com.engine.organization.entity.fieldset.TypeTreeDTO;
2022-06-14 15:29:22 +08:00
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
2022-06-14 09:36:47 +08:00
import com.engine.organization.service.FieldDefinedService;
2022-06-14 15:29:22 +08:00
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
2022-06-14 09:36:47 +08:00
2022-06-14 11:07:48 +08:00
import java.util.ArrayList;
2022-06-14 15:29:22 +08:00
import java.util.HashMap;
2022-06-14 09:36:47 +08:00
import java.util.List;
2022-06-14 15:29:22 +08:00
import java.util.Map;
2022-06-14 09:36:47 +08:00
/**
* @Author weaver_cl
2022-06-14 11:07:48 +08:00
* @Description:
2022-06-14 09:36:47 +08:00
* @Date 2022/6/13
* @Version V1.0
**/
public class FieldDefinedServiceImpl extends Service implements FieldDefinedService {
2022-06-14 15:29:22 +08:00
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
2022-06-14 09:36:47 +08:00
@Override
public List<TypeTreeDTO> getTree(String moduleName) {
2022-06-14 11:07:48 +08:00
List<TypeTreeDTO> typeTreeDTOS = new ArrayList<>();
//int extendType =
return typeTreeDTOS;
2022-06-14 09:36:47 +08:00
}
2022-06-14 15:29:22 +08:00
@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;
}
2022-06-14 09:36:47 +08:00
}