AppOrgDaoImpl.java 1.9 KB
package com.zteits.pay.dao.impl;/**
 * Created by wb on 2018/11/20.
 */

import com.xiaoleilu.hutool.util.CollectionUtil;
import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
import com.zteits.clouds.api.dto.pay.AppOrgDTO;
import com.zteits.clouds.api.dto.pay.param.AppOrgRequest;
import com.zteits.pay.dao.AppOrgDao;
import com.zteits.pay.domain.AppOrg;
import com.zteits.pay.domain.AppOrgExample;
import com.zteits.pay.mapper.AppOrgMapper;
import com.zteits.pay.mapper.smapper.AppOrgSMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Copyright: Copyright (c) 2018  ZTE-ITS
 *
 * @ClassName: AppOrgDaoImpl
 * @Description:
 * @version: v1.0.0
 * @author: wangbiao
 * @date: 2018/11/20 9:30
 * Modification History:
 * Date         Author          Version         Description
 * ---------------------------------------------------------*
 * 2018/11/20    wangbiao         v1.0.0          创建
 */
@Component
public class AppOrgDaoImpl implements AppOrgDao {

    @Autowired
    private AppOrgSMapper appOrgSMapper;
    @Autowired
    private AppOrgMapper appOrgMapper;

    @Override
    public List<AppOrg> selectAllAppOrg() {
        AppOrgExample example = new AppOrgExample();
        example.createCriteria().andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
        return  appOrgMapper.selectByExample(example);
    }

    @Override
    public AppOrg queryAppOrgByOrgId(String orgId) {
        AppOrgExample example = new AppOrgExample();
        example.createCriteria().andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
                .andOrgIdEqualTo(orgId);
        List<AppOrg> appOrgs = appOrgMapper.selectByExample(example);
        AppOrg appOrg = new AppOrg();
        if(CollectionUtil.isNotEmpty(appOrgs)){
            appOrg = appOrgs.get(0);
        }
        return appOrg;
    }
}