From 501c7a4dd2c3f199d5e5d9c96073531a5cae5771 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Fri, 14 Mar 2025 14:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=9B=E8=81=98=E9=9C=80=E6=B1=82=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=20=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/RecruitDemandServiceImpl.java | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) 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; } }