diff --git a/src/com/api/browser/service/impl/JobBrowserService.java b/src/com/api/browser/service/impl/JobBrowserService.java index a229bb30..a5f7e59a 100644 --- a/src/com/api/browser/service/impl/JobBrowserService.java +++ b/src/com/api/browser/service/impl/JobBrowserService.java @@ -26,6 +26,8 @@ import org.apache.commons.lang.StringUtils; import weaver.conn.RecordSet; import weaver.general.Util; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.*; import java.util.stream.Collectors; @@ -70,6 +72,45 @@ public class JobBrowserService extends BrowserService { return resultMap; } + @Override + public Map browserAutoComplete(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { + Map apidatas = new HashMap<>(); + String q = Util.null2String(httpServletRequest.getParameter("q")); + List sqlParams = new ArrayList<>(); + String keyword = ""; + if (q.length() > 0) keyword = "%" + q + "%"; + RecordSet rs = new RecordSet(); + String sqlwhere = " where t.delete_type = 0 "; + String backfields = "t.id, t.job_no, h.jobtitlename as name, t.sequence_id, t.scheme_id , t.grade_id , t.level_id "; + String fromSql = "FROM jcl_org_job t left join hrmjobtitles h on t.ec_jobTitle = h.id "; + String orderby = " order by t.id "; + sqlwhere += " "; + DetachUtil detachUtil = new DetachUtil(user); + if (detachUtil.isDETACH()) { + sqlwhere += " AND t.ec_company in (" + detachUtil.getJclRoleLevels() + ")"; + } + if (!"".equals(keyword)) { + sqlwhere += " and (h.jobtitlemark like ? or h.jobtitlename like ? or h.ecology_pinyin_search like ? )"; + sqlParams.add(keyword); + sqlParams.add(keyword); + sqlParams.add(keyword); + } + String sql = "select " + backfields + fromSql + sqlwhere + orderby; + rs.executeQuery(sql, sqlParams); + List> datas = new ArrayList<>(); + while (rs.next()) { + Map item = new HashMap<>(); + item.put("id", Util.null2String(rs.getString("id"))); + String name = Util.null2String(rs.getString("name")); + item.put("name", name); + item.put("title", name); + datas.add(item); + } + apidatas.put("datas", datas); + return apidatas; + } + + @Override public Map getBrowserConditionInfo(Map map) { Map> apiDatas = new HashMap<>(); @@ -130,7 +171,7 @@ public class JobBrowserService extends BrowserService { // 分权 DetachUtil detachUtil = new DetachUtil(user); if (detachUtil.isDETACH()) { - sqlWhere += " AND t.parent_comp in (" + detachUtil.getJclRoleLevels() + ")"; + sqlWhere += " AND t.ec_company in (" + detachUtil.getJclRoleLevels() + ")"; } return sqlWhere; } diff --git a/src/com/engine/organization/entity/department/bo/DepartmentBO.java b/src/com/engine/organization/entity/department/bo/DepartmentBO.java index 9468c5c9..6841a0d7 100644 --- a/src/com/engine/organization/entity/department/bo/DepartmentBO.java +++ b/src/com/engine/organization/entity/department/bo/DepartmentBO.java @@ -159,7 +159,7 @@ public class DepartmentBO { return ""; } String departmentPrincipal = MapperProxyFactory.getProxy(DepartmentMapper.class).getDepartmentPrincipal(id); - if (StringUtils.isBlank(departmentPrincipal)) { + if (StringUtils.isBlank(departmentPrincipal) || "$NULL$".equalsIgnoreCase(departmentPrincipal)) { return ""; } List collect = Arrays.stream(departmentPrincipal.split(",")).map(Long::parseLong).collect(Collectors.toList()); diff --git a/src/com/engine/organization/mapper/department/DepartmentMapper.xml b/src/com/engine/organization/mapper/department/DepartmentMapper.xml index f52a9bb0..6f0dcffb 100644 --- a/src/com/engine/organization/mapper/department/DepartmentMapper.xml +++ b/src/com/engine/organization/mapper/department/DepartmentMapper.xml @@ -137,7 +137,8 @@