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


import com.schisandra.auth.infra.basic.dao.SchisandraAuthUserRoleDao;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUserRole;
import com.schisandra.auth.infra.basic.service.SchisandraAuthUserRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;


/**
 *  表服务实现类
 *
 * @author zlg
 * @since 2024-05-25 18:05:40
 */
@Service("SchisandraAuthUserRoleService")
public class SchisandraAuthUserRoleServiceImpl implements SchisandraAuthUserRoleService {

    @Resource
    private SchisandraAuthUserRoleDao schisandraAuthUserRoleDao;

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

    /**
     * 新增数据
     *
     * @param schisandraAuthUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(SchisandraAuthUserRole schisandraAuthUserRole) {
        return this.schisandraAuthUserRoleDao.insert(schisandraAuthUserRole);
    }

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

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


}
