package cn.ibizlab.core.data.service.impl;

import cn.ibizlab.core.data.domain.DOModel;
import cn.ibizlab.core.data.domain.DOModel;
import cn.ibizlab.core.data.dto.BaseData;
import cn.ibizlab.core.data.dto.DbDataQuery;
import cn.ibizlab.core.data.filter.DOModelSearchContext;
import cn.ibizlab.core.data.mapper.DbDataMapper;
import cn.ibizlab.core.data.service.IDOModelService;
import cn.ibizlab.core.data.service.IDataService;
import cn.ibizlab.util.filter.SearchContextBase;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 实体[业务实体] 无存储服务对象接口实现
 */
@Slf4j
@Service
public class DbDataServiceImpl extends BaseDataService {


    @Autowired
    private DbDataMapper dbDataMapper;

    @Override
    public boolean create(DOModel model, String datasource, BaseData et)
    {
        return dbDataMapper.insertData(model.getDefaultPOSchema().build(),et)==1;
    }

    @Override
    public void createBatch(DOModel model, String datasource, List<BaseData> list)
    {

    }

    @Override
    public boolean update(DOModel model, String datasource, BaseData et)
    {
        dbDataMapper.updateData(model.getDefaultPOSchema().build(),et);
        return true;
    }

    @Override
    public void updateBatch(DOModel model, String datasource, List<BaseData> list)
    {

    }

    @Override
    public boolean remove(DOModel model, String datasource, Serializable key)
    {
        return false;
    }

    @Override
    public void removeBatch(DOModel model, String datasource, List<Serializable> idList)
    {

    }

    @Override
    public BaseData get(DOModel model, String datasource, Serializable key)
    {
        return null;
    }

    @Override
    public BaseData getDraft(DOModel model, String datasource, BaseData et)
    {
        return null;
    }

    @Override
    public boolean checkKey(DOModel model, String datasource, BaseData et)
    {
        return false;
    }

    @Override
    public boolean save(DOModel model, String datasource, BaseData et)
    {
        return false;
    }

    @Override
    public void saveBatch(DOModel model, String datasource, List<BaseData> list)
    {

    }

    @Override
    public Page<BaseData> fetch(DOModel model, String dataSet, String datasource, SearchContextBase context)
    {
        return null;
    }

    @Override
    public List<BaseData> list(DOModel model, String dataSet, String datasource, SearchContextBase context)
    {
        return null;
    }


}


