公司/分部 主表、拓展表动态添加字段、动态分组

pull/73/MERGE^2
dxfeng 3 years ago
parent 5ac8ce813a
commit 49155c6893

@ -33,6 +33,11 @@ public class ExtendGroupPO {
*/ */
private String groupName; private String groupName;
/**
*
*/
private Long pid;
private Long creator; private Long creator;
private int deleteType; private int deleteType;
private Date createTime; private Date createTime;

@ -19,7 +19,7 @@ public interface ExtMapper {
* @param id * @param id
* @return * @return
*/ */
Map<String, Object> listCompExt(@Param("tableName") String tableName, @Param("fields") String fields, @Param("id") long id); Map<String, Object> listExt(@Param("tableName") String tableName, @Param("fields") String fields, @Param("id") long id);
/** /**
* *
@ -28,7 +28,7 @@ public interface ExtMapper {
* @param id * @param id
* @return * @return
*/ */
int countCompExtById(@Param("tableName") String tableName, @Param("id") long id); int countExtById(@Param("tableName") String tableName, @Param("id") long id);
/** /**
* *
@ -36,7 +36,7 @@ public interface ExtMapper {
* @param map * @param map
* @return * @return
*/ */
int insertCompExt(@Param("tableName") String tableName, @Param("map") Map<String, Object> map); int insertExt(@Param("tableName") String tableName, @Param("map") Map<String, Object> map);
/** /**
* *
@ -44,5 +44,5 @@ public interface ExtMapper {
* @param map * @param map
* @return * @return
*/ */
int updateCompExt(@Param("tableName") String tableName, @Param("id") long id, @Param("map") Map<String, Object> map); int updateExt(@Param("tableName") String tableName, @Param("id") long id, @Param("map") Map<String, Object> map);
} }

@ -3,7 +3,7 @@
<mapper namespace="com.engine.organization.mapper.extend.ExtMapper"> <mapper namespace="com.engine.organization.mapper.extend.ExtMapper">
<insert id="insertCompExt" parameterType="java.util.Map"> <insert id="insertExt" parameterType="java.util.Map">
insert into ${tableName} ( insert into ${tableName} (
<foreach collection="map" item="value" index="key" separator=","> <foreach collection="map" item="value" index="key" separator=",">
${key} ${key}
@ -16,7 +16,7 @@
) )
</insert> </insert>
<update id="updateCompExt" parameterType="java.util.Map"> <update id="updateExt" parameterType="java.util.Map">
update ${tableName} set update ${tableName} set
<foreach collection="map" item="value" index="key" separator=","> <foreach collection="map" item="value" index="key" separator=",">
${key} = #{value} ${key} = #{value}
@ -24,14 +24,14 @@
where id = #{id} where id = #{id}
</update> </update>
<select id="listCompExt" resultType="map"> <select id="listExt" resultType="map">
select ${fields} select ${fields}
from ${tableName} from ${tableName}
where delete_type = 0 where delete_type = 0
and id = #{id} and id = #{id}
</select> </select>
<select id="countCompExtById" resultType="java.lang.Integer"> <select id="countExtById" resultType="java.lang.Integer">
select count(1) select count(1)
from ${tableName} from ${tableName}
where delete_type = 0 where delete_type = 0

