mysql默认值不起作用
时间:2019-10-23
本文章向大家介绍mysql默认值不起作用,主要包括mysql默认值不起作用使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
记录一下,mysql默认值起作用了,只是insert 的时候字段没有判断null或者空,导致默认值被覆盖,改为如下添加
<insert id="save" parameterType="com.bootdo.stock.domain.GoodsManageDO" useGeneratedKeys="true" keyProperty="goodsManageId"> insert into stock_goods_manage <trim prefix="(" suffix=")" suffixOverrides=","> <if test="deptId != null and deptId != '' ">dept_id,</if> <if test="semesterId != null and semesterId != '' ">semester_id,</if> <if test="inTotalNum != null and inTotalNum != '' ">in_total_num,</if> <if test="outTotalNum != null and outTotalNum != '' ">out_total_num,</if> <if test="planInNum != null and planInNum != '' ">plan_in_num,</if> <if test="planOutNum != null and planOutNum != '' ">plan_out_num,</if> <if test="temporaryInNum != null and temporaryInNum != '' ">temporary_in_num,</if> <if test="temporaryOutNum != null and temporaryOutNum != '' ">temporary_out_num,</if> <if test="checkTotalNum != null and checkTotalNum != '' ">check_total_num,</if> <if test="totalNum != null and totalNum != '' ">total_num,</if> <if test="startSemesterNum != null and startSemesterNum != '' ">start_semester_num,</if> <if test="endSemesterNum != null and endSemesterNum != '' ">end_semester_num,</if> <if test="goodsId != null and goodsId != '' ">goods_id,</if> <if test="goodsCode != null and goodsCode != '' ">goods_code,</if> <if test="goodsName != null and goodsName != '' ">goods_name,</if> <if test="goodsAbb != null and goodsAbb != '' ">goods_abb,</if> <if test="model != null and model != '' ">model,</if> <if test="unit != null and unit != '' ">unit,</if> <if test="kind != null and kind != '' ">kind,</if> <if test="price != null and price != '' ">price,</if> <if test="remark != null and remark != '' ">remark</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="deptId != null and deptId != '' ">#{deptId},</if> <if test="semesterId != null and semesterId != '' ">#{semesterId},</if> <if test="inTotalNum != null and inTotalNum != '' ">#{inTotalNum},</if> <if test="outTotalNum != null and outTotalNum != '' ">#{outTotalNum},</if> <if test="planInNum != null and planInNum != '' ">#{planInNum},</if> <if test="planOutNum != null and planOutNum != '' ">#{planOutNum},</if> <if test="temporaryInNum != null and temporaryInNum != '' ">#{temporaryInNum},</if> <if test="temporaryOutNum != null and temporaryOutNum != '' ">#{temporaryOutNum},</if> <if test="checkTotalNum != null and checkTotalNum != '' ">#{checkTotalNum},</if> <if test="totalNum != null and totalNum != '' ">#{totalNum},</if> <if test="startSemesterNum != null and startSemesterNum != '' ">#{startSemesterNum},</if> <if test="endSemesterNum != null and endSemesterNum != '' ">#{endSemesterNum},</if> <if test="goodsId != null and goodsId != '' ">#{goodsId},</if> <if test="goodsCode != null and goodsCode != '' ">#{goodsCode},</if> <if test="goodsName != null and goodsName != '' ">#{goodsName},</if> <if test="goodsAbb != null and goodsAbb != '' ">#{goodsAbb},</if> <if test="model != null and model != '' ">#{model},</if> <if test="unit != null and unit != '' ">#{unit},</if> <if test="kind != null and kind != '' ">#{kind},</if> <if test="price != null and price != '' ">#{price},</if> <if test="remark != null and remark != '' ">#{remark}</if> </trim> </insert>
原文地址:https://www.cnblogs.com/person008/p/11726464.html
- CaseStudy(showcase)界面篇-导出xaml以及放入Blend的技巧
- [Silverlight动画]转向行为 - 避开行为
- CaseStudy(showcase)界面篇-desing设计界面
- [Silverlight动画]转向行为 - 寻找行为
- 【数字货币】数字黄金
- [Silverlight动画]转向行为 - 转向机车
- [Silverlight动画]转向行为 - 机车
- 微信、小游戏与未来
- [Silverlight动画]转向行为 - 2D向量
- [Silverlight动画]转向行为 - 介绍
- WCF技术剖析之十七:消息(Message)详解(中篇)
- flash游戏引擎整理
- [Silverlight动画]转向行为 - 群落
- [Silverlight动画]转向行为 - 路径跟随
- MySQL 教程
- MySQL 安装
- MySQL 管理与配置
- MySQL PHP 语法
- MySQL 连接
- MySQL 创建数据库
- MySQL 删除数据库
- MySQL 选择数据库
- MySQL 数据类型
- MySQL 创建数据表
- MySQL 删除数据表
- MySQL 插入数据
- MySQL 查询数据
- MySQL where 子句
- MySQL UPDATE 查询
- MySQL DELETE 语句
- MySQL LIKE 子句
- mysql order by
- Mysql Join的使用
- MySQL NULL 值处理
- MySQL 正则表达式
- MySQL 事务
- MySQL ALTER命令
- MySQL 索引
- MySQL 临时表
- MySQL 复制表
- 查看MySQL 元数据
- MySQL 序列 AUTO_INCREMENT
- MySQL 处理重复数据
- MySQL 及 SQL 注入
- MySQL 导出数据
- MySQL 导入数据
- MYSQL 函数大全
- MySQL Group By 实例讲解
- MySQL Max()函数实例讲解
- mysql count函数实例
- MYSQL UNION和UNION ALL实例
- MySQL IN 用法
- MySQL between and 实例讲解