package com.schisandra.oss.infra.basic.service.impl;

import com.schisandra.oss.infra.basic.entity.SchisandraOssJdbc;
import com.schisandra.oss.infra.basic.dao.SchisandraOssJdbcDao;
import com.schisandra.oss.infra.basic.service.SchisandraOssJdbcService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * jdbc存储配置表 表服务实现类
 *
 * @author landaiqing
 * @since 2024-06-02 22:08:16
 */
@Service("SchisandraOssJdbcService")
public class SchisandraOssJdbcServiceImpl implements SchisandraOssJdbcService {

    @Resource
    private SchisandraOssJdbcDao schisandraOssJdbcDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SchisandraOssJdbc queryById(Long id) {
        return this.schisandraOssJdbcDao.selectOneById(id);
    }

    /**
     * 新增数据
     *
     * @param schisandraOssJdbc 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(SchisandraOssJdbc schisandraOssJdbc) {
        return this.schisandraOssJdbcDao.insert(schisandraOssJdbc,true);
    }

    /**
     * 修改数据
     *
     * @param schisandraOssJdbc 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SchisandraOssJdbc schisandraOssJdbc) {
        return this.schisandraOssJdbcDao.update(schisandraOssJdbc,true);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.schisandraOssJdbcDao.deleteById(id) > 0;
    }


}
