package com.schisandra.auth.domain.service.impl;

import com.schisandra.auth.domain.bo.SchisandraAuthPermissionBO;
import com.schisandra.auth.domain.convert.SchisandraAuthPermissionBOConverter;
import com.schisandra.auth.domain.service.SchisandraAuthPermissionDomainService;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
import com.schisandra.auth.infra.basic.service.SchisandraAuthPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class SchisandraAuthPermissionDomainServiceImpl implements SchisandraAuthPermissionDomainService {
    @Resource
    SchisandraAuthPermissionService schisandraAuthPermissionService;
    /** 
     * @description: 更新
     * @param: [schisandraAuthPermissionBO] 
     * @return: java.lang.Object 
     * @author zhang
     * @date: 2024/4/17 17:06
     */ 
    @Override
    public int update(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
        SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);
        return schisandraAuthPermissionService.update(schisandraAuthPermission);
    }
/** 
 * @description:  删除
 * @param: [schisandraAuthPermissionBO] 
 * @return: java.lang.Object 
 * @author zhang
 * @date: 2024/4/17 17:06
 */ 
    @Override
    public Object delete(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
        SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);
        boolean schisandraAuthPermission1 =schisandraAuthPermissionService.deleteById(schisandraAuthPermission.getId());
        return schisandraAuthPermission1;
    }
/** 
 * @description: 插入
 * @param: [schisandraAuthPermissionBO] 
 * @return: java.lang.Object 
 * @author zhang
 * @date: 2024/4/17 17:06
 */ 
    @Override
    public Object insert(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
        SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);
        SchisandraAuthPermission schisandraAuthPermission1 =schisandraAuthPermissionService.insert(schisandraAuthPermission);
        return schisandraAuthPermission1;
    }
/** 
 * @description: 查询 
 * @param: [schisandraAuthPermissionBO] 
 * @return: java.lang.Object 
 * @author zhang
 * @date: 2024/4/17 17:07
 */ 
    @Override
    public SchisandraAuthPermissionBO select(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {

        SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);

        SchisandraAuthPermission schisandraAuthPermission1 =schisandraAuthPermissionService.queryById(schisandraAuthPermission.getId());
        SchisandraAuthPermissionBO schisandraAuthPermissionBO1 = SchisandraAuthPermissionBOConverter.INSTANCE.convertEntityToBO(schisandraAuthPermission1);
        return schisandraAuthPermissionBO1;
    }
}
