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

关于 Diff 根据内容忽略字段的建议 #76

Closed
duanluan opened this issue Jul 4, 2023 · 5 comments · Fixed by #77
Closed

关于 Diff 根据内容忽略字段的建议 #76

duanluan opened this issue Jul 4, 2023 · 5 comments · Fixed by #77
Assignees
Labels
enhancement New feature or request

Comments

@duanluan
Copy link
Contributor

duanluan commented Jul 4, 2023

  1. 只修改部分字段时,msg 显示了全部字段。
    编辑接口使用 Diff,msg最终为:“【username】从【xxx】变成了【 】 【xxx】……”。实际上因为 MyBatis 配置的更新策略,是不会更新参数中为 null 的字段(此处即 username)的,但是操作日志中却显示了。
    建议新增一个全局配置,用于 Diff 时忽略 newObj 中为 null 或为空或指定内容的字段。还可以给@LogRecordDiffField新增一个属性用于单独配置。
  2. 感觉@LogRecordDiffIgnoreField这个注解,可以变成@LogRecordDiffField的一个属性。

关于第 1 点,我现在自己的做法是在implements IOperationLogGetService的类中判断diffDTOList是否不为空,如果不为空的话,获取其中 newValue 为 null 的,再去处理 msg。

@duanluan duanluan changed the title 关于 Diff 根据内容忽略字段的一些建议 关于 Diff 根据内容忽略字段的建议 Jul 4, 2023
@qqxx6661
Copy link
Owner

qqxx6661 commented Jul 4, 2023

整理了一下诉求:

  1. 新增全局配置:DIFF忽略源或目标为null的字段。
  2. @LogRecordDiffField修改:新增独立忽略null的属性
  3. @LogRecordDiffIgnoreField作为@LogRecordDiffField的属性

感觉3个都是很合理的改动,我争取尽快修改支持。

@qqxx6661 qqxx6661 added the enhancement New feature or request label Jul 4, 2023
@qqxx6661 qqxx6661 self-assigned this Jul 4, 2023
@duanluan
Copy link
Contributor Author

请问有进展吗?

@qqxx6661
Copy link
Owner

请问有进展吗?

有的。昨天刚写完功能,还在写单元测试。今天争取给你打个SNAPSHOT包,过两天测完发正式版本

@qqxx6661
Copy link
Owner

1.5.1-SNAPSHOT 快照版本发布。

新的文档见分支代码里的README中DIFF一节
https://github.com/qqxx6661/log-record/blob/f78abf88d8ed897aa0828daa1841bd8c3c74326b/README.md

晚几天发正式版

@qqxx6661
Copy link
Owner

版本号 1.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants