package com.ruoyi.ibs.draw.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ibs.draw.domain.entity.DrawShape;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Author 吴凯程
 * @Date 2024/12/20
 **/
public interface DrawShapeMapper extends BaseMapper<DrawShape> {
    @Update("UPDATE draw_shape SET batch_flag = #{batch_flag} WHERE shape_id = #{shape_id}")
    int updateBatchFlag(@Param("shape_id") Long shapeId, @Param("batch_flag") Boolean batchFlag);

    @Select("SELECT a.grid_name from grid_draw_grid a left join grid_draw_shape_relate b on a.grid_id = b.grid_id " +
            "where a.delete_flag = '0' and b.delete_flag = '0' and b.shape_id = #{shapeId}")
    String getGridNameByShapeId(@Param("shapeId") Long shapeId);
}
