package com.bonus.sharedstation.app.controller;


import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.app.domain.TherapyAppointments;
import com.bonus.sharedstation.app.dto.GreenInfoDTO;
import com.bonus.sharedstation.app.dto.GreenOrderDTO;
import com.bonus.sharedstation.app.entity.GreenOrder;
import com.bonus.sharedstation.app.service.GreenOrderService;
import com.bonus.sharedstation.web.service.IGreenInfoWebService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;

import javax.annotation.Resource;

@Tag(name = "app-绿植订购")
@RestController
@RequestMapping("/information/greenorder/app")
public class GreenOrderAppController {

    @Resource
    private GreenOrderService service;

    @Resource
    private IGreenInfoWebService iGreenInfoWebService;


    @PostMapping(value = "/add", produces = "application/json; charset=utf-8")
    @ApiOperation("新增")
    public AjaxResult add(@RequestBody GreenOrderDTO dto) {
        return service.add(dto);
    }


    @PostMapping("/getList")
    @ApiOperation("分页查询app 订单")
    public AjaxResult getList(@RequestBody GreenOrderDTO dto) {
        return service.getListPageApp(dto);

    }

    @PostMapping(value = "selectById", produces = "application/json; charset=utf-8")
    @ApiOperation("查询详情")
    public AjaxResult selectInfoById(@RequestBody GreenOrder dto) {
        return service.selectInfoById(dto);
    }


    @PostMapping("/getListGreenInfoApp")
    @ApiOperation("分页查询app 绿植信息")
    public AjaxResult getList(@RequestBody GreenInfoDTO dto) {
        return service.getListPage(dto);
    }

    @PostMapping(value = "selectDirCode", produces = "application/json; charset=utf-8")
    @ApiOperation("查询通过日期")
    public AjaxResult selectDirCode(@RequestBody TherapyAppointments dto) {
        return service.selectDirCode(dto);
    }


    @PostMapping("/getOrderListSeller")
    @ApiOperation("查询全部数据订单")
    public AjaxResult getListWeb(@RequestBody GreenOrderDTO dto){
        return iGreenInfoWebService.getListWeb(dto);
    }

}

