-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
自动填充字段问题 #265
Comments
而且拦截器可以有无限可能更适合业务也更能抽象而不是传入字符串将设计卡死 |
我觉得你是先入为主了,你也可以说下目前拦截器的缺点,因为拦截器可以在使用时动态启用禁用并且能支持他们没法支持的情况所以我目前还没找到mybatis-plus的那种方法优于我的地方如果有可以提出我们可以进行抉择 |
拦截器没啥大问题,为了灵活拦截器是必须的,mybatis-plus的那种说白了也就是类似于一个拦截器去处理字段。只是我觉得像create_time,update_time这种应该算是一种比较通用代码,完全可以做成框架的一部分,因为像create_time和update_time这种字段基本上玩不出什么花来,完全可以交给框架去管理,做成一种配置或者注解。像在php的orm里面基本上都是用户配置一下create_time和update_time的字段名,是否开启时间自动填充之类的,剩下的框架会去帮你完成填充,而完全不需要用户去再去定义一个拦截器去实现这些功能。当然,其他字段要做灵活的处理还是得用拦截器的 |
像create_time和update_time这种字段有自动填充注解的实现么?看了官网貌似只有拦截器来实现自动填充。虽然说一个项目基本上写一次就行了,但是总感觉有点啰嗦。像mybatis-flex这些都是有注解或者@column上有字段可选。为啥不弄一个注解或者@column字段去实现呢?会有什么弊端么?
The text was updated successfully, but these errors were encountered: