package cn.com.ctop.common.module.service.impl;

import cn.com.ctop.common.module.entity.WexinConfig;
import cn.com.ctop.common.module.mapper.WexinConfigMapper;
import cn.com.ctop.common.module.service.IWexinConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 企业微信配置信息
 *
 * @author jeecg-boot
 * 2021-06-17
 * @version V1.0
 */
@Service
public class WexinConfigServiceImpl extends ServiceImpl<WexinConfigMapper, WexinConfig> implements IWexinConfigService {

    @Override
    public WexinConfig getInfoByCorpId(String corpId) {
        QueryWrapper<WexinConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("corp_id", corpId);
        queryWrapper.orderByDesc("create_time");
        queryWrapper.last("limit 1");
        WexinConfig config = this.getOne(queryWrapper);
        return config;
    }
}
