package com.ssm.controller;

import com.github.pagehelper.PageInfo;
import com.ssm.core.bean.GenericResponse;
import com.ssm.core.bean.PageResponse;
import com.ssm.manage.entity.BaseCollectionType;
import com.ssm.manage.query.CollectionTypeRequest;
import com.ssm.manage.response.ResponseCode;
import com.ssm.manage.service.SsmCollectionTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(value="支付方式controller",tags={"支付方式相关接口"})
@RestController
@RequestMapping("/demay/ssm/ct")
@Slf4j
public class SsmCollectionTypeController {
    @Autowired
    private SsmCollectionTypeService collectionTypeService;

    @ApiOperation(value = "查询可用支付方式list  (门店管理-开单页面-支付方式查询)", httpMethod = "POST", response = GenericResponse.class)
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public GenericResponse selectList() {
        GenericResponse genericResponse = new GenericResponse();
        List<BaseCollectionType> list = new ArrayList<>();
        try {
            list = collectionTypeService.selectList();
        } catch (Exception e) {
            log.error("SsmCollectionTypeController.selectList:", e);
            genericResponse.setCodeAndMsg(ResponseCode.FAILED);
            return genericResponse;
        }
        genericResponse.setCodeAndMsg(ResponseCode.OK);
        genericResponse.setRows(list);
        return genericResponse;
    }
}
