package com.sdtool.business.dao;

import com.dySweetFishPlugin.sql.dao.*;
import com.sdtool.common.entity.design.*;
import com.sweetfish.source.PageFlipper;
import org.rex.RMap;

import java.util.List;

public interface DesignDao extends DaoRepository {
    //region 设计字体
    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "selectDesignFonts", table = "dedesignfont", params = {1})
    List<DesignFont> selectDesignFonts(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
                                       PageFlipper pageFlipper);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "addDesignFont", table = "dedesignfont", params = {1})
    void addDesignFont(DesignFont designFont, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "voidDesignFont", table = "dedesignfont", params = {1})
    void voidDesignFont(DesignFont designFont, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
    //endregion

    //region 设计模板
    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "selectDesignTemplates", table = "dedesigntemplate,detemplatetag", params = {1})
    List<DesignTemplate> selectDesignTemplates(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
                                               PageFlipper pageFlipper);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "selectDesignTemplateItems", table = "dedesigntemplateitem", params = {1})
    List<DesignTemplateItem> selectDesignTemplateItems(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplate", table = "dedesigntemplate", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplateItem", table = "dedesigntemplateitem", params = {2}, sort = 2)
    void addDesignTemplate(DesignTemplate designTemplate, List<DesignTemplateItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "updateDesignTemplate", table = "dedesigntemplate", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "deleteDesignTemplateItem", table = "dedesigntemplateitem", params = {1}, sort = 2)
    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplateItem", table = "dedesigntemplateitem", params = {2}, sort = 3)
    void updateDesignTemplate(DesignTemplate designTemplate, List<DesignTemplateItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "updateDesignTemplateThumb", table = "dedesigntemplate", params = {1})
    void updateDesignTemplateThumb(DesignTemplate designTemplate, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "voidDesignTemplate", table = "dedesigntemplate", params = {1})
    void voidDesignTemplate(DesignTemplate designTemplate, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
    //endregion

    //region 设计订单
    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "selectDesignOrders", table = "dedesignorder", params = {1})
    List<DesignOrder> selectDesignOrders(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
                                         PageFlipper pageFlipper);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "selectDesignOrderItems", table = "dedesignorderitem", params = {1})
    List<DesignOrderItem> selectDesignOrderItems(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "addDesignOrder", table = "deDesignOrder", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "addDesignOrderItem", table = "deDesignOrderItem", params = {2}, sort = 2)
    void addDesignOrder(DesignOrder designOrder, List<DesignOrderItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "updateDesignOrder", table = "deDesignOrder", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "deleteDesignOrderItem", table = "deDesignOrderItem", params = {1}, sort = 2)
    @SqlId(clazz = DesignDao.class, sql = "addDesignOrderItem", table = "deDesignOrderItem", params = {2}, sort = 3)
    void updateDesignOrder(DesignOrder designOrder, List<DesignOrderItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "pdfCallbackDesignOrder", table = "deDesignOrder", params = {1}, sort = 1)
    void pdfCallbackDesignOrder(DesignOrder designOrder, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
    //endregion

    //region 模板标签档案
    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "queryDesignTagType", table = "deDesignTagType", params = {1})
    List<DesignTagType> queryDesignTagType(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "queryDesignTagType", table = "deDesignTagType", params = {1})
    List<DesignTagType> queryDesignTagType(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode, PageFlipper pageFlipper);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "getDesignTagType", table = "deDesignTagType", params = {1}, sort = 1)
    DesignTagType getDesignTagType(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "newDesignTagType", table = "deDesignTagType", params = {1}, sort = 1)
    void newDesignTagType(DesignTagType designTagType, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "deleteDesignTagType", table = "deDesignTagType", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "changeTagType", table = "deDesignTag", params = {2}, sort = 2)
    void deleteDesignTagType(List<DesignTagType> designTagTypes, List<DesignTag> tagList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "updateDesignTagType", table = "deDesignTagType", params = {1}, sort = 1)
    void updateDesignTagType(DesignTagType designTagType, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "queryDesignTags", table = "deDesignTag", params = {1})
    List<DesignTag> queryDesignTags(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
                                    PageFlipper pageFlipper);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "queryDesignTags", table = "deDesignTag", params = {1})
    List<DesignTag> queryDesignTags(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "newDesignTag", table = "deDesignTag", params = {1}, sort = 1)
    void newDesignTag(DesignTag designTag, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "changeTagType", table = "deDesignTag", params = {1}, sort = 1)
    void changeTagType(List<DesignTag> tagList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "deleteDesignTag", table = "deDesignTag", params = {1}, sort = 1)
    void deleteDesignTag(DesignTag designTag, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
    //endregion

    //region 模板标签
    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
    @SqlId(clazz = DesignDao.class, sql = "getTemplateTags", table = "deTemplateTag", params = {1})
    List<TemplateTag> getTemplateTags(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);

    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
    @SqlId(clazz = DesignDao.class, sql = "deleteTemplateTag", table = "deTemplateTag", params = {1}, sort = 1)
    @SqlId(clazz = DesignDao.class, sql = "addTemplateTag", table = "deTemplateTag", params = {2}, sort = 2)
    void modifyTemplateTags(RMap params, List<TemplateTag> tagList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
    //endregion

}
