package com.tanpu.feo.feojob.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tanpu.feo.feojob.constant.BaseConstant;
import com.tanpu.feo.feojob.dao.user.entity.OrgEntity;
import com.tanpu.feo.feojob.dao.user.mapper.OrgMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * ServiceImp
 *
 * @author zejia zj wu 2021年05月18日
 * @version 1.0
 */
@Service("orgService")
@Slf4j
public class OrgService extends ServiceImpl<OrgMapper, OrgEntity> {

	@Autowired
	private OrgMapper orgMapper;

	public OrgEntity findById(String orgId) {
		OrgEntity org = orgMapper.selectById(orgId);
		return org;
	}

	public OrgEntity findByOrgCode(String feoOrgCode) {
		return orgMapper.selectOne(new LambdaQueryWrapper<>(OrgEntity.class).eq(OrgEntity::getOrgCode, feoOrgCode).eq(OrgEntity::getDeleteTag, BaseConstant.DeleteTagStr.NOT_DELETED));
	}
}