通用设计字段
id_ucp_doc_ver bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
remark varchar(512) character set utf8mb4 collate utf8mb4_bin not null comment '备注',
created_by varchar(128) character set utf8mb4 collate utf8mb4_bin not null comment '创建人',
date_created datetime not null default current_timestamp comment '创建时间',
updated_by varchar(128) character set utf8mb4 collate utf8mb4_bin not null comment '修改人',
date_updated datetime not null default current_timestamp comment '修改时间'
mysql中给表名、字段名加``是为了防关键字报错,有关键字再加,上面的时间用now()传入即可
utf8mb4_bin区分大小写(针对表中的数据)、utf8mb4_general_ci(不区分大小写)
<if test="status != null and status !=''"> 只用于字符串(最好是过滤下空字符串,避免数据库多一些层扫描),数字类型为0的话status !=''会返回false
String str ="A"; <if test="str!= null and str == 'A'">有Bug,应该改为<if test='str!= null and str == "A"'>
短数字可以设置成short
写的时候最好加上jdbcType,否则插入null的时候可能会报错,只识别大写
#{name,jdbcType=VARCHAR}
#{priority,jdbcType=DECIMAL}
#{dateCreated,jdbcType=TIMESTAMP}
mysql中substr(str,pos,len)和substring(str,pos,len)用法一样,从1开始
instr(str,substr) 返回substr的起始索引
merge操作,依赖索引
insert into table_name (col1,...) values (#{val1}...) on duplicate key update col1=#{val1}...
mysql支持正则,但是和java不完全一样,^代表开始 .*代表任何多的字符串
name REGEXP "^.*[1-9][0-9]{5}([20])((0[3-9])|(1[0-9]))((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)[0-9]{3}[0-9Xx].*"
创建同样的表结构
create table BAK_1105_1272_133607 like `ucp_work_executor_define`;
navicat导入使用txt性能更好
mysql判断空也是is null ,timestamp格式可以和字符串日期直接用>比较
longtext可以用string接收
2237

被折叠的 条评论
为什么被折叠?



