zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?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="com.example.springboot.mapper.UserMapper"> 
       <select id="update">
           update user
           <set>
             <if test="name!=null and date!=''">
               name = #{name},
             </if>
              <if test="date!=null and date!=''">
               date = #{date},
              </if>
               <if test="address!=null and address!=''">
                address = #{address},
               </if> 
              <if test="userNo!=null and userNo!=''">
              user_no = #{userNo},
              </if>
          </set>
           <where>
            id = #{id}
           </where> 
       </select>  
  </mapper>