package com.hzya.frame.sys.template.dao.impl;

import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.sys.entity.FormmainCheckDto;
import com.hzya.frame.sys.entity.FormmainDeleteDto;
import com.hzya.frame.sys.entity.FormmainDto;
import com.hzya.frame.sys.entity.ModuleDto;
import com.hzya.frame.sys.entity.TemplateQuery;
import com.hzya.frame.sys.template.entity.Template;
import com.hzya.frame.sys.template.dao.ITemplateMapper;
import com.hzya.frame.datasource.DataSourceUtil;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * @description: 模版表  dao
 * @tableName: sys_template
 * @entityName: Template
 * @author: gjh
 * @history:1.0
 */
@Service
public class TemplateMapperImpl extends MybatisGenericDao<Template, String> implements ITemplateMapper {

    @Override
    public Template entity_get(String id) {
        Template o = (Template) super.selectOne(getSqlIdPrifx() + "entity_get", id);
        return o;

    }

    @Override
    public Long getMaxSorts(Map<String, String> maps) {
        Long o = (Long) super.selectOne(getSqlIdPrifx() + "getMaxSorts", maps);
        return o;

    }

    @Override
    public Integer checkTable(Map<String, String> maps) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkTable", maps);
        return o;

    }

    @Override
    public Integer createTable(Map<String, Object> maps) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTable", maps);
        return o;
    }
    @Override
    public Integer alterTable(Map<String, String> maps) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps);
        return o;

    }    @Override
    public Integer alterTableName(Map<String, String> maps) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTableName", maps);
        return o;

    }

    @Override
    public HashMap<String, Object> getServiceTemplateDataById(Map<String, Object> maps) {
        HashMap<String, Object> o = (HashMap<String, Object>) super.selectOne(getSqlIdPrifx() + "getServiceTemplateDataById", maps);
        return o;

    }

    @Override
    public List<HashMap<String, Object>> getServiceTemplateDataByFormmainId(Map<String, Object> maps) {
        List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "getServiceTemplateDataByFormmainId", maps);
        return o;

    }

    @Override
    public String getTableName(String tableName) {
        String o = (String) super.selectOne(getSqlIdPrifx() + "getTableName", tableName);
        return o;

    }

    @Override
    public Integer dropTable(String tableName) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "dropTable", tableName);
        return o;

    }

    @Override
    public Template entity_get_by_service(String serviceName) {
        Template o = (Template) super.selectOne(getSqlIdPrifx() + "entity_get_by_service", serviceName);
        return o;

    }

    @Override
    public List<HashMap<String, Object>> getServiceTemplateData(TemplateQuery templateQuery) {
        List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "getServiceTemplateData", templateQuery);
        return o;

    }

    //查询 采用==查询   entity_list_base
    @Override
    public List<Template> entity_list_base(Template entity) {
        List<Template> o = super.query(getSqlIdPrifx() + "entity_list_base", entity);
        return o;

    }

    //  查询符合条件的数量
    @Override
    public Integer entity_count(Template entity) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count", entity);
        return o;

    }

    //分页查询列表 采用like格式 entity_list_like
    @Override
    public List<Template> entity_list_like(Template entity) {
        List<Template> o = super.query(getSqlIdPrifx() + "entity_list_like", entity);
        return o;

    }

    //查询列表 字段采用or格式   entity_list_or
    @Override
    public List<Template> entity_list_or(Template entity) {
        List<Template> o = super.query(getSqlIdPrifx() + "entity_list_or", entity);
        return o;

    }

    //新增  entity_insert
    @Override
    public Template entity_insert(Template entity) {
        entity = super.save(getSqlIdPrifx() + "entity_insert", entity);
        return entity;

    }

    //修改  entity_update
    @Override
    public Integer entity_update(Template entity) {
        Integer o = super.update(getSqlIdPrifx() + "entity_update", entity);
        return o;

    }

    //逻辑删除    entity_delete
    @Override
    public Integer entity_logicDelete(Template entity) {
        Integer o = super.delete(getSqlIdPrifx() + "entity_logicDelete", entity);
        return o;

    }

    //逻辑删除多条件
    @Override
    public Integer entity_logicDelete_Multi_Condition(Template entity) {
        Integer o = super.delete(getSqlIdPrifx() + "entity_logicDelete_Multi_Condition", entity);
        return o;

    }

    //物理删除
    @Override
    public Integer entity_delete(Template entity) {
        Integer o = super.delete(getSqlIdPrifx() + "entity_delete", entity);
        return o;
    }


    @Override
    public Integer deleteFormmain(Map<String, String> maps) {
        Integer o = super.delete(getSqlIdPrifx() + "deleteFormmain", maps);
        return o;

    }

    @Override
    public Integer deleteTemplateById(FormmainDeleteDto entity) {
        Integer o = super.delete(getSqlIdPrifx() + "deleteTemplateById", entity);
        return o;

    }

    //  查询符合条件的数量
    @Override
    public Integer checkData(FormmainCheckDto entity) {
        Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkData", entity);
        return o;

    }


    //新增  entity_insert
    @Override
    public Integer saveFram(FormmainDto entity) {
        Integer o = super.insert(getSqlIdPrifx() + "saveFram", entity);
        return o;

    }

    //修改  entity_update
    @Override
    public Integer update(FormmainDto entity) {
        Integer o = super.update(getSqlIdPrifx() + "update", entity);
        return o;

    }

    //修改  entity_update
    @Override
    public List<String> queryTemplateId(FormmainDeleteDto entity) {
        List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryTemplateId", entity);
        return o;

    }


    @Override
    public List<HashMap<String, Object>> queryTemplateData(ModuleDto entity) {
        List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryTemplateData", entity);
        return o;

    }

    @Override
    public List<HashMap<String, Object>> queryTemplateDataUp(ModuleDto entity) {
        List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryTemplateDataUp", entity);
        return o;

    }

    @Override
    public List<HashMap<String, Object>> queryTemplateDataAll(ModuleDto entity) {
        List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryTemplateDataAll", entity);
        return o;

    }

    @Override
    public HashMap<String, Object> queryTemplateDataOne(ModuleDto entity) {
        HashMap<String, Object> o = (HashMap<String, Object>) super.selectOne(getSqlIdPrifx() + "queryTemplateDataOne", entity);
        return o;

    }

}
