package io.renren.modules.sys.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import io.renren.common.constant.Constant;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.sys.dao.OperationsDao;
import io.renren.modules.sys.dto.OperationsDTO;
import io.renren.modules.sys.entity.OperationsEntity;
import io.renren.modules.sys.service.OperationsService;

/**
 * 运营机构表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2022-05-29
 */
@Service
public class OperationsServiceImpl extends CrudServiceImpl<OperationsDao, OperationsEntity, OperationsDTO> implements OperationsService {

    @Override
    public QueryWrapper<OperationsEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<OperationsEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id).eq("status",1);

        return wrapper;
    }

	@Override
	public List<OperationsEntity> listAll() {
		List<OperationsEntity> selectList = baseDao.selectList(new QueryWrapper<OperationsEntity>().eq("status", Constant.Status.ENABLE.getValue()));
		return selectList;
	}


}