/*
 * ********************************************************************************************************************
 *
 *                     :*$@@%$*:                         ;:                ;;    ;;
 *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
 *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
 *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
 *                  =@*                                  %!              @ $= % %@=   =%@!      %=
 *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
 *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
 *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
 *         $@*   ;@@@%=!:                *@*
 *         =@$    ;;;!=%@@@@=!           =@!
 *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
 *           ;%@@$=$@@%*       *@@@$=%@@%;
 *              ::;::             ::;::                                              All rights reserved.
 *
 * ********************************************************************************************************************
 */

package com.persagy.server.controller

import cn.sagacloud.server.scanbuilding.ImageNameSort
import com.persagy.base.extensions.toJson
import com.persagy.mybatis.SMybatisDao
import com.persagy.service.SObjectService
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.slf4j.LoggerFactory
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 付国宝
 */
@Api(tags = ["012、图片信息排序接口"])
@RestController
@RequestMapping("/image-name-sort")
open class ImageNameSortController {
    companion object {
        // 日志
        private val logger = LoggerFactory.getLogger(ImageNameSortController::class.java)
    } // Companion object

    private var baseService = SObjectService(SMybatisDao(ImageNameSort::class.java))

    /**
     * 批量创建图片信息排序
     *
     * @param   request         图片信息排序对象列表
     * @return                  创建结果信息
     */
    @ApiOperation(value = "创建图片信息排序", notes = "")
    @PostMapping(value = ["/create"])
    fun create(@RequestBody request: SCreateRequest<ImageNameSort>): SCreateResponse<ImageNameSort> {
        logger.debug("imageNameSort =${request.toJson()}")
        return baseService.createList(request)
    } // Function create()

    /**
     * 根据id删除图片信息排序
     *
     * @param   entityList  图片信息排序数组
     * @return              删除的结果信息
     */
    @ApiOperation(value = "根据id删除图片信息排序", notes = "")
    @PostMapping(value = ["/delete"])
    fun delete(@RequestBody entityList: ArrayList<ImageNameSort>): SBaseResponse {
        return baseService.deleteByKeysList(entityList)
    } // Function delete()

    /**
     * 更新图片信息排序
     *
     * @param   request     更新的内容对象
     * @return              更新的结果
     */
    @ApiOperation(value = "更新图片信息排序", notes = "")
    @PostMapping(value = ["/update"])
    fun update(@RequestBody request: SUpdateRequest<ImageNameSort>): SBaseResponse {
        return baseService.updateList(request)
    } // Function update()

    /**
     * 查询图片信息排序
     *
     * @param   request     查询信息条件
     * @return              查询结果
     */
    @ApiOperation(value = "查询图片信息排序", notes = "")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: SQueryRequest): SQueryResponse<ImageNameSort> {
        return baseService.pageQuery(request)
    } // Function query()

    /**
     * 根据条件查询统计数量
     */
    @ApiOperation(value = "根据条件查询统计数量", notes = "")
    @PostMapping(value = ["/count"])
    fun count(@RequestBody request: SCountRequest): SCountResponse {
        return baseService.count(request)
    } // Function count()

} // Class ImageNameSortController