package com.ssm.controller;

import com.ssm.manage.response.GenericResponse;
import com.ssm.manage.utils.SessionHelp;
import com.ssm.manage.query.RefundRoomCashRequest;
import com.ssm.manage.response.RefundRoomCashResponse;
import com.ssm.manage.response.ResponseCode;
import com.ssm.manage.service.SsmRefundRoomCashService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * (RefundRoomCash)表控制层
 *
 * @author makejava
 * @since 2022-05-23 16:32:55
 */
@Api(value = "沐足退controller", tags = {"沐足退相关接口"})
@RestController
@RequestMapping("/demay/refundRoomCash")
@Slf4j
public class SsmRefundRoomCashController {

    @Autowired
    private SsmRefundRoomCashService ssmRefundRoomCashService;

    @ApiOperation(value = "消费退明细查询  门店端-疗程退-消费退明细查询", httpMethod = "POST", response = GenericResponse.class)
    @RequestMapping("/list")
    public GenericResponse selectList(@RequestBody RefundRoomCashRequest refundCashReqest, HttpSession session) {
        GenericResponse<RefundRoomCashResponse> genericResponse = new GenericResponse<>();
        refundCashReqest.setStoreId(SessionHelp.getStoreId(session));
        List<RefundRoomCashResponse> list = new ArrayList<>();
        try {
            list = ssmRefundRoomCashService.selectList(refundCashReqest);
        } catch (Exception e) {
            log.error("SsmRefundCashController.selectList", e);
            genericResponse.setCodeAndMsg(ResponseCode.FAILED);
            return genericResponse;
        }
        genericResponse.setCodeAndMsg(ResponseCode.OK);
        genericResponse.setRows(list);
        return genericResponse;
    }

}

