<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.iocoder.mall.user.dao.MobileCodeMapper"> <insert id="insert" parameterType="MobileCodeDO"> INSERT INTO mobile_code ( id, mobile, code, today_index, used, used_uid, used_time, create_time ) VALUES ( #{id}, #{mobile}, #{code}, #{todayIndex}, #{used}, #{usedUid}, #{usedTime}, #{createTime} ) </insert> <update id="update" parameterType="MobileCodeDO"> UPDATE mobile_code <set> <if test="used != null"> used = #{used}, </if> <if test="usedUid != null"> used_uid = #{usedUid}, </if> <if test="usedTime != null"> used_time = #{usedTime}, </if> </set> WHERE id = #{id} </update> <select id="selectLast1ByMobile" parameterType="String" resultType="MobileCodeDO"> SELECT id, mobile, code, today_index, used, used_uid, used_time, create_time FROM mobile_code WHERE mobile = #{mobile} ORDER BY id DESC LIMIT 1 </select> </mapper>