部门管理 新增表单 数据保存
This commit is contained in:
parent
12e435c1cb
commit
cd6121f0b0
|
|
@ -30,7 +30,23 @@ public interface DepartmentService {
|
|||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(DeptSearchParam param);
|
||||
Map<String, Object> listPage(DeptSearchParam param);
|
||||
|
||||
/**
|
||||
* 保存部门基础信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int saveBaseComp(DeptSearchParam params);
|
||||
|
||||
|
||||
/**
|
||||
* 获取新增表单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getSaveForm();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
|
|
@ -12,6 +14,7 @@ import com.engine.organization.entity.department.po.DepartmentPO;
|
|||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.page.Column;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
|
|
@ -19,7 +22,8 @@ import com.engine.organization.util.page.PageUtil;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.general.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -29,6 +33,9 @@ import java.util.List;
|
|||
**/
|
||||
public class DepartmentServiceImpl extends Service implements DepartmentService {
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
|
||||
|
|
@ -38,7 +45,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptListByCompId(param.getParentComp());
|
||||
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
|
||||
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS);
|
||||
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS,SingleDeptTreeVO.class);
|
||||
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class);
|
||||
pageInfos.setTotal(pageInfo.getTotal());
|
||||
pageInfos.setPageNum(param.getCurrent());
|
||||
pageInfos.setPageSize(param.getPageSize());
|
||||
|
|
@ -51,10 +58,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
Map<String, Object> datas = new HashMap<>();
|
||||
PageUtil.start(param.getCurrent(), param.getPageSize());
|
||||
List<DepartmentPO> parentList = getDepartmentMapper().listParent();
|
||||
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(parentList);
|
||||
List<DepartmentPO> list = new ArrayList<>();
|
||||
list.addAll(parentList);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(parentList)) {
|
||||
if (CollectionUtils.isNotEmpty(parentList)) {
|
||||
// 递归查询子数据
|
||||
getChildPOs(parentList, list);
|
||||
}
|
||||
|
|
@ -64,7 +72,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
|
||||
List<DepartmentListDTO> departmentListDTOS = DepartmentBO.buildDeptDTOList(list, filterList);
|
||||
PageInfo<DepartmentListDTO> pageInfos = new PageInfo<>(departmentListDTOS, DepartmentListDTO.class);
|
||||
pageInfos.setTotal(pageInfos.getTotal());
|
||||
pageInfos.setTotal(pageInfo.getTotal());
|
||||
pageInfos.setPageNum(param.getCurrent());
|
||||
pageInfos.setPageSize(param.getPageSize());
|
||||
|
||||
|
|
@ -85,6 +93,53 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveBaseComp(DeptSearchParam params) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSaveForm() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
// 编号
|
||||
SearchConditionItem deptNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "deptNo");
|
||||
deptNoItem.setRules("required|string");
|
||||
// 名称
|
||||
SearchConditionItem deptNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "deptName");
|
||||
deptNameItem.setRules("required|string");
|
||||
// 简称
|
||||
SearchConditionItem deptNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "简称", "deptNameShort");
|
||||
deptNameShortItem.setRules("required|string");
|
||||
// TODO 自定义按钮
|
||||
// 所属分部
|
||||
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
||||
//上级部门
|
||||
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "161", "parentDept", "deptBrowser");
|
||||
// 部门负责人
|
||||
SearchConditionItem deptPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门负责人", "1", "deptPrincipal", "");
|
||||
// 显示顺序
|
||||
SearchConditionItem showOrderItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "showOrder");
|
||||
// 说明
|
||||
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "说明", "description");
|
||||
|
||||
conditionItems.add(deptNoItem);
|
||||
conditionItems.add(deptNameItem);
|
||||
conditionItems.add(deptNameShortItem);
|
||||
conditionItems.add(compBrowserItem);
|
||||
conditionItems.add(deptBrowserItem);
|
||||
conditionItems.add(deptPrincipalItem);
|
||||
conditionItems.add(showOrderItem);
|
||||
conditionItems.add(descriptionItem);
|
||||
|
||||
|
||||
addGroups.add(new SearchConditionGroup("基本信息", true, conditionItems));
|
||||
apiDatas.put("condition", addGroups);
|
||||
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过搜索条件过滤list数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import weaver.hrm.User;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
|
@ -62,4 +63,24 @@ public class DepartmentController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSaveForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,13 @@ public class DepartmentWrapper extends Service {
|
|||
public Map<String, Object> listPage(DeptSearchParam param) {
|
||||
return getDepartmentService(user).listPage(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取保存表单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSaveForm() {
|
||||
return getDepartmentService(user).getSaveForm();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue