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.TenantTeacherAccountRecord;
import com.yonge.cooleshow.biz.dal.wrapper.TenantTeacherAccountRecordWrapper;
import com.yonge.cooleshow.biz.dal.mapper.TenantTeacherAccountRecordMapper;
import com.yonge.cooleshow.biz.dal.service.TenantTeacherAccountRecordService;

/**
 * 机构老师流水表
 * 2023-10-09 17:39:42
 */
@Slf4j
@Service
public class TenantTeacherAccountRecordServiceImpl extends ServiceImpl<TenantTeacherAccountRecordMapper, TenantTeacherAccountRecord> implements TenantTeacherAccountRecordService {

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

    /**
     * 更新
     * @param tenantTeacherAccountRecord TenantTeacherAccountRecordWrapper.TenantTeacherAccountRecord
     * @return Boolean
     */
    @Override
    public Boolean update(TenantTeacherAccountRecordWrapper.TenantTeacherAccountRecord tenantTeacherAccountRecord){

        return this.updateById(JSON.parseObject(tenantTeacherAccountRecord.jsonString(), TenantTeacherAccountRecord.class));       
    }
}