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

import com.schisandra.oss.infra.basic.entity.SchisandraOssJdbcData;
import com.schisandra.oss.infra.basic.dao.SchisandraOssJdbcDataDao;
import com.schisandra.oss.infra.basic.service.SchisandraOssJdbcDataService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * jdbc存储数据表 表服务实现类
 *
 * @author landaiqing
 * @since 2024-06-02 22:08:55
 */
@Service("SchisandraOssJdbcDataService")
public class SchisandraOssJdbcDataServiceImpl implements SchisandraOssJdbcDataService {

    @Resource
    private SchisandraOssJdbcDataDao schisandraOssJdbcDataDao;

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

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

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

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


}
