diff --git a/src/com/engine/xmg/service/impl/RecruitDemandServiceImpl.java b/src/com/engine/xmg/service/impl/RecruitDemandServiceImpl.java index 2cac895..0f496ac 100644 --- a/src/com/engine/xmg/service/impl/RecruitDemandServiceImpl.java +++ b/src/com/engine/xmg/service/impl/RecruitDemandServiceImpl.java @@ -5,6 +5,8 @@ import com.engine.core.impl.Service; import com.engine.organization.component.OrganizationWeaTable; import com.engine.xmg.entity.demand.vo.RecruitDemandTable; import com.engine.xmg.service.RecruitDemandService; +import org.apache.commons.lang.StringUtils; +import weaver.general.Util; import java.util.HashMap; import java.util.Map; @@ -18,16 +20,47 @@ public class RecruitDemandServiceImpl extends Service implements RecruitDemandSe @Override public Map getRecruitDemandReport(Map param) { - Map resultMap = new HashMap<>(); - - // 刷新引用状态 OrganizationWeaTable table = new OrganizationWeaTable<>(user, RecruitDemandTable.class); - String sqlWhere = " where 1=1 "; + String sqlWhere = buildSqlWhere(param); table.setSqlwhere(sqlWhere); WeaResultMsg result = new WeaResultMsg(false); result.putAll(table.makeDataResult()); result.success(); - resultMap.putAll(result.getResultMap()); - return resultMap; + return new HashMap<>(result.getResultMap()); + } + + + /** + * 构建sql where条件 + * + * @param param + * @return + */ + private String buildSqlWhere(Map param) { + String sql = " where 1=1 "; + String resourceId = Util.null2String(param.get("resourceId")); + String departmentId = Util.null2String(param.get("departmentId")); + String dateRange = Util.null2String(param.get("dateRange")); + String jobTitle = Util.null2String(param.get("jobTitle")); + + if (StringUtils.isNotBlank(resourceId)) { + sql += " and t.sqr = '" + resourceId + "'"; + } + + if (StringUtils.isNotBlank(departmentId)) { + sql += " and t.szbm = '" + departmentId + "'"; + } + + if (StringUtils.isNotBlank(jobTitle)) { + sql += " and t.gw = '" + jobTitle + "'"; + } + + if (StringUtils.isNotBlank(dateRange)) { + String[] split = dateRange.split(","); + if (split.length == 2) { + sql += "t.sqsj >= '" + split[0] + "' and t.sqsj <='" + split[1] + "'"; + } + } + return sql; } }