摘要: num 为varchar 类型,按num 进行排序 select * from contest_info order by num asc 得到结果是按字典序排序,并不是预期中以数字大小排序。 若想让数字格式的字符串按数字大小排序,则SQL修改为: select * from contest_inf 阅读全文
posted @ 2020-02-24 23:09 加油鸭Starry 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 我们在使用主键自增的数据库时,有时候业务可能需要返回自增的主键值,然后利用这个值进行一些操作。 <insert id="saveUser" useGeneratedKeys="true" keyProperty="id"> INSERT INTO user_info( `nickname`, `gz 阅读全文
posted @ 2020-02-24 22:58 加油鸭Starry 阅读(876) 评论(0) 推荐(0) 编辑
摘要: 1 <update id="updateUser"> 2 UPDATE user_info SET 3 <if test="gzhOpenId != null and gzhOpenId !=''"> 4 gzh_openid = #{gzhOpenId}, 5 </if> 6 <if test=" 阅读全文
posted @ 2020-02-24 22:27 加油鸭Starry 阅读(522) 评论(0) 推荐(0) 编辑