公司/分部 拓展表 拓展明细表 接口
This commit is contained in:
parent
1bc660ab8d
commit
362b64ae66
|
|
@ -18,7 +18,7 @@ import java.util.Map;
|
|||
public class ExtendInfoBO {
|
||||
|
||||
// 封装对象为table组件
|
||||
public static List<Map<String, Object>> convertInfoListToTable(List<ExtendInfoPO> infoPOList, int operateType, boolean showLabel) {
|
||||
public static List<Map<String, Object>> convertInfoListToTable(List<ExtendInfoPO> infoPOList, int viewAttr, boolean showLabel) {
|
||||
List<Map<String, Object>> lsCol = new ArrayList<Map<String, Object>>();
|
||||
Map<String, Object> col = null;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ public class ExtendInfoBO {
|
|||
|
||||
col.put("key", tmpkey);
|
||||
col.put("dataIndex", tmpkey);
|
||||
col.put("com", getFieldDetialInfo(extendInfoPO, operateType, showLabel, width));
|
||||
col.put("com", getFieldDetialInfo(extendInfoPO, viewAttr, showLabel, width));
|
||||
|
||||
col.put("width", width + "%");
|
||||
|
||||
|
|
@ -46,12 +46,12 @@ public class ExtendInfoBO {
|
|||
* 明细表字段
|
||||
*
|
||||
* @param extendInfoPO
|
||||
* @param operateType
|
||||
* @param viewAttr
|
||||
* @return
|
||||
*/
|
||||
private static List<FieldItem> getFieldDetialInfo(ExtendInfoPO extendInfoPO, int operateType, boolean showLabel, int width) {
|
||||
private static List<FieldItem> getFieldDetialInfo(ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) {
|
||||
List<FieldItem> ls = new ArrayList<FieldItem>();
|
||||
FieldItem fieldItem = createField(extendInfoPO, operateType, showLabel, width);
|
||||
FieldItem fieldItem = createField(extendInfoPO, viewAttr, showLabel, width);
|
||||
ls.add(fieldItem);
|
||||
return ls;
|
||||
}
|
||||
|
|
@ -60,12 +60,12 @@ public class ExtendInfoBO {
|
|||
* 创建列表字段信息
|
||||
*
|
||||
* @param extendInfoPO
|
||||
* @param operateType
|
||||
* @param viewAttr
|
||||
* @param showLabel
|
||||
* @param width
|
||||
* @return
|
||||
*/
|
||||
private static FieldItem createField(ExtendInfoPO extendInfoPO, int operateType, boolean showLabel, int width) {
|
||||
private static FieldItem createField(ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) {
|
||||
FieldItem fieldItem = new FieldItem();
|
||||
if (showLabel) {
|
||||
fieldItem.setLabel(extendInfoPO.getFieldNameDesc());
|
||||
|
|
@ -76,8 +76,8 @@ public class ExtendInfoBO {
|
|||
fieldItem.setType(getFieldhtmltype(extendInfoPO.getControlType() + ""));
|
||||
fieldItem.setKey(extendInfoPO.getFieldName());
|
||||
// 查看操作 全部设置为只读
|
||||
if (0 == operateType) {
|
||||
fieldItem.setViewAttr(1);
|
||||
if (1 == viewAttr) {
|
||||
fieldItem.setViewAttr(viewAttr);
|
||||
} else {
|
||||
// 必填
|
||||
if (1 == extendInfoPO.getIsrequired()) {
|
||||
|
|
@ -98,7 +98,7 @@ public class ExtendInfoBO {
|
|||
* @param fieldhtmltype
|
||||
* @return
|
||||
*/
|
||||
private static FieldType getFieldhtmltype(String fieldhtmltype) {
|
||||
public static FieldType getFieldhtmltype(String fieldhtmltype) {
|
||||
FieldType fieldtype = null;
|
||||
if (fieldhtmltype.equals("1")) {
|
||||
fieldtype = FieldType.INPUT;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.organization.mapper.comp;
|
||||
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface CompExtDTMapper {
|
||||
|
||||
/**
|
||||
* 根据主表id,查询拓展表数据
|
||||
*
|
||||
* @param tableName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> listCompExtDT(@Param("tableName") String tableName, @Param("id") long id, @Param("fields") String fields);
|
||||
|
||||
/**
|
||||
* 根据mainId删除指定明细表数据
|
||||
*
|
||||
* @param tableName
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
int deleteByMainID(@Param("tableName") String tableName, @Param("mainId") String mainId);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.comp.CompExtDTMapper">
|
||||
<delete id="deleteByMainID">
|
||||
delete
|
||||
from ${tableName}
|
||||
where mainid = #{id}
|
||||
|
||||
</delete>
|
||||
|
||||
<select id="listCompExtDT" resultType="java.util.Map">
|
||||
select ${fields}
|
||||
from ${tableName}
|
||||
where mainid = #{id}
|
||||
and delete_type = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.engine.organization.mapper.comp;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface CompExtMapper {
|
||||
|
||||
/**
|
||||
* 根据主表id,查询主表拓展表数据
|
||||
*
|
||||
* @param tableName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listCompExt(@Param("tableName") String tableName, @Param("fields") String fields, @Param("id") long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.comp.CompExtMapper">
|
||||
|
||||
|
||||
<select id="listCompExt" resultType="map">
|
||||
select ${fields}
|
||||
from ${tableName}
|
||||
where delete_type = 0
|
||||
and id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
|
|
@ -55,13 +54,21 @@ public interface CompMapper {
|
|||
|
||||
|
||||
/**
|
||||
* 根据主表id,查询拓展表数据
|
||||
* 保存公司/分部基础信息
|
||||
*
|
||||
* @param tableName
|
||||
* @param id
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listCompExtDT(@Param("tableName") String tableName, @Param("id") long id, @Param("fields") String fields);
|
||||
int insertIgnoreNull(CompPO compPO);
|
||||
|
||||
|
||||
/**
|
||||
* 更新主表内容
|
||||
*
|
||||
* @param compPO
|
||||
* @return
|
||||
*/
|
||||
int updateBaseComp(CompPO compPO);
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
|
|
|
|||
|
|
@ -50,6 +50,89 @@
|
|||
and NVL(parent_company,'0')='0'
|
||||
</sql>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.comp.po.CompPO" keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_comp
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
comp_no,
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
comp_name,
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
comp_name_short,
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
parent_company,
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
org_code,
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
industry,
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
comp_principal,
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
description,
|
||||
</if>
|
||||
forbidden_tag,
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="compNo != null ">
|
||||
#{compNo},
|
||||
</if>
|
||||
<if test="compName != null ">
|
||||
#{compName},
|
||||
</if>
|
||||
<if test="compNameShort != null ">
|
||||
#{compNameShort},
|
||||
</if>
|
||||
<if test="parentCompany != null ">
|
||||
#{parentCompany},
|
||||
</if>
|
||||
<if test="orgCode != null ">
|
||||
#{orgCode},
|
||||
</if>
|
||||
<if test="industry != null ">
|
||||
#{industry},
|
||||
</if>
|
||||
<if test="compPrincipal != null ">
|
||||
#{compPrincipal},
|
||||
</if>
|
||||
<if test="description != null ">
|
||||
#{description},
|
||||
</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
|
|
@ -94,14 +177,6 @@
|
|||
from jcl_org_comp t where comp_no = #{compNo} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listCompExtDT" resultType="java.util.Map">
|
||||
select ${fields}
|
||||
from ${tableName}
|
||||
where mainid = #{id}
|
||||
and delete_type = 0
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
|
||||
update jcl_org_comp
|
||||
<set>
|
||||
|
|
@ -120,4 +195,8 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateBaseComp">
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -21,6 +21,14 @@ public interface CompService {
|
|||
*/
|
||||
Map<String, Object> listPage(CompSearchParam params);
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int saveBaseComp(CompSearchParam params);
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
|
|
@ -29,6 +37,15 @@ public interface CompService {
|
|||
int updateForbiddenTagById(CompSearchParam params);
|
||||
|
||||
|
||||
/**
|
||||
* 更新分部主表、拓展表、明细表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int updateComp(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID批量删除
|
||||
*
|
||||
|
|
@ -67,6 +84,14 @@ public interface CompService {
|
|||
*/
|
||||
Map<String, Object> getCompBaseForm(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取拓展表单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getCompExtForm(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* 获取新增表单
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
|
|
@ -16,6 +17,8 @@ import com.engine.organization.entity.comp.param.CompSearchParam;
|
|||
import com.engine.organization.entity.comp.po.CompPO;
|
||||
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.mapper.comp.CompExtDTMapper;
|
||||
import com.engine.organization.mapper.comp.CompExtMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendGroupMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
|
|
@ -30,6 +33,7 @@ import com.engine.organization.util.page.PageUtil;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.crm.Maint.SectorInfoComInfo;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -54,6 +58,14 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
|
||||
}
|
||||
|
||||
private CompExtDTMapper getCompExtDTMapper() {
|
||||
return MapperProxyFactory.getProxy(CompExtDTMapper.class);
|
||||
}
|
||||
|
||||
private CompExtMapper getCompExtMapper() {
|
||||
return MapperProxyFactory.getProxy(CompExtMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(CompSearchParam params) {
|
||||
|
|
@ -93,12 +105,50 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveBaseComp(CompSearchParam params) {
|
||||
List<CompPO> list = getCompMapper().listByNo(Util.null2String(params.getCompNo()));
|
||||
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
|
||||
return getCompMapper().insertIgnoreNull(compPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateForbiddenTagById(CompSearchParam params) {
|
||||
CompPO compPO = CompPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
||||
return getCompMapper().updateForbiddenTagById(compPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateComp(Map<String, Object> params) {
|
||||
System.out.println(params);
|
||||
CompSearchParam param = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
|
||||
System.out.println(param);
|
||||
|
||||
// TODO 更新主表数据
|
||||
|
||||
// 获取分部明细表的所有拓展列
|
||||
String tableName = "JCL_ORG_COMPEXT_DT1";
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", tableName);
|
||||
List<String> dtFields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
||||
|
||||
List<Map<String, Object>> insertList = new ArrayList<>();
|
||||
System.out.println(dtFields);
|
||||
// TODO 删除明细表数据
|
||||
// 处理明细表数据
|
||||
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String dtField : dtFields) {
|
||||
map.put(dtField, params.get(dtField + "_" + i));
|
||||
}
|
||||
insertList.add(map);
|
||||
}
|
||||
System.out.println(insertList);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
||||
|
|
@ -186,7 +236,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
|
||||
@Override
|
||||
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
|
||||
OrganizationAssert.notNull(params.get("operateType"), "请标识操作类型");
|
||||
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
// 编号
|
||||
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "compNo");
|
||||
|
|
@ -207,7 +257,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
// 负责人
|
||||
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "负责人", "1", "compPrincipal", "");
|
||||
// 说明
|
||||
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "description");
|
||||
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "说明", "description");
|
||||
|
||||
|
||||
conditionItems.add(compNoItem);
|
||||
|
|
@ -219,44 +269,43 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
conditionItems.add(compPrincipalItem);
|
||||
conditionItems.add(descriptionItem);
|
||||
|
||||
// 0 查看 1新增 2编辑
|
||||
int operateType = Integer.parseInt((String) params.get("operateType"));
|
||||
// 2编辑 1查看
|
||||
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
|
||||
long id = Long.parseLong((String) params.get("id"));
|
||||
// 编辑、查看状态赋值,设置只读状态
|
||||
if (1 != operateType) {
|
||||
// 赋值
|
||||
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());
|
||||
// 赋值
|
||||
CompPO compPO = getCompMapper().listById(id);
|
||||
OrganizationAssert.notNull(compPO, "数据不存在或数据已删除");
|
||||
compNoItem.setValue(compPO.getCompNo());
|
||||
compNameItem.setValue(compPO.getCompName());
|
||||
compNameShortItem.setValue(compPO.getCompNameShort());
|
||||
|
||||
// 查看,全部置位只读
|
||||
if (0 == operateType) {
|
||||
for (SearchConditionItem item : conditionItems) {
|
||||
item.setViewAttr(1);
|
||||
}
|
||||
// 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());
|
||||
|
||||
// 查看,全部置位只读
|
||||
if (1 == viewAttr) {
|
||||
for (SearchConditionItem item : conditionItems) {
|
||||
item.setViewAttr(viewAttr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +325,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
resultMap.put("buttons", buttonsMap);
|
||||
resultMap.put("conditions", conditionsMap);
|
||||
resultMap.put("id", id);
|
||||
resultMap.put("tables", getExtendTables(id, operateType, false));
|
||||
resultMap.put("tables", getExtendTables(id, viewAttr, false));
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
apiDatas.put("result", resultMap);
|
||||
|
|
@ -284,6 +333,67 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompExtForm(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
// 分组名称
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
// 2编辑 1查看
|
||||
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
|
||||
long id = Long.parseLong((String) params.get("id"));
|
||||
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
|
||||
String tableName = "JCL_ORG_COMPEXT";
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", groupId, tableName);
|
||||
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
||||
Map<String, Object> compExtMap = getCompExtMapper().listCompExt(tableName, fields, id);
|
||||
|
||||
// 组装拓展页内容
|
||||
for (ExtendInfoPO extendInfoPO : infoPOList) {
|
||||
SearchConditionItem item = null;
|
||||
switch (ExtendInfoBO.getFieldhtmltype(extendInfoPO.getControlType() + "")) {
|
||||
case INPUT:
|
||||
item = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
|
||||
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
|
||||
break;
|
||||
case TEXTAREA:
|
||||
item = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 1, 60, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
|
||||
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
|
||||
break;
|
||||
case BROWSER:
|
||||
// TODO
|
||||
// item=OrganizationFormItemUtil.browserItem()
|
||||
break;
|
||||
case CHECKBOX:
|
||||
item = OrganizationFormItemUtil.checkboxItem(user, 2, 16, 1, true, extendInfoPO.getFieldNameDesc(), extendInfoPO.getFieldName());
|
||||
item.setValue(compExtMap.get(extendInfoPO.getFieldName()));
|
||||
break;
|
||||
case SELECT:
|
||||
// TODO
|
||||
// item = OrganizationFormItemUtil.selectItem();
|
||||
break;
|
||||
case FILEUPLOAD:
|
||||
case TEXT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (null != item) {
|
||||
// 根据viewAttr设置编辑或只读
|
||||
item.setViewAttr(viewAttr);
|
||||
// 是否必填
|
||||
if (1 == extendInfoPO.getIsrequired()) {
|
||||
item.setViewAttr(3);
|
||||
item.setRules("required|string");
|
||||
}
|
||||
conditionItems.add(item);
|
||||
}
|
||||
}
|
||||
addGroups.add(new SearchConditionGroup(getExtendGroupMapper().getGroupNameById(groupId), true, conditionItems));
|
||||
apiDatas.put("condition", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCompSaveForm() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
|
@ -308,7 +418,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
// 负责人
|
||||
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "负责人", "1", "compPrincipal", "");
|
||||
// 说明
|
||||
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "description");
|
||||
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "说明", "description");
|
||||
|
||||
conditionItems.add(compNoItem);
|
||||
conditionItems.add(compNameItem);
|
||||
|
|
@ -378,7 +488,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> getExtendTables(long id, int operateType, boolean showLabel) {
|
||||
private List<Map<String, Object>> getExtendTables(long id, int viewAttr, boolean showLabel) {
|
||||
List<Map<String, Object>> tables = new ArrayList<>();
|
||||
String tableName = "JCL_ORG_COMPEXT_DT1";
|
||||
// 查询所有分布模块,拓展明细表信息
|
||||
|
|
@ -390,11 +500,11 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
tableMap.put("hide", false);
|
||||
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + ""));
|
||||
Map<String, Object> tabinfoMap = new HashMap<>();
|
||||
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(entry.getValue(), operateType, showLabel));
|
||||
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(entry.getValue(), viewAttr, showLabel));
|
||||
tabinfoMap.put("rownum", "rownum");
|
||||
|
||||
String fields = entry.getValue().stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
||||
tabinfoMap.put("datas", getCompMapper().listCompExtDT(tableName, id, fields));
|
||||
tabinfoMap.put("datas", getCompExtDTMapper().listCompExtDT(tableName, id, fields));
|
||||
tableMap.put("tabinfo", tabinfoMap);
|
||||
tables.add(tableMap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,27 @@ public class CompController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveBaseComp")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveBaseComp(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody CompSearchParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCompWrapper(user).saveBaseComp(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
|
|
@ -71,6 +92,26 @@ public class CompController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/updateComp")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateComp(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getCompWrapper(user).updateComp(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID批量删除数据
|
||||
|
|
@ -151,6 +192,34 @@ public class CompController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拓展表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getCompExtForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getCompExtForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getCompWrapper(user).getCompExtForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getCompSaveForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ public class CompWrapper extends Service {
|
|||
return getCompService(user).listPage(params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存公司/分部基础信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public int saveBaseComp(CompSearchParam params) {
|
||||
return getCompService(user).saveBaseComp(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
|
|
@ -40,6 +51,16 @@ public class CompWrapper extends Service {
|
|||
return getCompService(user).updateForbiddenTagById(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分部主表、拓展表、明细表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public int updateComp(Map<String, Object> params) {
|
||||
return getCompService(user).updateComp(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID批量删除
|
||||
*
|
||||
|
|
@ -78,6 +99,16 @@ public class CompWrapper extends Service {
|
|||
return getCompService(user).getCompBaseForm(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拓展表单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getCompExtForm(Map<String, Object> params) {
|
||||
return getCompService(user).getCompExtForm(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue