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

import com.schisandra.oss.infra.basic.entity.SchisandraOssJdbcStore;
import com.schisandra.oss.infra.basic.dao.SchisandraOssJdbcStoreDao;
import com.schisandra.oss.infra.basic.service.SchisandraOssJdbcStoreService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * jdbc存储信息表 表服务实现类
 *
 * @author landaiqing
 * @since 2024-06-02 22:11:22
 */
@Service("SchisandraOssJdbcStoreService")
public class SchisandraOssJdbcStoreServiceImpl implements SchisandraOssJdbcStoreService {

    @Resource
    private SchisandraOssJdbcStoreDao schisandraOssJdbcStoreDao;

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

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

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

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


}
