package com.neusoft.smart.pos.payorder.repository;


import com.neusoft.smart.pos.constants.DictionaryConstant;
import com.neusoft.smart.pos.payorder.persistent.domain.PayTypeDict;
import com.neusoft.smart.pos.payorder.persistent.domain.PayTypeDictExample;
import com.neusoft.smart.pos.payorder.persistent.mapper.PayTypeDictMapper;
import lombok.val;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author zcf
 * @date 2018-01-09 10：43
 * @description 支付管理使用Repository
 */
@Component
public class PayTypeDictRepository {

	@Resource
	private PayTypeDictMapper payTypeDictMapper;

	/**
	 * 已启用支付方式查询方法
	 * @param payType：支付方式
	 * @return
	 */
	public PayTypeDict queryEnablePayTypeDict(String payType){
		val example = new PayTypeDictExample();
		example.createCriteria()
				.andPayTypeEqualTo(payType)
				.andIsEnableEqualTo(DictionaryConstant.IS_ENABLE_QY.getCode());
		val payTypeDict = payTypeDictMapper.selectByExample(example);
		return payTypeDict.size()>0?payTypeDict.get(0):null;
	}

}
