package com.ssm.manage.dao.impl;

import com.github.pagehelper.PageInfo;
import com.ssm.core.impl.BaseDaoImpl;
import com.ssm.manage.dao.SsmSysRoleStoreDao;
import com.ssm.manage.dao.SsmSysStoreRoleDao;
import com.ssm.manage.entity.SysRole;
import com.ssm.manage.entity.SysRoleStore;
import com.ssm.manage.entity.SysStoreRole;
import com.ssm.manage.mapper.SsmSysRoleStoreMapper;
import com.ssm.manage.mapper.SsmSysStoreRoleMapper;
import com.ssm.manage.query.SysRoleStoreRequest;
import com.ssm.manage.query.SysStoreRoleRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Component
@Slf4j
public class SsmSysRoleStoreDaoImpl extends BaseDaoImpl<SysRoleStore> implements SsmSysRoleStoreDao {
    @Autowired
    private SsmSysRoleStoreMapper mapper;

    @Override
    public SsmSysRoleStoreMapper getMapper() {
        return mapper;
    }

    @Override
    public PageInfo<SysRoleStore> selectPage(SysRoleStoreRequest sysStoreRole) {
        Example example = new Example(SysRoleStore.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("roleId",sysStoreRole.getRoleId());

        List<SysRoleStore> list =  selectByExample(example);
        PageInfo<SysRoleStore> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
