在Oracle ADF中显示Manager名称而不是Manager ID

时间:2018-10-07 13:12:53

标签: sql oracle oracle-adf jdeveloper

Employees表包含-

 Employee_Id,
 Manager_Id,
 First_Name,
 Last_Name

我想显示经理姓名而不是ID

不能使用LOV

VO中的当前查询:

   SELECT 
      Employees.EMPLOYEE_ID, 
      Employees.FIRST_NAME, 
      Employees.LAST_NAME, 
      JobObject.JOB_TITLE, 
      Employees.COMMISSION_PCT, 
      Departments.DEPARTMENT_NAME, 
      Departments.DEPARTMENT_ID, 
      JobObject.JOB_ID, 
      (First_Name||' '||Last_Name) AS VIEW_ATTR, 
      Employees.SALARY, 
      Employees.MANAGER_ID
 FROM EMPLOYEES Employees, 
      DEPARTMENTS Departments, 
      JOBS JobObject
WHERE Employees.DEPARTMENT_ID = Departments.DEPARTMENT_ID

2 个答案:

答案 0 :(得分:3)

我假设您要显示“经理姓名”以及员工详细信息。是的,那么下面的查询将很有帮助。

fabric.Image.prototype._renderFill= (function(renderFill){
    return function(ctx) {

      var w = this.width, h = this.height, sW = w * this._filterScalingX, sH = h * this._filterScalingY,
          x = -w / 2, y = -h / 2, elementToDraw = this._element;

          y = y  + Math.abs((this._element.height-h)/2);
          x = x  + Math.abs((this._element.width-w)/2);
      elementToDraw && ctx.drawImage(elementToDraw,
        this.cropX * this._filterScalingX,
        this.cropY * this._filterScalingY,
        sW,
        sH,
        x, y, w, h);
    }
})()

答案 1 :(得分:0)

如果我理解正确,那么什么都没得到的原因与联接有关,当在FROM子句中使用逗号时,可能会遇到问题。 对于managername,如果您有一个manager表,则必须对其进行内部联接或尝试以下操作:

 SELECT Employees.EMPLOYEE_ID, 
   Employees.FIRST_NAME, 
   Employees.LAST_NAME, 
   JobObject.JOB_TITLE, 
   Employees.COMMISSION_PCT, 
   Departments.DEPARTMENT_NAME, 
   Departments.DEPARTMENT_ID, 
   JobObject.JOB_ID, 
   (Employees.First_Name+' '+Employees.Last_Name) AS ManagerName, 
   Employees.SALARY, 
   Employees.MANAGER_ID
   FROM EMPLOYEES Employees,
inner join
 DEPARTMENTS Departments on Employees.DEPARTMENT_ID = Departments.DEPARTMENT_ID
 left outer join 
JOBS JobObject on JobObject.Job_Id=Employees.Job_Id
where Employees.MANAGER_ID is not null and Employees.MANAGER_ID in (EMPLOYEE_ID from employees)