|
@@ -0,0 +1,66 @@
|
|
|
+package com.sky.ioc.controller.person;
|
|
|
+
|
|
|
+import com.sky.ioc.entity.Index;
|
|
|
+import com.sky.ioc.entity.domain.person.Person;
|
|
|
+import com.sky.ioc.service.person.PersonService;
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Api(tags = "人员管理")
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/person")
|
|
|
+public class PersonController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PersonService personService;
|
|
|
+
|
|
|
+ @ApiOperation("人员列表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "name", value = "姓名", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "companyName", value = "公司", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "deptName", value = "部门", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "page", value = "页码",defaultValue="1", dataType = "Integer"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "页大小", defaultValue="10",dataType = "Integer")
|
|
|
+ })
|
|
|
+ @GetMapping(value = "/getPersonList")
|
|
|
+ public ReturnMsg getPersonList(@RequestParam(name = "name", required = false) String name,
|
|
|
+ @RequestParam(name = "companyName", required = false) String companyName,
|
|
|
+ @RequestParam(name = "deptName", required = false) String deptName,
|
|
|
+ @RequestParam(name = "page", required = false,defaultValue = "1") Integer page,
|
|
|
+ @RequestParam(name = "pageSize", required = false,defaultValue = "10") Integer pageSize) {
|
|
|
+ return personService.pageList(name,companyName,deptName,page,pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("新建人员")
|
|
|
+ @PostMapping(value = "/addPerson")
|
|
|
+ public ReturnMsg addIndex(@RequestBody Person person) {
|
|
|
+ return personService.addPerson(person);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("编辑人员")
|
|
|
+ @PostMapping(value = "/editPerson")
|
|
|
+ public ReturnMsg editIndex(@RequestBody Person person) {
|
|
|
+ return personService.editPerson(person);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除人员")
|
|
|
+ @PostMapping(value = "/delPerson")
|
|
|
+ public ReturnMsg delIndex(@RequestParam(name = "id", required = true) Integer id) {
|
|
|
+ return personService.delPersonById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("批量删除人员")
|
|
|
+ @PostMapping(value = "/batchDelByIds")
|
|
|
+ public ReturnMsg batchDelByIds(@RequestBody List<Integer> ids) {
|
|
|
+ return personService.delBatchById(ids);
|
|
|
+ }
|
|
|
+}
|