package com.younike.server.controller;

import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.framework.config.ServerAccess;
import com.younike.framework.web.domain.ServerUserContext;
import com.younike.system.domain.vo.ServerTimeSectionVo;
import com.younike.system.service.IServerTimeSectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * 商品评价Controller
 *
 * @author elev
 * @date 2022-01-05
 */
@Api("时间子表")
@RestController
@RequestMapping("/server/time/section")
public class ServerServerTimeSectionController extends BaseController {
    @Autowired
    private IServerTimeSectionService serverTimeSectionService;

    /**
     * 修改时间子表
     */
    @ApiOperation("修改时间子表")
    @PostMapping("/updateServerTimeSection")
    @ServerAccess
    public AjaxResult updateServerTimeSection(@RequestBody ServerTimeSectionVo serverTimeSection) {
        serverTimeSection.setCurrentUser(ServerUserContext.currentUser());
        return serverTimeSectionService.updateServerTimeSectionVo(serverTimeSection);
    }
    /**
     * 新增时间子表
     */
    @ApiOperation("新增时间子表")
    @PostMapping("/addServerTimeSection")
    @ServerAccess
    public AjaxResult addServerTimeSection(@RequestBody ServerTimeSectionVo serverTimeSection) {
        serverTimeSection.setCurrentUser(ServerUserContext.currentUser());
        return serverTimeSectionService.insertServerTimeSectionVo(serverTimeSection);
    }
}
