feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.entity.BaseInfo
import cn.flightfeather.supervision.domain.entity.Company
import cn.flightfeather.supervision.lightshare.service.CompanyService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["用户企业信息相关API接口"])
@RestController
@RequestMapping("/company")
class CompanyController(val companyService: CompanyService) {
 
    @ApiOperation(value = "根据用户id获取用户企业信息")
    @GetMapping("/{id}")
    fun getById(
        @ApiParam("用户id") @PathVariable id: String
    ) = companyService.findOne(id)
 
    @ApiOperation(value = "创建企业基本信息")
    @PutMapping("/{userId}")
    fun save(
        @ApiParam(value = "用户id") @PathVariable("userId") userId: String,
        @ApiParam("企业信息") @RequestBody info: Company,
    ) = companyService.save(userId, info)
 
    @ApiOperation(value = "更新用户信息")
    @PostMapping("/{userId}")
    fun update(
        @ApiParam(value = "用户id") @PathVariable("userId") userId: String,
        @ApiParam("企业信息") @RequestBody info: Company,
    ) = companyService.update(userId, info)
}