package com.ssm.manage.dao.impl;

import com.ssm.core.impl.BaseDaoImpl;
import com.ssm.manage.dao.SsmPromotionProjectDao;
import com.ssm.manage.entity.DocPromotion;
import com.ssm.manage.entity.PromotionProject;
import com.ssm.manage.mapper.PromotionProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Component
public class SsmPromotionProjectDaoImpl extends BaseDaoImpl<PromotionProject> implements SsmPromotionProjectDao {
    @Autowired
    private PromotionProjectMapper mapper;

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

    @Override
    public List<PromotionProject> getPros(PromotionProject project) {
        Example example = new Example(DocPromotion.class);
        Example.Criteria criteria = example.createCriteria();
        if (null != project.getPromotionId()){
            criteria.andEqualTo("promotionId",project.getPromotionId());
        }
        return mapper.selectByExample(example);
    }
}
