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.
71 lines
2.4 KiB
Java
71 lines
2.4 KiB
Java
3 years ago
|
package com.engine.organization.service.impl;
|
||
|
|
||
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
||
|
import com.engine.core.impl.Service;
|
||
|
import com.engine.organization.component.OrganizationWeaTable;
|
||
|
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||
|
import com.engine.organization.entity.hrmresource.vo.ResourceBasicInfoVO;
|
||
|
import com.engine.organization.service.ResourceBasicInfoService;
|
||
|
import com.engine.organization.util.HasRightUtil;
|
||
|
import com.engine.organization.util.db.DBType;
|
||
|
import org.apache.commons.lang3.StringUtils;
|
||
|
import weaver.conn.RecordSet;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* @Author weaver_cl
|
||
|
* @Description:
|
||
|
* @Date 2022/8/23
|
||
|
* @Version V1.0
|
||
|
**/
|
||
|
public class ResourceBasicInfoServiceImpl extends Service implements ResourceBasicInfoService {
|
||
|
|
||
|
private static final String RIGHT_NAME = "ResourceBasicInfo: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<ResourceBasicInfoVO> table = new OrganizationWeaTable<>(user,ResourceBasicInfoVO.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 List<TypeTreeVO> getTreeData() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
private String buildSqlWhere(Map<String, Object> params) {
|
||
|
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||
|
String sqlWhere = " where t.fdelete = 0 ";
|
||
|
String fclassid = (String) params.get("fclassid");
|
||
|
if (StringUtils.isNotBlank(fclassid) && !"-1".equals(fclassid)) {
|
||
|
sqlWhere += " AND t.fclassid = '" + fclassid + "'";
|
||
|
}
|
||
|
String fno = (String) params.get("fno");
|
||
|
if (StringUtils.isNotBlank(fno)) {
|
||
|
sqlWhere += " AND t.fno = '" + fno + "'";
|
||
|
}
|
||
|
String fname = (String) params.get("fname");
|
||
|
if (StringUtils.isNotBlank(fname)) {
|
||
|
sqlWhere += " AND t.fname " + dbType.like(fname);
|
||
|
}
|
||
|
|
||
|
return sqlWhere;
|
||
|
}
|
||
|
}
|