/*
Copyright [2020] [https://www.xiaonuo.vip]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：

1.请不要删除和修改根目录下的LICENSE文件。
2.请不要删除和修改Snowy源码头部的版权声明。
3.请保留源码和相关描述文件的项目出处，作者声明等。
4.分发源码时候，请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名，模块名称，项目代码等时，请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点，可申请商业授权，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package com.huimv.modular.farmstock.controller;

import com.huimv.core.annotion.BusinessLog;
import com.huimv.core.annotion.Permission;
import com.huimv.core.enums.LogAnnotionOpTypeEnum;
import com.huimv.core.pojo.page.PageResult;
import com.huimv.core.pojo.response.ResponseData;
import com.huimv.core.pojo.response.SuccessResponseData;
import com.huimv.modular.farmstock.param.FarmStockParam;
import com.huimv.modular.farmstock.service.FarmStockService;
import com.huimv.modular.result.R;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 月度统计控制器
 *
 * @author yinhao
 * @date 2021-08-17 14:45:39
 */
@RestController
public class FarmStockController {

    @Resource
    private FarmStockService farmStockService;

    /**
     * 查询月度统计
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @GetMapping("/farmStock/page")
    @BusinessLog(title = "月度统计_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(FarmStockParam farmStockParam) {
        return new SuccessResponseData(farmStockService.page(farmStockParam));
    }

    /**
     * 添加月度统计
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @PostMapping("/farmStock/add")
    @BusinessLog(title = "月度统计_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(FarmStockParam.add.class) FarmStockParam farmStockParam) {
            farmStockService.add(farmStockParam);
        return new SuccessResponseData();
    }

    /**
     * 删除月度统计，可批量删除
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @PostMapping("/farmStock/delete")
    @BusinessLog(title = "月度统计_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(FarmStockParam.delete.class) List<FarmStockParam> farmStockParamList) {
            farmStockService.delete(farmStockParamList);
        return new SuccessResponseData();
    }

    /**
     * 编辑月度统计
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @PostMapping("/farmStock/edit")
    @BusinessLog(title = "月度统计_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(FarmStockParam.edit.class) FarmStockParam farmStockParam) {
            farmStockService.edit(farmStockParam);
        return new SuccessResponseData();
    }

    /**
     * 查看月度统计
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @GetMapping("/farmStock/detail")
    @BusinessLog(title = "月度统计_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(FarmStockParam.detail.class) FarmStockParam farmStockParam) {
        return new SuccessResponseData(farmStockService.detail(farmStockParam));
    }

    /**
     * 月度统计列表
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @GetMapping("/farmStock/list")
    @BusinessLog(title = "月度统计_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(FarmStockParam farmStockParam) {
        return new SuccessResponseData(farmStockService.list(farmStockParam));
    }

    /**
     * 导出系统用户
     *
     * @author yinhao
     * @date 2021-08-17 14:45:39
     */
    @Permission
    @GetMapping("/farmStock/export")
    @BusinessLog(title = "月度统计_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    public void export(FarmStockParam farmStockParam) {
        farmStockService.export(farmStockParam);
    }



    /**
     * 列表
     *//*
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageResult pageResult = farmStockService.queryPage(params);

        return R.ok().put("page", pageResult);
    }

    *//**
     * 全部
     *//*
    @RequestMapping("/countAll")
    public R countAll(@RequestParam Map<String, Object> params){
        List list = farmStockService.countAll(params);
        return R.ok().put("page", list);
    }

    *//**
     * 市全部
     *//*
    @RequestMapping("/cityCountAll")
    public R cityCountAll(@RequestParam Map<String, Object> params){
        List list = farmStockService.cityCountAll(params);
        return R.ok().put("page", list);
    }*/



}
