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

updateById Support Dynamic Field Strategy #5898

Open
wants to merge 1 commit into
base: 3.0
Choose a base branch
from

Conversation

rowstop
Copy link

@rowstop rowstop commented Dec 29, 2023

These methods have been supported
image

sql script

<script>
<bind name="always" value="st == null or st == @com.baomidou.mybatisplus.annotation.FieldStrategy@IGNORED  or st == @com.baomidou.mybatisplus.annotation.FieldStrategy@ALWAYS"/>
<bind name="notNull" value="st == @com.baomidou.mybatisplus.annotation.FieldStrategy@NOT_NULL"/>
<bind name="notEmpty" value="st == @com.baomidou.mybatisplus.annotation.FieldStrategy@NOT_EMPTY"/>
UPDATE sample_user <set>
<if test="always or (notNull and et['username'] != null) or (notEmpty and et['username'] != null and et['username'] != '')">username=#{et.username},</if>
<if test="always or (notNull and et['password'] != null) or (notEmpty and et['password'] != null and et['password'] != '')">password=#{et.password},</if>
</set> WHERE id=#{et.id} 
</script>

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

Successfully merging this pull request may close these issues.

None yet

1 participant