package com.ssm.manage.service.impl;

import com.ssm.core.service.impl.BaseServiceImpl;
import com.ssm.manage.dao.BaseDao;
import com.ssm.manage.dao.SsmPlatformDao;
import com.ssm.manage.entity.Platform;
import com.ssm.manage.query.PlatformRequest;
import com.ssm.manage.service.SsmPlatformService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
@Slf4j
public class SsmPlatformServiceImp extends BaseServiceImpl<Platform> implements SsmPlatformService {

    @Autowired
    SsmPlatformDao dao;

    @Override
    public BaseDao<Platform> getDao() {
        return dao;
    }

    @Override
    public List<Platform> selectAll(PlatformRequest platformRequest) {
        Example example=new Example(Platform.class);
        Example.Criteria criterion=example.createCriteria();
        if(platformRequest.getState()!=null){
            criterion.andEqualTo("state",platformRequest.getState());
        }
        example.setOrderByClause("id");
        List<Platform> list=dao.selectByExample(example);
        return list;
    }
}
