package com.yonge.cooleshow.biz.dal.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import com.yonge.cooleshow.biz.dal.entity.TenantUnbindHistory;
import com.yonge.cooleshow.biz.dal.wrapper.TenantUnbindHistoryWrapper;
import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindHistoryMapper;
import com.yonge.cooleshow.biz.dal.service.TenantUnbindHistoryService;

/**
 * 机构解绑历史表
 * 2023-08-18 18:00:10
 */
@Slf4j
@Service
public class TenantUnbindHistoryServiceImpl extends ServiceImpl<TenantUnbindHistoryMapper, TenantUnbindHistory> implements TenantUnbindHistoryService {

    /**
     * 查询详情
     * @param id 详情ID
     * @return TenantUnbindHistory
     */
    @Override
    public TenantUnbindHistory detail(Long id) {

        return baseMapper.selectById(id);
    }

    /**
     * 分页查询
     * @param page IPage<TenantUnbindHistory>
     * @param query TenantUnbindHistoryWrapper.TenantUnbindHistoryQuery
     * @return IPage<TenantUnbindHistory>
     */
    @Override
    public IPage<TenantUnbindHistory> selectPage(IPage<TenantUnbindHistory> page, TenantUnbindHistoryWrapper.TenantUnbindHistoryQuery query) {

        return page.setRecords(baseMapper.selectPage(page, query));
    }

    /**
     * 添加
     * @param tenantUnbindHistory TenantUnbindHistoryWrapper.TenantUnbindHistory
     * @return Boolean
     */
    @Override
    public Boolean add(TenantUnbindHistoryWrapper.TenantUnbindHistory tenantUnbindHistory) {

        return this.save(JSON.parseObject(tenantUnbindHistory.jsonString(), TenantUnbindHistory.class));
    }

    /**
     * 更新
     * @param tenantUnbindHistory TenantUnbindHistoryWrapper.TenantUnbindHistory
     * @return Boolean
     */
    @Override
    public Boolean update(TenantUnbindHistoryWrapper.TenantUnbindHistory tenantUnbindHistory){

        return this.updateById(JSON.parseObject(tenantUnbindHistory.jsonString(), TenantUnbindHistory.class));
    }
}