package com.younike.server.controller;

import com.younike.common.annotation.Log;
import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.common.core.page.TableDataInfo;
import com.younike.common.enums.BusinessType;
import com.younike.common.utils.poi.ExcelUtil;
import com.younike.framework.config.AnonymousAccess;
import com.younike.system.domain.GoodsComment;
import com.younike.system.domain.ServerTime;
import com.younike.system.domain.vo.GoodsCommentVo;
import com.younike.system.service.IGoodsCommentService;
import com.younike.system.service.IServerTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品评价Controller
 *
 * @author elev
 * @date 2022-01-05
 */
@Api("服务时间")
@RestController
@RequestMapping("/server/server/time")
public class ServerServerTimeController extends BaseController {
    @Autowired
    private IServerTimeService serverTimeService;


    /**
     * 修改时间
     */
    @ApiOperation("修改时间")
    @AnonymousAccess
    @PostMapping("/updateServerTimeInfo")
    public AjaxResult updateServerTimeInfo(@RequestBody ServerTime serverTime) {
        return toAjax(serverTimeService.updateServerTime(serverTime));
    }

    /**
     * 新增时间
     */
    @ApiOperation("新增时间")
    @PostMapping
    @AnonymousAccess
    public AjaxResult add(@RequestBody ServerTime serverTime) {
        return toAjax(serverTimeService.insertServerTime(serverTime));
    }

    /**
     * 查询我的时间
     */
    @ApiOperation("查询我的时间")
    @GetMapping("/getServerTimeInfo")
    @AnonymousAccess
    public AjaxResult getServerTimeInfo(ServerTime serverTime) {
        ServerTime info = serverTimeService.getServerTimeInfo(serverTime);
        return AjaxResult.success(info);
    }
}
