Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@@mybatis对于insert、update语句无法执行 #115

Open
kevinkda opened this issue Jan 17, 2022 · 0 comments
Open

@@mybatis对于insert、update语句无法执行 #115

kevinkda opened this issue Jan 17, 2022 · 0 comments

Comments

@kevinkda
Copy link

kevinkda commented Jan 17, 2022

version 4.2.5

原始代码

// Update User Info
var funcUpdateUserInfo = (userId, phone_num, nick_name, user_sex) -> {

    var updateUserInfo = @@mybatis(userId, phone_num, nick_name, user_sex)<%
        <update>
            UPDATE user_info
            <trim prefix = "set" suffixOverrides=",">
                <if test = "phone_num != null">phone_num = #{phone_num},</if>
                <if test = "nick_name != null">nick_name = #{nick_name},</if>
                <if test = "user_sex != null">user_sex = #{user_sex},</if>
            </trim>
            WHERE id = #{userId}
        </update>
    %>
    var result = updateUserInfo(userId, phone_num, nick_name, user_sex);
    run result;
    return {"execute": result};
}

执行结果

{
  "success": true,
  "message": "OK",
  "location": null,
  "code": 0,
  "lifeCycleTime": 47,
  "executionTime": 25,
  "value": {
    "request_id": "F98262B3-9254-43B5-8CD0-6D47B5783F9D",
    "execute": {
      "previousPage": {},
      "data": {},
      "firstPage": {},
      "lastPage": {},
      "nextPage": {},
      "setPageInfo": {},
      "pageInfo": {}
    }
  }
}

查看数据库无任何数据更新,无操作执行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant