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.TestSqlserverAaa;
import com.izouma.awesomeadmin.service.TestSqlserverAaaService;
import com.izouma.awesomeadmin.dao.TestSqlserverAaaMapper;

/**
*  service接口实现类
*/
@Service
public class TestSqlserverAaaServiceImpl implements TestSqlserverAaaService{

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

    @Autowired
    private TestSqlserverAaaMapper testSqlserverAaaMapper;

    @Override
    public List<TestSqlserverAaa> getTestSqlserverAaaList(TestSqlserverAaa record) {

        logger.info("getTestSqlserverAaaList");
        try {

        return testSqlserverAaaMapper.queryAllTestSqlserverAaa(record);
        } catch (Exception e) {
        logger.error("getTestSqlserverAaaList", e);
        }

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

        logger.info("getTestSqlserverAaaByPage");
        try {

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

        return testSqlserverAaaMapper.queryTestSqlserverAaaByPage(parameter);
        } catch (Exception e) {
        logger.error("getTestSqlserverAaaByPage", e);
        }

        return null;
    }

    @Override
    public TestSqlserverAaa getTestSqlserverAaaById(String id) {

        logger.info("getTestSqlserverAaayId");
        try {

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

        return null;
    }

    @Override
    public TestSqlserverAaa getTestSqlserverAaa(TestSqlserverAaa record) {

        logger.info("getTestSqlserverAaa");
        try {

            return testSqlserverAaaMapper.queryTestSqlserverAaa(record);
        } catch (Exception e) {
        logger.error("getTestSqlserverAaa", e);
        }

        return null;
    }

    @Override
    public boolean createTestSqlserverAaa(TestSqlserverAaa record) {

        logger.info("createTestSqlserverAaa");
        try {

            int updates = testSqlserverAaaMapper.insertSelective(record);

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

        return false;
    }

    @Override
    public boolean deleteTestSqlserverAaa(String id) {

        logger.info("deleteTestSqlserverAaa");
        try {

             int updates = testSqlserverAaaMapper.delete(id);

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

        return false;
    }

    @Override
    public boolean updateTestSqlserverAaa(TestSqlserverAaa record) {

        logger.info("updateTestSqlserverAaa");
        try {

            int updates = testSqlserverAaaMapper.updateByPrimaryKeySelective(record);

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

        return false;
    }
}