@ -3,6 +3,7 @@ package com.engine.organization.mapper.extend;
import com.engine.organization.entity.extend.po.ExtendGroupPO; import com.engine.organization.entity.extend.po.ExtendGroupPO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -15,10 +16,26 @@ public interface ExtendGroupMapper {
/** /**
* *
* *
* @param groupType * @param extendType
* @return * @return
*/ */
List<ExtendGroupPO> listByType(@Param("groupType") String groupType); List<ExtendGroupPO> listByType(@Param("extendType") String extendType);
/**
* ID
*
* @param ids
* @return
*/
List<ExtendGroupPO> listGroupByIds(@Param("ids") Collection<Long> ids);
/**
* ID
*
* @param pid
* @return
*/
List<ExtendGroupPO> listGroupByPid(@Param("pid") Long pid);
/** /**
* ID * ID

@ -16,6 +16,7 @@
t t
. .
id id
, t.pid
, t.extend_type , t.extend_type
, t.group_name , t.group_name
, t.creator , t.creator
@ -38,7 +39,25 @@
<select id="getGroupNameById" resultType="java.lang.String"> <select id="getGroupNameById" resultType="java.lang.String">
select group_name select group_name
from jcl_field_extendgroup from jcl_field_extendgroup
where id = #{id} and delete_type = 0 where id = #{id}
and delete_type = 0
</select>
<select id="listGroupByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_field_extendgroup t
WHERE t.delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listGroupByPid" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_field_extendgroup t
WHERE t.delete_type = 0
and t.pid= #{pid}
</select> </select>

@ -27,7 +27,7 @@ public interface CompService {
* @param params * @param params
* @return * @return
*/ */
int saveBaseComp(CompSearchParam params); int saveBaseComp(Map<String, Object> params);
/** /**
* *

@ -16,7 +16,7 @@ import java.util.Map;
public interface ExtService { public interface ExtService {
/** /**
* *
* *
* @param user * @param user
* @param extendType * @param extendType
@ -28,6 +28,18 @@ public interface ExtService {
*/ */
List<SearchConditionItem> getExtForm(User user, String extendType, String tableName, int viewAttr, long id, String groupId); List<SearchConditionItem> getExtForm(User user, String extendType, String tableName, int viewAttr, long id, String groupId);
/**
*
*
* @param user
* @param extendType
* @param tableName
* @param viewAttr
* @param groupId
* @return
*/
List<SearchConditionItem> getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType);
/** /**
* *
* *

@ -2,7 +2,6 @@ package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem; import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption; import com.api.browser.bean.SearchConditionOption;
@ -12,13 +11,13 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType; import com.engine.hrm.entity.RuleCodeType;
import com.engine.organization.component.OrganizationWeaTable; import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.company.bo.CompBO; import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.dto.CompListDTO; import com.engine.organization.entity.company.dto.CompListDTO;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.service.CompService; import com.engine.organization.service.CompService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
@ -31,11 +30,10 @@ import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column; import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil; import com.engine.organization.util.page.PageUtil;
import weaver.crm.Maint.SectorInfoComInfo; import org.apache.commons.collections.CollectionUtils;
import weaver.general.StringUtil; import weaver.general.StringUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,6 +52,10 @@ public class CompServiceImpl extends Service implements CompService {
* 3 * 3
*/ */
private static final String EXTEND_TYPE = "1"; private static final String EXTEND_TYPE = "1";
/**
*
*/
private static final String JCL_ORG_COMP = "JCL_ORG_COMP";
/** /**
* *
*/ */
@ -65,6 +67,11 @@ public class CompServiceImpl extends Service implements CompService {
private static final String RIGHT_NAME = "Company:All"; private static final String RIGHT_NAME = "Company:All";
/**
* /titleID
*/
private static final Long GROUP_ID = -1L;
private CompMapper getCompMapper() { private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class); return MapperProxyFactory.getProxy(CompMapper.class);
} }
@ -126,14 +133,19 @@ public class CompServiceImpl extends Service implements CompService {
} }
@Override @Override
public int saveBaseComp(CompSearchParam params) { public int saveBaseComp(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
// 自动编号 String compNo = (String) params.get("comp_no");
params.setCompNo(CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, params.getCompNo())); compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
List<CompPO> list = getCompMapper().listByNo(Util.null2String(params.getCompNo())); List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
OrganizationAssert.isEmpty(list, "编号不允许重复"); OrganizationAssert.isEmpty(list, "编号不允许重复");
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID()); params.put("comp_no", compNo);
return getCompMapper().insertIgnoreNull(compPO); params.put("forbidden_tag", 0);
params.put("creator", user.getUID());
params.put("delete_type", 0);
params.put("create_time", new Date());
params.put("update_time", new Date());
return MapperProxyFactory.getProxy(ExtMapper.class).insertExt(JCL_ORG_COMP, params);
} }
@Override @Override
@ -149,9 +161,12 @@ public class CompServiceImpl extends Service implements CompService {
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class); CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
String groupId = (String) params.get("viewCondition"); String groupId = (String) params.get("viewCondition");
CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID()); CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID());
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
int updateCount = 0; int updateCount = 0;
// 更新主表数据 // 更新主表数据
updateCount += getCompMapper().updateBaseComp(compPO); updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMP, params, groupId, compPO.getId());
// 更新主表拓展表 // 更新主表拓展表
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, compPO.getId()); updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, compPO.getId());
//更新明细表 //更新明细表
@ -228,10 +243,14 @@ public class CompServiceImpl extends Service implements CompService {
buttonsMap.put("hasSave", true); buttonsMap.put("hasSave", true);
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) { if ("0".equals(groupId)) {
addGroups.add(new SearchConditionGroup("基本信息", true, getBaseForm(viewAttr, id))); groupId = GROUP_ID.toString();
} else { }
addGroups.add(new SearchConditionGroup(getExtendGroupMapper().getGroupNameById(groupId), true, getExtService(user).getExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, viewAttr, id, groupId))); List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByPid(Long.parseLong(groupId));
if (CollectionUtils.isNotEmpty(extendGroupPOS)) {
for (ExtendGroupPO extendGroupPO : extendGroupPOS) {
addGroups.add(new SearchConditionGroup(extendGroupPO.getGroupName(), true, getExtService(user).getExtForm(user, EXTEND_TYPE + "", Integer.parseInt(groupId) >= 0 ? JCL_ORG_COMPEXT : JCL_ORG_COMP, viewAttr, id, extendGroupPO.getId().toString())));
}
} }
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
@ -255,91 +274,17 @@ public class CompServiceImpl extends Service implements CompService {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>(); List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>(); List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByPid(GROUP_ID);
// 编号 if (CollectionUtils.isNotEmpty(extendGroupPOS)) {
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "compNo"); for (ExtendGroupPO extendGroupPO : extendGroupPOS) {
compNoItem.setRules("required|string"); addGroups.add(new SearchConditionGroup(extendGroupPO.getGroupName(), true, getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_COMP, 2, extendGroupPO.getId().toString(), "comp_no", RuleCodeType.SUBCOMPANY.getValue())));
// 判断是否开启自动编号 }
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
compNoItem.setViewAttr(2);
compNoItem.setHelpfulTip("编号为空,则按照指定规则自动生成编号");
compNoItem.setRules("");
} }
getSameFormItem(conditionItems, compNoItem, null);
addGroups.add(new SearchConditionGroup("基本信息", true, conditionItems));
apiDatas.put("condition", addGroups); apiDatas.put("condition", addGroups);
return apiDatas; return apiDatas;
} }
/**
*
*
* @param conditionItems
* @param compNoItem
*/
private void getSameFormItem(List<SearchConditionItem> conditionItems, SearchConditionItem compNoItem, Long id) {
// 名称
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "compName");
compNameItem.setRules("required|string");
// 简称
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "简称", "compNameShort");
compNameShortItem.setRules("required|string");
// 上级公司
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "161", "parentCompany", "compBrowser");
// 组织机构代码
SearchConditionItem orgCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "组织机构代码", "orgCode");
orgCodeItem.setRules("required|string");
// 行业
SearchConditionItem industryItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "行业", "63", "industry", "");
// 负责人
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "负责人", "1", "compPrincipal", "");
compPrincipalItem.setRules("required|string");
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "说明", "description");
conditionItems.add(compNoItem);
conditionItems.add(compNameItem);
conditionItems.add(compNameShortItem);
conditionItems.add(compBrowserItem);
conditionItems.add(orgCodeItem);
conditionItems.add(industryItem);
conditionItems.add(compPrincipalItem);
conditionItems.add(descriptionItem);
if (null == id) {
return;
}
// 赋值
CompPO compPO = getCompMapper().listById(id);
OrganizationAssert.notNull(compPO, "数据不存在或数据已删除");
compNoItem.setValue(compPO.getCompNo());
compNameItem.setValue(compPO.getCompName());
compNameShortItem.setValue(compPO.getCompNameShort());
// compBrowserItem
if (null != compPO.getParentCompany()) {
BrowserBean compBrowserBean = compBrowserItem.getBrowserConditionParam();
compBrowserBean.setReplaceDatas(creatReplaceDatas(compPO.getParentCompany(), getCompMapper().listById(compPO.getParentCompany()).getCompName()));
compBrowserItem.setBrowserConditionParam(compBrowserBean);
}
orgCodeItem.setValue(compPO.getOrgCode());
// industryItem
BrowserBean industryBean = industryItem.getBrowserConditionParam();
industryBean.setReplaceDatas(creatReplaceDatas(compPO.getIndustry(), new SectorInfoComInfo().getSectorInfoname(compPO.getIndustry() + "")));
industryItem.setBrowserConditionParam(industryBean);
try {
// compPrincipalItem
BrowserBean PrincipalBean = compPrincipalItem.getBrowserConditionParam();
PrincipalBean.setReplaceDatas(creatReplaceDatas(compPO.getCompPrincipal(), new ResourceComInfo().getLastname(compPO.getCompPrincipal() + "")));
compPrincipalItem.setBrowserConditionParam(PrincipalBean);
} catch (Exception e) {
throw new RuntimeException(e);
}
descriptionItem.setValue(compPO.getDescription());
}
/** /**
* *
@ -358,45 +303,4 @@ public class CompServiceImpl extends Service implements CompService {
&& null == compPO.getForbiddenTag()); && null == compPO.getForbiddenTag());
} }
/**
*
*
* @param id
* @param name
* @return
*/
private List<Map<String, Object>> creatReplaceDatas(Object id, Object name) {
List<Map<String, Object>> datas = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("name", name);
datas.add(map);
return datas;
}
/**
*
*
* @param viewAttr
* @param id
* @return
*/
private List<SearchConditionItem> getBaseForm(int viewAttr, long id) {
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 编号
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "编号", "compNo");
getSameFormItem(conditionItems, compNoItem, id);
// 查看,全部置位只读
if (1 == viewAttr) {
for (SearchConditionItem item : conditionItems) {
item.setViewAttr(viewAttr);
}
}
return conditionItems;
}
} }

