-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from moshuying/dev
进入到角色页面
- Loading branch information
Showing
32 changed files
with
576 additions
and
254 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
idea |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
66 changes: 66 additions & 0 deletions
66
back/src/main/java/com/zoctan/seedling/controller/EmployeeController.java
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,66 @@ | ||
package com.zoctan.seedling.controller; | ||
|
||
import com.zoctan.seedling.core.response.Result; | ||
import com.zoctan.seedling.core.response.ResultGenerator; | ||
import com.zoctan.seedling.entity.Employee; | ||
import com.zoctan.seedling.service.EmployeeService; | ||
import com.github.pagehelper.PageHelper; | ||
import com.github.pagehelper.PageInfo; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.List; | ||
|
||
/** | ||
* @author MoShuYing | ||
* @date 2021/05/13 | ||
*/ | ||
@PreAuthorize("hasAuthority('ADMIN')") | ||
@Tag(name = "员工接口") | ||
@RestController | ||
@RequestMapping("/employee") | ||
public class EmployeeController { | ||
@Resource | ||
private EmployeeService employeeService; | ||
|
||
@Operation(description = "员工添加") | ||
@PostMapping | ||
public Result add(@RequestBody Employee employee) { | ||
employeeService.save(employee); | ||
return ResultGenerator.genOkResult(); | ||
} | ||
|
||
@Operation(description = "员工删除") | ||
@DeleteMapping("/{id}") | ||
public Result delete(@PathVariable Long id) { | ||
employeeService.deleteById(id); | ||
return ResultGenerator.genOkResult(); | ||
} | ||
|
||
@Operation(description = "员工更新") | ||
@PatchMapping | ||
public Result update(@RequestBody Employee employee) { | ||
employeeService.update(employee); | ||
return ResultGenerator.genOkResult(); | ||
} | ||
|
||
@Operation(description = "员工信息细节") | ||
@GetMapping("/{id}") | ||
public Result detail(@PathVariable Long id) { | ||
Employee employee = employeeService.getById(id); | ||
return ResultGenerator.genOkResult(employee); | ||
} | ||
|
||
@Operation(description = "分页查询员工") | ||
@GetMapping | ||
public Result list(@RequestParam(defaultValue = "0") Integer page, | ||
@RequestParam(defaultValue = "0") Integer size) { | ||
PageHelper.startPage(page, size); | ||
List<Employee> list = employeeService.listAll(); | ||
PageInfo<Employee> pageInfo = PageInfo.of(list); | ||
return ResultGenerator.genOkResult(pageInfo); | ||
} | ||
} |
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
Oops, something went wrong.