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.TenantEntryRecord;
import com.yonge.cooleshow.biz.dal.wrapper.TenantEntryRecordWrapper;
import com.yonge.cooleshow.biz.dal.mapper.TenantEntryRecordMapper;
import com.yonge.cooleshow.biz.dal.service.TenantEntryRecordService;

/**
 * 机构入驻审核记录
 * 2023-07-21 17:32:49
 */
@Slf4j
@Service
public class TenantEntryRecordServiceImpl extends ServiceImpl<TenantEntryRecordMapper, TenantEntryRecord> implements TenantEntryRecordService {

	/**
     * 查询详情
     * @param id 详情ID
     * @return TenantEntryRecord
     */
	@Override
    public TenantEntryRecord detail(Long id) {
        
        return baseMapper.selectById(id);
    }
    
    /**
     * 分页查询
     * @param page IPage<TenantEntryRecord>
     * @param query TenantEntryRecordWrapper.TenantEntryRecordQuery
     * @return IPage<TenantEntryRecord>
     */
    @Override
    public IPage<TenantEntryRecord> selectPage(IPage<TenantEntryRecord> page, TenantEntryRecordWrapper.TenantEntryRecordQuery query) {
        
        return page.setRecords(baseMapper.selectPage(page, query));
    }
	
    /**
     * 添加
     * @param tenantEntryRecord TenantEntryRecordWrapper.TenantEntryRecord
     * @return Boolean
     */
    @Override
    public Boolean add(TenantEntryRecordWrapper.TenantEntryRecord tenantEntryRecord) {    	
        
        return this.save(JSON.parseObject(tenantEntryRecord.jsonString(), TenantEntryRecord.class));
    }

    /**
     * 更新
     * @param tenantEntryRecord TenantEntryRecordWrapper.TenantEntryRecord
     * @return Boolean
     */
    @Override
    public Boolean update(TenantEntryRecordWrapper.TenantEntryRecord tenantEntryRecord){

        return this.updateById(JSON.parseObject(tenantEntryRecord.jsonString(), TenantEntryRecord.class));       
    }
}