@ -3,8 +3,11 @@ package com.engine.organization.service.impl;
import com.api.browser.bean.SearchConditionItem; import com.api.browser.bean.SearchConditionItem;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.TopTab; import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.extend.bo.ExtendInfoBO; import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO; import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.extend.ExtDTMapper; import com.engine.organization.mapper.extend.ExtDTMapper;
import com.engine.organization.mapper.extend.ExtMapper; import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.mapper.extend.ExtendGroupMapper;
@ -61,8 +64,7 @@ public class ExtServiceImpl extends Service implements ExtService {
OrganizationAssert.notNull(groupId, "请选择对应的拓展页"); OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName); List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName);
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(",")); String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(",")); Map<String, Object> compExtMap = getExtMapper().listExt(tableName, fields, id);
Map<String, Object> compExtMap = getExtMapper().listCompExt(tableName, fields, id);
// 组装拓展页内容 // 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) { for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(extendInfoPO.getFieldName())); SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(extendInfoPO.getFieldName()));
@ -76,6 +78,35 @@ public class ExtServiceImpl extends Service implements ExtService {
return conditionItems; return conditionItems;
} }
@Override
public List<SearchConditionItem> getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType) {
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 2编辑 1查看
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null);
item.setFieldcol(16);
if (1 == extendInfoPO.getIsrequired()) {
item.setViewAttr(3);
item.setRules("required|string");
}
if (extendInfoPO.getFieldName().equals(autoNoField)) {
// 判断是否开启自动编号
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(serialType);
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
item.setViewAttr(2);
item.setHelpfulTip("编号为空,则按照指定规则自动生成编号");
item.setRules("");
}
}
conditionItems.add(item);
}
return conditionItems;
}
@Override @Override
public List<Map<String, Object>> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel) { public List<Map<String, Object>> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel) {
List<Map<String, Object>> tables = new ArrayList<>(); List<Map<String, Object>> tables = new ArrayList<>();
@ -116,11 +147,12 @@ public class ExtServiceImpl extends Service implements ExtService {
*/ */
public List<TopTab> getTabInfo(String extendType, String tableName) { public List<TopTab> getTabInfo(String extendType, String tableName) {
List<TopTab> topTabs = new ArrayList<>(); List<TopTab> topTabs = new ArrayList<>();
// 基本信息
topTabs.add(TopTab.builder().color("#000000").groupId("0").showcount(false).title("基本信息").viewCondition("0").build());
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName); List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName);
List<Long> extendGroups = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList()); List<ExtendInfoPO> infoPOList1 = getExtendInfoMapper().listFields(extendType, "", tableName.toLowerCase().replace("ext", ""));
infoPOList.addAll(infoPOList1);
List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByIds(ids);
Set<Long> extendGroups = extendGroupPOS.stream().map(ExtendGroupPO::getPid).collect(Collectors.toSet());
// 拓展信息 // 拓展信息
if (CollectionUtils.isNotEmpty(extendGroups)) { if (CollectionUtils.isNotEmpty(extendGroups)) {
for (Long groupId : extendGroups) { for (Long groupId : extendGroups) {
@ -140,17 +172,17 @@ public class ExtServiceImpl extends Service implements ExtService {
map.put(dtField, params.get(dtField)); map.put(dtField, params.get(dtField));
} }
// 判断更新还是插入 // 判断更新还是插入
int count = getExtMapper().countCompExtById(tableName, id); int count = getExtMapper().countExtById(tableName, id);
if (count > 0) { if (count > 0) {
map.put("update_time", new Date()); map.put("update_time", new Date());
updateBaseComp = getExtMapper().updateCompExt(tableName, id, map); updateBaseComp = getExtMapper().updateExt(tableName, id, map);
} else { } else {
map.put("creator", user.getUID()); map.put("creator", user.getUID());
map.put("delete_type", 0); map.put("delete_type", 0);
map.put("create_time", new Date()); map.put("create_time", new Date());
map.put("update_time", new Date()); map.put("update_time", new Date());
map.put("id", id); map.put("id", id);
updateBaseComp = getExtMapper().insertCompExt(tableName, map); updateBaseComp = getExtMapper().insertExt(tableName, map);
} }
return updateBaseComp; return updateBaseComp;
} }

@ -57,13 +57,12 @@ public class CompController {
* *
* @param request * @param request
* @param response * @param response
* @param params
* @return * @return
*/ */
@POST @POST
@Path("/saveBaseComp") @Path("/saveBaseComp")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveBaseComp(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompSearchParam params) { public ReturnResult saveBaseComp(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody Map<String,Object> params) {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCompWrapper(user).saveBaseComp(params)); return ReturnResult.successed(getCompWrapper(user).saveBaseComp(params));

@ -38,7 +38,7 @@ public class CompWrapper extends Service {
* @param params * @param params
* @return * @return
*/ */
public int saveBaseComp(CompSearchParam params) { public int saveBaseComp(Map<String, Object> params) {
return getCompService(user).saveBaseComp(params); return getCompService(user).saveBaseComp(params);
} }

Loading…
Cancel
Save