第一周

第一周

1.mybatis puls 三种继承父类,实现CRUD

service层,mapper接口,实体类

2.mysql外键创建失败

Mysql无法创建外键的原因_鹏霄万里展雄飞-CSDN博客

本次问题:外键表中不存在对应的值,所以报错

3.复制表结构后,插入数据,id是从被复制表的最后的id自增开始

4.模糊映射

Ambiguous handler methods mapped for 'xxx'的解决办法_蜗牛敲代码的博客-CSDN博客

5.nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression

使用mybatis plus的动态拼接sql出错

6.mysql外键四种类型

【0016】MySQL外键约束删除时和更新时各取值的含义_PMAPI-CSDN博客_外键删除时和更新时

7.mysql中char、varchar、text

(1) char长度固定, 即每条数据占用等长字节空间;适合用在身份证号码、手机号码等定。

(2) varchar可变长度,可以设置最大长度;适合用在长度可变的属性。

(3) text不设置长度, 当不知道属性的最大长度时,适合用text。

8.使用LocalDateTime替换Date

9.将数组转换为以逗号拼接的字符串

StringUtils.join(array, ",")

10.文件传递用MultipartFile

11.postman接口测试报错

{
    "status": 500,
    "message": "Content type 'multipart/form-data;boundary=-------------------------482952711842310603252824;charset=UTF-8' not supported",
    "timestamp": 1629432700164
}

测试时去掉接口中的@RequestBody注解,对接的时候再加上就好了😊

12.SQLFeatureNotSupportedException

使用了LocalDateTime,mybatis plus + druid 版本的问题,改版本就好了,或者将LocalDateTime改为Date

13.mybatis plus的getbyid或者save方法,用的是实体类的setter,所有对应的字段名不能自己定义

(18条消息) mybatis-plus和mybatis实体名和数据库字段映射问题_ohoy的博客-CSDN博客_mybatisplus字段映射

14.逻辑删除

@TableLogic(value = "0",delval = "1")

或者

mybatis-plus:
  mapper-locations: classpath:/mapper/**/*.xml
  global-config:
    db-config:
      id-type: auto  #自增主键
      logic-delete-field: flag  # 全局逻辑删除的实体字段名
      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)

15.分页插件结合mybatis plus使用

PageHelper.startPage(pageNum, pageSize);

16.Disconnected from the target VM

IDEA debug时遇到 Disconnected from the target VM, address: '127.0.0.1:59794', transport: 'socket':

因为程序有错,没有输出内容,恰巧无报错提示,所以在启动后,立刻给出了该提示信息,这个并不是错误信息😂。

当然也有可能是别的问题产生的这个提示。此情况只针对于马虎的自己。

17.log不输出到控制台

没有任何改动,又可以输出了,估计是idea卡顿的问题

18.Test class should have exactly one public constructor

采用junit测试,需要有个无参构造😉

19.在使用StringBuilder.append()拼接警告:

String concatenation as argument to 'StringBuffer.append()' call less... (Ctrl+F1)

Reports String concatenation used as the argument to StringBuffer.append(),StringBuilder.append() orAppendable.append(). Such calls may profitably be turned into chained append calls on the existingStringBuffer/Builder/Appendable, saving the cost of an extraStringBuffer/Builder allocation.

This inspection ignores compile time evaluated String concatenations, which when converted to chained append calls would only worsen performance.

使用不规范导致,append中使用了“+”号,不过可以忽略,要是全用append,对于代码理解起来可要老命了😆

posted @ 2021-08-22 23:21  intTom  阅读(47)  评论(0编辑  收藏  举报