{"action":"created","issue":{"url":"https://api.github.com/repos/abel533/Mapper/issues/133","repository_url":"https://api.github.com/repos/abel533/Mapper","labels_url":"https://api.github.com/repos/abel533/Mapper/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/abel533/Mapper/issues/133/comments","events_url":"https://api.github.com/repos/abel533/Mapper/issues/133/events","html_url":"https://github.com/abel533/Mapper/issues/133","id":251578651,"number":133,"title":"使用 updateByPrimaryKeySelective 更新部分字段时的，一个 Integer字段需要强制更新为 null ，如何处理？","user":{"login":"jzoe","id":11612990,"avatar_url":"https://avatars1.githubusercontent.com/u/11612990?v=4","gravatar_id":"","url":"https://api.github.com/users/jzoe","html_url":"https://github.com/jzoe","followers_url":"https://api.github.com/users/jzoe/followers","following_url":"https://api.github.com/users/jzoe/following{/other_user}","gists_url":"https://api.github.com/users/jzoe/gists{/gist_id}","starred_url":"https://api.github.com/users/jzoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzoe/subscriptions","organizations_url":"https://api.github.com/users/jzoe/orgs","repos_url":"https://api.github.com/users/jzoe/repos","events_url":"https://api.github.com/users/jzoe/events{/privacy}","received_events_url":"https://api.github.com/users/jzoe/received_events","type":"User","site_admin":false},"labels":[{"id":150058621,"url":"https://api.github.com/repos/abel533/Mapper/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-08-21T08:01:51Z","updated_at":"2017-09-11T07:53:24Z","closed_at":null,"author_association":"NONE","body":"使用 Mapper 的 `updateByPrimaryKeySelective ` 接口更新记录非常方便，但也遇到一个问题，就是在更新非  String 类型的字段 `columnA` 时，如果我确实需要更新 `columnA` 为 `null` (即 set columnA=null)，这个时候 `updateByPrimaryKeySelective ` 接口会把 `columnA` 过滤掉。\r\n\r\n我知道可以使用 `updateByPrimaryKey` 来强制更新所有字段，但前端传过来的一般都是需要更新的部分字段，这样就必须先去库里查询该记录，然后再修改需要更改的记录后使用 `updateByPrimaryKey` 存回库里。这样的话，感觉比较麻烦一些，还不如直接在 mapper.xml 中写 sql 了。\r\n\r\n不知道各位有没有什么好的方法来解决这个问题呢？\r\n\r\n `updateByPrimaryKeySelective` 能否添加一个参数来控制需要强制更新的字段列表？或者说增加一个新的接口来处理这种情况！ @abel533 "},"comment":{"url":"https://api.github.com/repos/abel533/Mapper/issues/comments/328447876","html_url":"https://github.com/abel533/Mapper/issues/133#issuecomment-328447876","issue_url":"https://api.github.com/repos/abel533/Mapper/issues/133","id":328447876,"user":{"login":"jzoe","id":11612990,"avatar_url":"https://avatars1.githubusercontent.com/u/11612990?v=4","gravatar_id":"","url":"https://api.github.com/users/jzoe","html_url":"https://github.com/jzoe","followers_url":"https://api.github.com/users/jzoe/followers","following_url":"https://api.github.com/users/jzoe/following{/other_user}","gists_url":"https://api.github.com/users/jzoe/gists{/gist_id}","starred_url":"https://api.github.com/users/jzoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzoe/subscriptions","organizations_url":"https://api.github.com/users/jzoe/orgs","repos_url":"https://api.github.com/users/jzoe/repos","events_url":"https://api.github.com/users/jzoe/events{/privacy}","received_events_url":"https://api.github.com/users/jzoe/received_events","type":"User","site_admin":false},"created_at":"2017-09-11T07:53:24Z","updated_at":"2017-09-11T07:53:24Z","author_association":"NONE","body":"@abel533 大神 这个接口还有戏嘛 ？"}}
{"actor":{"display_login":"jzoe"}}