package com.izouma.awesomeadmin.service.impl;

import java.util.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.izouma.awesomeadmin.constant.AppConstant;
import com.izouma.awesomeadmin.dto.Page;
import com.izouma.awesomeadmin.model.TestBbbCopy;
import com.izouma.awesomeadmin.service.TestBbbCopyService;
import com.izouma.awesomeadmin.dao.TestBbbCopyMapper;

/**
*  service接口实现类
*/
@Service
public class TestBbbCopyServiceImpl implements TestBbbCopyService{

    private static Logger logger = Logger.getLogger(TestBbbCopyServiceImpl.class);

    @Autowired
    private TestBbbCopyMapper testBbbCopyMapper;

    @Override
    public List<TestBbbCopy> getTestBbbCopyList(TestBbbCopy record) {

        logger.info("getTestBbbCopyList");
        try {

        return testBbbCopyMapper.queryAllTestBbbCopy(record);
        } catch (Exception e) {
        logger.error("getTestBbbCopyList", e);
        }

        return null;
    }
    @Override
    public List<TestBbbCopy> getTestBbbCopyByPage(Page page, TestBbbCopy record) {

        logger.info("getTestBbbCopyByPage");
        try {

        Map<String, Object> parameter = new HashMap<String, Object>();
        parameter.put("record", record);
        parameter.put(AppConstant.PAGE, page);

        return testBbbCopyMapper.queryTestBbbCopyByPage(parameter);
        } catch (Exception e) {
        logger.error("getTestBbbCopyByPage", e);
        }

        return null;
    }

    @Override
    public TestBbbCopy getTestBbbCopyById(String id) {

        logger.info("getTestBbbCopyyId");
        try {

            return testBbbCopyMapper.selectByPrimaryKey(Integer.valueOf(id));
        } catch (Exception e) {
        logger.error("getTestBbbCopyById", e);
        }

        return null;
    }

    @Override
    public TestBbbCopy getTestBbbCopy(TestBbbCopy record) {

        logger.info("getTestBbbCopy");
        try {

            return testBbbCopyMapper.queryTestBbbCopy(record);
        } catch (Exception e) {
        logger.error("getTestBbbCopy", e);
        }

        return null;
    }

    @Override
    public boolean createTestBbbCopy(TestBbbCopy record) {

        logger.info("createTestBbbCopy");
        try {

            int updates = testBbbCopyMapper.insertSelective(record);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
            logger.error("createTestBbbCopy", e);
        }

        return false;
    }

    @Override
    public boolean deleteTestBbbCopy(String id) {

        logger.info("deleteTestBbbCopy");
        try {

             int updates = testBbbCopyMapper.delete(id);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
             logger.error("deleteTestBbbCopy", e);
        }

        return false;
    }

    @Override
    public boolean updateTestBbbCopy(TestBbbCopy record) {

        logger.info("updateTestBbbCopy");
        try {

            int updates = testBbbCopyMapper.updateByPrimaryKeySelective(record);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
             logger.error("updateTestBbbCopy", e);
        }

        return false;
    }
}

