package com.ssm.manage.dao.impl;

import com.ssm.core.impl.BaseDaoImpl;
import com.ssm.manage.dao.SsmCardChangeInProjectDao;
import com.ssm.manage.entity.CardChangeInProject;
import com.ssm.manage.entity.CardChangeList;
import com.ssm.manage.mapper.CardChangeInProjectMapper;
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 SsmCardChangeInProjectDaoImpl extends BaseDaoImpl<CardChangeInProject> implements SsmCardChangeInProjectDao {
    @Autowired
    private CardChangeInProjectMapper mapper;

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

    @Override
    public int updateStaff(CardChangeInProject cardChangeInProject) {
        return mapper.updateStaff(cardChangeInProject);
    }

    @Override
    public List<CardChangeInProject> queryByDocNum(CardChangeInProject cardChangeInProject) {
        Example example = new Example(CardChangeInProject.class);
        Example.Criteria criteria = example.createCriteria();
        if (null != cardChangeInProject.getDocNum()){
            criteria.andEqualTo("docNum", cardChangeInProject.getDocNum());
        }
        if (null != cardChangeInProject.getStoreId()){
            criteria.andEqualTo("storeId", cardChangeInProject.getStoreId());
        }
        return mapper.selectByExample(example);
    }
}
