注意点

注意点

  1. 缓存key 要有一个前缀 方便管理

  2. 必须做参数校验 ,不要相信 前端传过来的参数 ,保证代码的健壮性

  3. 全局异常处理
    eg:
    @ControllerAdvice
    public class BaseExceptionHandler {

    /***

    • 异常处理
    • @param e
    • @return
      */
      @ExceptionHandler(value = Exception.class)
      @ResponseBody
      public Result error(Exception e) {
      e.printStackTrace();
      return new Result(false, StatusCode.ERROR, e.getMessage());
      }
      }
  4. for循环中不允许有交互连接(数据库的连接与Redis的连接)

  5. 软删除 主表与字表的关联

原文地址:https://www.cnblogs.com/harper2/p/14165651.html