package com.persagy.server.mappers

import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select
import org.springframework.stereotype.Repository

/**
 * 自定义 SQL
 *
 * @author wx  <zhangweixin@sagacloud.com>
 * @date  2020/10/15 21:12
 */
@Mapper
@Repository
interface CustomMapper {

    /**
     * 批量导入数据
     *
     * @param projectId  项目id
     * @param groudCode  集团编码
     */
    @Select("INSERT INTO dict.def_funcid_project(id,class_code,category,code,name,type,group_code,#{projectId},data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code) SELECT id,class_code,category,code,name,type,group_code,'Pj1101050029',data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code FROM  dict.def_funcid WHERE group_code =#{groudCode}")
    fun dictSchemeData(@Param("projectId") projectId: String,@Param("groudCode") groudCode: String)

    /**
     * 批量导入数据
     *
     * @param projectId  项目id
     * @param groudCode  集团编码
     */
    @Select("INSERT INTO dict.def_funcid_project(id,class_code,category,code,name,type,group_code,#{projectId},data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code) SELECT id,class_code,category,code,name,type,group_code,'Pj1101050029',data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code FROM  dict.def_funcid_scheme WHERE group_code =#{groudCode} AND scheme_id = 1")
    fun dictSchemeDataTwo(@Param("projectId") projectId: String,@Param("groudCode") groudCode: String)

    /**
     * 批量导入数据
     *
     * @param projectId  项目id
     * @param groudCode  集团编码
     */
    @Select("INSERT INTO dict.def_funcid_project(id,class_code,category,code,name,type,group_code,#{projectId},data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code) SELECT id,class_code,category,code,name,type,group_code,'Pj1101050029',data_type,formater,data_source,input_mode,first_tag,second_tag,idx,priority,unit,note,can_sub,is_multiple,is_region,sub_flag,readonly,visible,editable,sort,un_disabled,object_type,key_word,last_update,create_time,first_name,second_name,alias_code,alias_name,orig_data_type,orig_code FROM  dict.def_funcid_scheme WHERE group_code =#{groudCode} AND scheme_id = 2")
    fun dictSchemeDataWanDa(@Param("projectId") projectId: String,@Param("groudCode") groudCode: String)

}