diff --git a/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java b/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java index cf4f9b6a..3b54528e 100644 --- a/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java +++ b/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java @@ -28,7 +28,6 @@ public class ExtendGroupBO { List typeTreeVOS = extendGroupPOS.stream().map(e -> TypeTreeVO.builder() - .addChild(e.getId() >= 0) .canClick(true) .domid(String.valueOf(e.getId())) .hasGroup(isHasGroup(e.getId())) @@ -42,7 +41,8 @@ public class ExtendGroupBO { //获取非一级 Map> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO :: getPid)); - return typeTreeVOS.stream().peek(e -> {e.setChilds(collects.get(e.getKey())); e.setHaschild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);}).filter(item -> item.getPid() == null).collect(Collectors.toList()); + return typeTreeVOS.stream().peek(e -> {e.setChilds(collects.get(e.getKey())); e.setHaschild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0); + e.setAddChild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);}).filter(item -> item.getPid() == null).collect(Collectors.toList()); } diff --git a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.java b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.java index 5e9f00fb..2ecd1227 100644 --- a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.java +++ b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.java @@ -1,6 +1,7 @@ package com.engine.organization.mapper.extend; import com.engine.organization.entity.extend.po.ExtendGroupPO; +import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam; import org.apache.ibatis.annotations.Param; import java.util.Collection; @@ -44,4 +45,11 @@ public interface ExtendGroupMapper { * @return */ String getGroupNameById(@Param("id") String id); + + + + void insertIgnoreNull(ExtendGroupPO extendGroupPO); + + + void update(@Param("id")Long id, @Param("name")String name); } diff --git a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml index 16fa249a..fd6efbcb 100644 --- a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml +++ b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml @@ -60,5 +60,71 @@ and t.pid= #{pid} + + INSERT INTO jcl_field_extendgroup + + + creator, + + + delete_type, + + + create_time, + + + update_time, + + + + extend_type, + + + group_name, + + + pid, + + + is_show, + + + + + #{creator}, + + + #{deleteType}, + + + #{createTime}, + + + #{updateTime}, + + + #{extendType}, + + + #{groupName}, + + + #{pid}, + + + #{isShow}, + + + + + + update jcl_field_extendgroup + + group_name=#{name}, + + WHERE id = #{id} AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/extend/ExtendInfoMapper.java b/src/com/engine/organization/mapper/extend/ExtendInfoMapper.java index fba88e97..16e5d2fe 100644 --- a/src/com/engine/organization/mapper/extend/ExtendInfoMapper.java +++ b/src/com/engine/organization/mapper/extend/ExtendInfoMapper.java @@ -1,5 +1,6 @@ package com.engine.organization.mapper.extend; +import com.engine.organization.entity.extend.po.ExtendGroupPO; import com.engine.organization.entity.extend.po.ExtendInfoPO; import org.apache.ibatis.annotations.Param; @@ -12,15 +13,10 @@ import java.util.List; * @version: 1.0 */ public interface ExtendInfoMapper { - /** - * 列表查询 - * - * @param extendType - * @param extendGroupId - * @param tableName - * @return - */ + List listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType); int countFieldsByGroupId(@Param("groupId") Long groupId); + + } diff --git a/src/com/engine/organization/service/FieldDefinedService.java b/src/com/engine/organization/service/FieldDefinedService.java index 6a5cdd02..82f386ee 100644 --- a/src/com/engine/organization/service/FieldDefinedService.java +++ b/src/com/engine/organization/service/FieldDefinedService.java @@ -59,11 +59,12 @@ public interface FieldDefinedService { /** - * 新增类型树 + * 新增或编辑类型树 * @param moduleTypeEnum * @param fieldTypeTreeParam * @return */ - void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam); + void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam); + } diff --git a/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java b/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java index 10a95554..dfb267aa 100644 --- a/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java +++ b/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java @@ -10,6 +10,7 @@ import com.engine.organization.entity.extend.po.ExtendGroupPO; import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam; import com.engine.organization.entity.fieldset.vo.TypeTreeVO; +import com.engine.organization.enums.DeleteTypeEnum; import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.mapper.extend.ExtendInfoMapper; @@ -147,12 +148,28 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ return datas; } - public void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { - buildExtentGroup(moduleTypeEnum,fieldTypeTreeParam); + public void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { + if (fieldTypeTreeParam.getId() == null) { + ExtendGroupPO extendGroupPO = buildExtentGroupType(moduleTypeEnum, fieldTypeTreeParam); + MapperProxyFactory.getProxy(ExtendGroupMapper.class).insertIgnoreNull(extendGroupPO); + }else { + MapperProxyFactory.getProxy(ExtendGroupMapper.class).update(fieldTypeTreeParam.getId(),fieldTypeTreeParam.getName()); + } + } - private void buildExtentGroup(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { - + + private ExtendGroupPO buildExtentGroupType(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { + return ExtendGroupPO.builder() + .extendType(moduleTypeEnum.getValue()) + .groupName(fieldTypeTreeParam.getName()) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .createTime(new Date()) + .updateTime(new Date()) + .pid(fieldTypeTreeParam.getParentid()) + .isShow(fieldTypeTreeParam.getIsShow() == null ? "1" : fieldTypeTreeParam.getIsShow()).build(); + } diff --git a/src/com/engine/organization/web/FieldDefinedController.java b/src/com/engine/organization/web/FieldDefinedController.java index 552a6717..8ac9d72d 100644 --- a/src/com/engine/organization/web/FieldDefinedController.java +++ b/src/com/engine/organization/web/FieldDefinedController.java @@ -57,30 +57,19 @@ public class FieldDefinedController { } @POST - @Path("/{moduleTypeEnum}/addTree") + @Path("/{moduleTypeEnum}/changeTree") @Produces(MediaType.APPLICATION_JSON) - public ReturnResult addTree(@Context HttpServletRequest request, @Context HttpServletResponse response, + public ReturnResult changeTree(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum, @RequestBody FieldTypeTreeParam fieldTypeTreeParam) { try { User user = HrmUserVarify.getUser(request, response); - return getFieldDefinedWrapper(user).addTree(moduleTypeEnum,fieldTypeTreeParam); + return getFieldDefinedWrapper(user).changeTree(moduleTypeEnum,fieldTypeTreeParam); } catch (Exception e) { return ReturnResult.exceptionHandle(e.getMessage()); } } - @POST - @Path("/{moduleTypeEnum}/editTree") - @Produces(MediaType.APPLICATION_JSON) - public ReturnResult editTree(@Context HttpServletRequest request, @Context HttpServletResponse response, - @PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum,@RequestBody FieldTypeTreeParam fieldTypeTreeParam) { - try { - User user = HrmUserVarify.getUser(request, response); - return getFieldDefinedWrapper(user).getTree(moduleTypeEnum); - } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); - } - } + @GET @Path("/getTabInfo") diff --git a/src/com/engine/organization/wrapper/FieldDefinedWrapper.java b/src/com/engine/organization/wrapper/FieldDefinedWrapper.java index 0aa5b93e..02622852 100644 --- a/src/com/engine/organization/wrapper/FieldDefinedWrapper.java +++ b/src/com/engine/organization/wrapper/FieldDefinedWrapper.java @@ -61,8 +61,10 @@ public class FieldDefinedWrapper extends Service { } - public ReturnResult addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { - getFieldDefinedService(user).addTree(moduleTypeEnum,fieldTypeTreeParam); + public ReturnResult changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) { + getFieldDefinedService(user).changeTree(moduleTypeEnum,fieldTypeTreeParam); return ReturnResult.successed(); } + + }