forked from lanyulei/ferry
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,11 @@ INSERT INTO `casbin_rule`(`p_type`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5`, `id`) VA | |
COMMIT; | ||
|
||
BEGIN; | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (1, 0, '/0/1', '磊哥科技', 0, 'leige', '', '[email protected]', 0, '1', '1'); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (7, 1, '/0/1/7', '研发部', 1, '', '', '', 0, '1', '1'); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (8, 1, '/0/1/8', '运维部', 0, '', '', '', 0, '1', NULL); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (9, 1, '/0/1/9', '客服部', 0, '', '', '', 0, '1', NULL); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (10, 1, '/0/1/10', '人力资源', 3, '张三', '', '', 1, '1', '1'); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (1, 0, '/0/1', '磊哥科技', 0, null, '', '[email protected]', 0, '1', '1'); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (7, 1, '/0/1/7', '研发部', 1, null, '', '', 0, '1', '1'); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (8, 1, '/0/1/8', '运维部', 0, null, '', '', 0, '1', NULL); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (9, 1, '/0/1/9', '客服部', 0, null, '', '', 0, '1', NULL); | ||
INSERT INTO `sys_dept`(`dept_id`, `parent_id`, `dept_path`, `dept_name`, `sort`, `leader`, `phone`, `email`, `status`, `create_by`, `update_by`) VALUES (10, 1, '/0/1/10', '人力资源', 3, null, '', '', 1, '1', '1'); | ||
COMMIT; | ||
|
||
BEGIN; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package service | ||
|
||
import ( | ||
"ferry/global/orm" | ||
"ferry/models/system" | ||
) | ||
|
||
/* | ||
@Author : lanyulei | ||
*/ | ||
|
||
func GetVariableValue(stateList []interface{}, creator int) (err error) { | ||
var ( | ||
userInfo system.SysUser | ||
deptInfo system.Dept | ||
) | ||
|
||
// 变量转为实际的数据 | ||
for _, stateItem := range stateList { | ||
if stateItem.(map[string]interface{})["process_method"] == "variable" { | ||
for processorIndex, processor := range stateItem.(map[string]interface{})["processor"].([]interface{}) { | ||
if int(processor.(float64)) == 1 { | ||
// 创建者 | ||
stateItem.(map[string]interface{})["processor"].([]interface{})[processorIndex] = creator | ||
} else if int(processor.(float64)) == 2 { | ||
// 1. 查询用户信息 | ||
err = orm.Eloquent.Model(&userInfo).Where("user_id = ?", creator).Find(&userInfo).Error | ||
if err != nil { | ||
return | ||
} | ||
// 2. 查询部门信息 | ||
err = orm.Eloquent.Model(&deptInfo).Where("dept_id = ?", userInfo.DeptId).Find(&deptInfo).Error | ||
if err != nil { | ||
return | ||
} | ||
|
||
// 3. 替换处理人信息 | ||
stateItem.(map[string]interface{})["processor"].([]interface{})[processorIndex] = deptInfo.Leader | ||
} | ||
} | ||
stateItem.(map[string]interface{})["process_method"] = "person" | ||
} | ||
} | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters