package com.persagy.labsl.services

import com.persagy.labsl.models.entities.auxiliary.CategoryCode
import com.persagy.labsl.models.entities.tpt.Graph
import com.persagy.labsl.models.entities.tpt.pub.GraphPub
import com.persagy.labsl.services.mappers.CustomMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

/**
 * 自定义SQL 服务
 *
 * @author wx  <zhangweixin@sagacloud.com>
 * @date  2020/9/17 12:09
 */
@Service
class CustomService {

    /** 实例化 mapper 对象 */
    @Autowired
    lateinit var customMapper: CustomMapper

    /**
     * 草稿箱 已有类型
     *
     * @param projectId     项目id
     * @return 类型列表
     */
    fun draftsCategory(projectId: String): ArrayList<CategoryCode>?{
        return customMapper.calcAffected(projectId)
    }

    /**
     * 已发布 类型
     *
     * @param projectId     项目id
     * @return 类型列表
     */
    fun pubCategory(projectId: String): ArrayList<CategoryCode>?{
        return customMapper.pubCategory(projectId)
    }

    /**
     * 查询标签,已发布
     *
     * @param label
     */
    fun containLabelPub(projectId: String ,label: String): ArrayList<GraphPub>? {
        return customMapper.containLabelPub(projectId,label)
    }

    /**
     * 查询标签，未发布
     *
     * @param label
     */
    fun containLabel(projectId: String ,label: String): ArrayList<Graph>? {
        return customMapper.containLabel(projectId,label)
    }

}