- 修改数据库连接URL地址 - 为所有实体类添加@TableField注解映射数据库字段 - 使用反引号标识符包裹表名和字段名 - 更新SQL查询语句使用明确字段列表 - 在配置文件中启用MyBatis安全模式防止SQL注入 - 添加MarkdownFileVO中groupingName字段的exist = false标识
26 lines
973 B
Java
26 lines
973 B
Java
package com.test.bijihoudaun.mapper;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.test.bijihoudaun.entity.Grouping;
|
|
import org.apache.ibatis.annotations.Delete;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface GroupingMapper extends BaseMapper<Grouping> {
|
|
|
|
@Select("SELECT id, parentId, `grouping`, is_deleted, deleted_at, deleted_by FROM `grouping` WHERE is_deleted = 1")
|
|
List<Grouping> selectDeleted();
|
|
|
|
@Delete("DELETE FROM `grouping` WHERE id = #{id}")
|
|
void physicalDeleteById(@Param("id") Long id);
|
|
|
|
@Update("UPDATE `grouping` SET is_deleted = 0, deleted_at = NULL, deleted_by = NULL WHERE id = #{id}")
|
|
void restoreById(@Param("id") Long id);
|
|
@Delete("DELETE FROM `grouping` WHERE is_deleted = 1")
|
|
void physicalDeleteByIsDeleted();
|
|
} |