|
@@ -1,6 +1,7 @@
|
|
|
package com.usky.dxtop.controller.web;
|
|
|
|
|
|
import com.usky.dxtop.common.core.domain.AjaxResult;
|
|
|
+import com.usky.dxtop.common.exception.CustomException;
|
|
|
import com.usky.dxtop.model.Dept;
|
|
|
import com.usky.dxtop.model.Staff;
|
|
|
import com.usky.dxtop.model.StaffRadio;
|
|
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* @author yq
|
|
@@ -88,6 +90,18 @@ public class StaffController {
|
|
|
return AjaxResult.success(staffService.one(id,phone,card));
|
|
|
}
|
|
|
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult update(@RequestBody Staff staff){
|
|
|
+ Staff one = staffService.one(staff.getId(), null, staff.getCardId());
|
|
|
+ Optional.ofNullable(one).map(s -> {
|
|
|
+ s.setOpenId(staff.getOpenId());
|
|
|
+ return staffService.updateById(s);
|
|
|
+ }).orElseThrow(() -> new CustomException("用户信息不存在"));
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("sendDept")
|
|
|
public List<Dept> sendDeptAndStaff(){
|
|
|
return deptService.buildDeptTree(deptService.list());
|