package com.persagy.server.meiku.controller

import com.persagy.server.meiku.models.entities.MeiKuState
import com.persagy.server.meiku.services.MeiKuStateService
import com.persagy.service.models.requests.SCountRequest
import com.persagy.service.models.requests.SCreateRequest
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.requests.SUpdateRequest
import com.persagy.service.models.responses.SBaseResponse
import com.persagy.service.models.responses.SCountResponse
import com.persagy.service.models.responses.SCreateResponse
import com.persagy.service.models.responses.SQueryResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 状态
 *
 * @author  wx
 * @date  2020/9/21 14:50
 */
@Api(tags = ["003、状态"])
@RestController
@RequestMapping("/state")
class MeiKuStateController {

    /**
     * 创建图例
     */
    @ApiOperation(value="创建状态-批量", notes="")
    @PostMapping("/create")
    fun create(@RequestBody request: SCreateRequest<MeiKuState>): SCreateResponse<MeiKuState> {
        return MeiKuStateService.createList(request)
    } // Function create()

    /**
     * 更新状态
     */
    @ApiOperation(value = "状态修改-批量", notes = "")
    @PostMapping(value = ["/update"])
    fun update(@RequestBody request: SUpdateRequest<MeiKuState>): SBaseResponse {
        return MeiKuStateService.updateList(request)
    } // Function update()

    /**
     * 根据id删除状态
     */
    @ApiOperation(value = "状态删除", notes = "")
    @PostMapping(value = ["/delete"])
    fun delete(@RequestBody idList: ArrayList<MeiKuState>): SBaseResponse {
        return MeiKuStateService.deleteByKeysList(idList)
    } // Function delete()

    /**
     * 查询状态信息
     */
    @ApiOperation(value = "查询状态-批量", notes = "")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: SQueryRequest): SQueryResponse<MeiKuState> {
        return MeiKuStateService.pageQuery(request)
    } // Function query()

    @ApiOperation(value = "查询状态统计", notes = "")
    @PostMapping(value = ["/count"])
    fun count(@RequestBody request: SCountRequest): SCountResponse {
        return MeiKuStateService.count(request)
    } // Function count()

} // Class MeiKuStateController