package com.rongwei.bscommon.sys.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rongwei.bsentity.domain.NewSysMindMappingDo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface NewSysMindMappingDao extends BaseMapper<NewSysMindMappingDo> {

    @Select("SELECT * FROM sys_mind_mapping WHERE DELETED = 0 AND BSID = #{bsid}")
    List<NewSysMindMappingDo> getSysMindMappingByMainId(@Param("bsid") String bsid);

    @Select("SELECT\n" +
            "\t* \n" +
            "FROM\n" +
            "\tsys_mind_mapping \n" +
            "WHERE\n" +
            "\tDELETED = 0 \n" +
            "\tAND BSID = #{bsid} \n" +
            "\tAND LEVEL = #{level}\n" +
            "\tAND ROPTION LIKE CONCAT('%',#{roption},'%')")
    NewSysMindMappingDo getDataInfo(@Param("bsid") String bsid,@Param("roption")String roption,@Param("level")Integer level);


    @Update("UPDATE sys_mind_mapping SET ID = #{newid} WHERE ID = #{id}")
    void updateDataInfo(@Param("id") String id, @Param("newid") String newid);
}
