package com.ruoyi.web.controller.staff;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.storeStaff.domain.enums.StoreStaffPermissions;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.service.TransactionAssembler;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wjh
 * 2024/11/27
 */
@RestController
@RequestMapping("/staff/bill")
public class StaffTransactionBillController extends BaseController {

    @Autowired
    private TransactionBillService transactionBillService;

    @Autowired
    private TransactionAssembler transactionAssembler;

    @ApiOperation("员工获取订单列表")
    @GetMapping("/list")
    public TableDataInfo list(TransactionBillQuery query) {
        startPage();
        startOrderBy();
        query.setStaffUserId(getUserId());
        query.setStaffPermission(StoreStaffPermissions.ORDER_VIEW.getCode());
        List<TransactionBillVO> list = transactionBillService.selectStaffDeviceList(query);
        transactionAssembler.assembleOperator(list, getUserId());
        return getDataTable(list);
    }

}
