You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.5 KiB
Java
87 lines
3.5 KiB
Java
package com.engine.organization.service.impl;
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
import com.engine.core.impl.Service;
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
|
|
import com.engine.organization.mapper.employee.EmployeeMapper;
|
|
import com.engine.organization.service.ManagerDetachService;
|
|
import com.engine.organization.util.HasRightUtil;
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @Author weaver_cl
|
|
* @Description:
|
|
* @Date 2022/10/21
|
|
* @Version V1.0
|
|
**/
|
|
public class ManagerDetachServiceImpl extends Service implements ManagerDetachService {
|
|
|
|
|
|
private static final String RIGHT_NAME = "MangerDeatch:All";
|
|
|
|
@Override
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
|
resultMap.put("hasRight", hasRight);
|
|
if (!hasRight) {
|
|
return resultMap;
|
|
}
|
|
OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.class);
|
|
String sqlWhere = buildSqlWhere(params);
|
|
table.setSqlwhere(sqlWhere);
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
result.putAll(table.makeDataResult());
|
|
result.success();
|
|
resultMap.putAll(result.getResultMap());
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
@Override
|
|
public Map<String, Object> getForm(Integer id) {
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
List<SearchConditionItem> selectItems = new ArrayList<>();
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "管理员", "1", "ecManager", "");
|
|
ecManager.setRules("required|string");
|
|
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "可维护机构", "194", "ecRolelevel", "");
|
|
ecRolelevel.setRules("required|string");
|
|
SearchConditionItem module = OrganizationFormItemUtil.checkboxItem(user, 2, 16, 1, false, "可管理模块", "module");
|
|
if (id != null) {
|
|
//todo
|
|
}
|
|
selectItems.add(ecManager);
|
|
selectItems.add(ecRolelevel);
|
|
selectItems.add(module);
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
|
apiDatas.put("condition", addGroups);
|
|
return apiDatas;
|
|
}
|
|
|
|
private String buildSqlWhere(Map<String, Object> params) {
|
|
String sqlWhere = " where 1 = 1";
|
|
String lastName = (String) params.get("ecManager");
|
|
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
|
|
String ecManager = StringUtils.join(resourceIds,",");
|
|
if (StringUtils.isNotBlank(ecManager)) {
|
|
sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
|
}
|
|
String ecRolelevel = (String) params.get("ecRolelevel");
|
|
if (StringUtils.isNotBlank(ecRolelevel)) {
|
|
sqlWhere += " AND ec_rolelevel in ("+ecRolelevel+")";
|
|
}
|
|
return sqlWhere;
|
|
}
|
|
}
|