新增编辑类型
This commit is contained in:
parent
068c446765
commit
f4f7038611
|
|
@ -28,7 +28,6 @@ public class ExtendGroupBO {
|
|||
|
||||
List<TypeTreeVO> 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<Long, List<TypeTreeVO>> 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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,71 @@
|
|||
and t.pid= #{pid}
|
||||
</select>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.extend.po.ExtendGroupPO"
|
||||
keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_field_extendgroup
|
||||
<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="extendType != null ">
|
||||
extend_type,
|
||||
</if>
|
||||
<if test="groupName != null ">
|
||||
group_name,
|
||||
</if>
|
||||
<if test="pid != null ">
|
||||
pid,
|
||||
</if>
|
||||
<if test="isShow != null ">
|
||||
is_show,
|
||||
</if>
|
||||
</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="extendType != null ">
|
||||
#{extendType},
|
||||
</if>
|
||||
<if test="groupName != null ">
|
||||
#{groupName},
|
||||
</if>
|
||||
<if test="pid != null ">
|
||||
#{pid},
|
||||
</if>
|
||||
<if test="isShow != null ">
|
||||
#{isShow},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update" >
|
||||
update jcl_field_extendgroup
|
||||
<set>
|
||||
group_name=#{name},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -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<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType);
|
||||
|
||||
int countFieldsByGroupId(@Param("groupId") Long groupId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,12 @@ public interface FieldDefinedService {
|
|||
|
||||
|
||||
/**
|
||||
* 新增类型树
|
||||
* 新增或编辑类型树
|
||||
* @param moduleTypeEnum
|
||||
* @param fieldTypeTreeParam
|
||||
* @return
|
||||
*/
|
||||
void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam);
|
||||
void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue