其实很早之前更新过MySQL的语法,但是迟迟不更新的原因,因为缺少MyBatisPlus的语法习惯和,今天阅读这个若依框架的MyBatis部分,进一步巩固我的语法习惯。
- 第一条语法习惯
使用sql/include标签,用于包含查询SQL
<sql id="selectOperLogVo">
select oper_id, title, business_type, method,
from sys_oper_log
</sql>
2.第二条语法习惯
使用where/if(set/if)标签进行判空处理
备注:这里的if判断是对来自bo实体类的数据进行判空
- 查询语句
<where>
<if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%')
</if>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<where>
- update修改语句
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
后端,前端所有东西到今天为止,绝大多数已经完结,后续笔记将进行修修补补,和对未来技术的探索。下一章有可能更新roslib.js,three.js,web3.js