package com.persagy.server.meiku.controller

import com.persagy.server.meiku.models.entities.MeiKuAnchor
import com.persagy.server.meiku.services.MeiKuAnchorService
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 = ["002、锚点"])
@RestController
@RequestMapping("/anchor")
class MeiKuAnchorController {

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

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

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

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

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


} // Class MeiKuAnchorController