**
试用码云gitee上开源项目"小威架构 / boot-backend"的代码生成器遇到的坑
**
源码地址:
https://gitee.com/zhang.w/boot-backend
该项目的代码生成器,只需要项目跑起来时对应的数据库里有对应的表就可以生成Controller,DAO,Model,用的MyBatis,还生成了对应的.xml和前端的代码;
但是生成的.xml有坑,我以jhipster的Jhi_user表来生成的.xml,在update里,#{password_hash}参数是有误的,应该改为#{passwordHash}才行,并且对所有的表的字段为A_B的字段兼容性都是这样的问题;
刚生成出来的代码,就要包这个异常,就是因为MyBatis的.xml没生成好,适配性不强,唉,还是jhipster牛啊,选择代码生成器要慎重啊!
另说,生成的前端代码也有问题,我数据库表的bit字段,是boolean类型的,生成实体类竟然变成String类型,我表里没有要求非空约束的,前端也做了非空约束的要求;对时间出来还不够友好,传的是时间类型的字符串;这些可能都是这个开源项目没能火起来的原因吧!更新时间停在了2年前…
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'password_hash' in 'class com.zw.admin.server.model.JhiUser'at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:419)at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:79)at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)... 77 common frames omitted