Commit 94548ec8f19a195f587c316c83ad5cfb7920ef11
1 parent
9fccadda
新增部门删除处理
Showing
1 changed file
with
41 additions
and
1 deletions
src/Api/Department.php
| ... | ... | @@ -16,6 +16,17 @@ class Department |
| 16 | 16 | protected $service = null; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | + * 部门删除状态:正常(未删除) | |
| 20 | + * @var integer | |
| 21 | + */ | |
| 22 | + const DELETE_NO = 1; | |
| 23 | + /** | |
| 24 | + * 部门删除状态:已删除 | |
| 25 | + * @var integer | |
| 26 | + */ | |
| 27 | + const DELETE_YES = 2; | |
| 28 | + | |
| 29 | + /** | |
| 19 | 30 | * 畅移本地顶级部门(智慧零售部)的 id |
| 20 | 31 | * md5('2022-04-27 17:00:01') —— 该值没具体意义主要就是一个在hris识别“智慧零售事业部”的标识<br> |
| 21 | 32 | * 该值的来源是,首次导给 hris 全量部门数据时,以当时时间md5做顶级部门标识,方便 hris 导入处理 |
| ... | ... | @@ -90,7 +101,8 @@ class Department |
| 90 | 101 | 'branchNo' => '', |
| 91 | 102 | 'parentBranchNo' => '', |
| 92 | 103 | 'nameZH' => '', |
| 93 | - 'nameEN' => '' | |
| 104 | + 'nameEN' => '', | |
| 105 | + 'deleted' => self::DELETE_NO | |
| 94 | 106 | ], $params); |
| 95 | 107 | if ($params['parentBranchNo'] === '') { |
| 96 | 108 | // 如果父级部门 id 不存在,则认为更新的是畅移的一级部门(在 hris 是属于“智慧零售事业部”下的二级部门) |
| ... | ... | @@ -102,4 +114,32 @@ class Department |
| 102 | 114 | |
| 103 | 115 | return $result; |
| 104 | 116 | } |
| 117 | + | |
| 118 | + /** | |
| 119 | + * 删除部门 | |
| 120 | + * @desc 删除HRIS中的部门 | |
| 121 | + * @param array $params | |
| 122 | + * <pre> | |
| 123 | + * branchNo String 畅移部门ID | |
| 124 | + * parentBranchNo String 畅移上级部门ID | |
| 125 | + * nameZH String 部门名称(中文) | |
| 126 | + * nameEN String 部门名称(英文) | |
| 127 | + * </pre> | |
| 128 | + * @return array | |
| 129 | + * <pre> | |
| 130 | + * affectRow string 受影响的行数 | |
| 131 | + * branchId string hris中的部门ID | |
| 132 | + * </pre> | |
| 133 | + */ | |
| 134 | + public function branchDelete(array $params) : array | |
| 135 | + { | |
| 136 | + $params = array_merge([ | |
| 137 | + 'branchNo' => '', | |
| 138 | + 'parentBranchNo' => '', | |
| 139 | + 'nameZH' => '', | |
| 140 | + 'nameEN' => '', | |
| 141 | + 'deleted' => self::DELETE_YES | |
| 142 | + ], $params); | |
| 143 | + return $this->branchAddOrUpdate($params); | |
| 144 | + } | |
| 105 | 145 | } | ... | ... |