/**
* 查询公司信息
* @return
*/
public List<Map<String,Object>> queryDepartments() {
String sql = "SELECT
department_iddepartmentId,
department_namedepartmentName," +
"
manager_name` managerName " + /**
* 查询某个公司的城市地址
* @param departmentId
* @return
*/
public List<Map<String,Object>> queryCitysOfDepartment(Integer departmentId){
String sql = "SELECT location_id
locationId,city
," +
"street_address
streetAddress,d.department_id
departmentId " +
"FROM em_departments d " +
"LEFT OUTER JOIN em_locations l " +
"ON d.department_id
=l.department_id
" +
"WHERE d.department_id
=?";
List<Map<String,Object>> list = queryForMap(sql, departmentId);
return list;
}
/**
* 查询某个公司的工作岗位
* @param departmentId
* @return
*/
public List<Map<String,Object>> queryJobsOfDepartment(Integer departmentId){
String sql = "SELECT job_id
jobId,job_title
jobTitle,min_salary
minSalary," +
"max_salary
maxSalary,j.department_id
departmentId " +
"FROM em_departments d " +
"LEFT OUTER JOIN em_jobs j " +
"ON d.department_id
=j.department_id
" +
"WHERE d.department_id
=?";
List<Map<String,Object>> list = queryForMap(sql, departmentId);
return list;
}
- 前端vue渲染
getField(val) {
//点击部门下拉列表为部门options动态赋值
if (val == "departmentId") {
this.(http
.get("api/EmployeeManage/EmployeeServlet?method=getDepartments")
.then(res => {
var index = this.operateFormLabel.findIndex(
item => item.model === val
);
this.operateFormLabel[index].options = res.data.data;
});
}
},
getDepartmentId(val) {
//console.log(val);
//根据val的值给所在地下拉列表options动态赋值
this.)http
.get(
"api/EmployeeManage/EmployeeServlet?method=getCitysOfDepartment&departmentId=" +
val
)
.then(response => {
var index = this.operateFormLabel.findIndex(
item => item.model === "locationId"
);
this.operateFormLabel[index].options = response.data.data;
console.log(this.operateFormLabel[index].options);
});
//根据val的值给职位下拉列表options动态赋值
this.$http
.get(
"api/EmployeeManage/EmployeeServlet?method=getJobsOfDepartment&departmentId=" +
val
)
.then(res => {
var index = this.operateFormLabel.findIndex(
item => item.model === "jobId"
);
this.operateFormLabel[index].options = res.data.data;
});
}
powered by kaifamiao