commit
11cd25a501
|
|
@ -24,6 +24,14 @@ public interface CompExtDTMapper {
|
|||
@MapKey("id")
|
||||
List<Map<String, Object>> listCompExtDT(@Param("tableName") String tableName, @Param("id") long id, @Param("fields") String fields);
|
||||
|
||||
/**
|
||||
* 插入主表明细表
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
int insertCompExtDT(@Param("tableName") String tableName, @Param("map") Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 根据mainId删除指定明细表数据
|
||||
*
|
||||
|
|
@ -31,5 +39,5 @@ public interface CompExtDTMapper {
|
|||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
int deleteByMainID(@Param("tableName") String tableName, @Param("mainId") String mainId);
|
||||
int deleteByMainID(@Param("tableName") String tableName, @Param("mainId") long mainId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,24 @@
|
|||
<?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">
|
||||
|
||||
|
||||
<insert id="insertCompExtDT" parameterType="java.util.Map">
|
||||
insert into ${tableName} (
|
||||
<foreach collection="map" item="value" index="key" separator=",">
|
||||
${key}
|
||||
</foreach>
|
||||
)
|
||||
values (
|
||||
<foreach collection="map" item="value" index="key" separator=",">
|
||||
#{value}
|
||||
</foreach>
|
||||
)
|
||||
</insert>
|
||||
<delete id="deleteByMainID">
|
||||
delete
|
||||
from ${tableName}
|
||||
where mainid = #{id}
|
||||
|
||||
where mainid = #{mainId}
|
||||
</delete>
|
||||
|
||||
<select id="listCompExtDT" resultType="java.util.Map">
|
||||
|
|
|
|||
|
|
@ -195,8 +195,20 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateBaseComp">
|
||||
|
||||
<update id="updateBaseComp" parameterType="com.engine.organization.entity.comp.po.CompPO">
|
||||
update jcl_org_comp
|
||||
<set>
|
||||
creator=#{creator},
|
||||
update_time=#{updateTime},
|
||||
comp_name=#{compName},
|
||||
comp_name_short=#{compNameShort},
|
||||
parent_company=#{parentCompany},
|
||||
org_code=#{orgCode},
|
||||
industry=#{industry},
|
||||
comp_principal=#{compPrincipal},
|
||||
description=#{description},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -121,11 +121,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
|
||||
@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 更新主表数据
|
||||
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
|
||||
// 更新主表数据
|
||||
CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID());
|
||||
int updateBaseComp = getCompMapper().updateBaseComp(compPO);
|
||||
|
||||
// 获取分部明细表的所有拓展列
|
||||
String tableName = "JCL_ORG_COMPEXT_DT1";
|
||||
|
|
@ -133,8 +132,8 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
List<String> dtFields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
||||
|
||||
List<Map<String, Object>> insertList = new ArrayList<>();
|
||||
System.out.println(dtFields);
|
||||
// TODO 删除明细表数据
|
||||
// 删除明细表数据
|
||||
getCompExtDTMapper().deleteByMainID(tableName, compPO.getId());
|
||||
// 处理明细表数据
|
||||
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
|
|
@ -142,11 +141,19 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
for (String dtField : dtFields) {
|
||||
map.put(dtField, params.get(dtField + "_" + i));
|
||||
}
|
||||
map.put("mainid", compPO.getId());
|
||||
map.put("creator", compPO.getCreator());
|
||||
map.put("delete_type", compPO.getDeleteType());
|
||||
map.put("create_time", compPO.getCreateTime());
|
||||
map.put("update_time", compPO.getUpdateTime());
|
||||
insertList.add(map);
|
||||
}
|
||||
System.out.println(insertList);
|
||||
// 更新拓展表数据
|
||||
for (Map<String, Object> map : insertList) {
|
||||
getCompExtDTMapper().insertCompExtDT(tableName, map);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return updateBaseComp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -239,8 +246,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
// 编号
|
||||
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "compNo");
|
||||
compNoItem.setRules("required|string");
|
||||
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "编号", "compNo");
|
||||
// 名称
|
||||
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "compName");
|
||||
compNameItem.setRules("required|string");
|
||||
|
|
|
|||
Loading…
Reference in New Issue