Git Product home page Git Product logo

Comments (16)

zhou-hao avatar zhou-hao commented on June 14, 2024

好像 修复过。是最新的hsweb-framework和 easyorm版本吗?

debug看看这里

https://github.com/hs-web/hsweb-framework/blob/c3643ecfcafa778b065e26857b4e6b0c708d7c0c/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/events/EntityEventListener.java#L225-L232

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

hsweb-framework 版本:4.0.17-SNAPSHOT
easy-ormb 版本:4.1.2-SNAPSHOT
版本信息

步骤:
1、update 前设置了 -1
image
2、EntityPrepareModifyEvent 事件中给更新前后的实体分别设置成了-2 和 -3
image
3、debug 看 entry.setValue 是塞成功了,取到了 -3
image
4、最终执行的 sql 是 -1
image

另外发现个现象:
第 1 步 update 前不塞值的话,只在第 2 步中塞值,第 4 步最终执行的 sql 不会有相关字段
image

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

在这个单元测试 复现看看

https://github.com/hs-web/hsweb-framework/blob/1ba900746587f17c6a512ed04733c0c1f7c33305/hsweb-commons/hsweb-commons-crud/src/test/java/org/hswebframework/web/crud/events/EntityEventListenerTest.java#L87-L105

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

在这个代码仓库中复现了:https://github.com/MoonBottle/hsweb-framework
1、update 前赋值
2、监听事件并修改变量值
3、最终执行的 sql
image

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

试试这个PR hs-web/hsweb-framework#288

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

试试这个PR hs-web/hsweb-framework#288

测试了下,修改的值是预期的 -3,大佬👍
image

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

但是今天又发现了一个新的现象,感觉似乎有点问题,步骤如下:
新增了一个 testColumn2 字段
1、使用 .setNull(EventTestEntity::getTestColumn2)
2、预期的 sql 是正常的执行了 setnull
3、但是在 EntityModifyEvent 中 after 对象的 testColumn2 字段值变成了 0,预期这里也是 null 值

测试代码还是在这个仓库中:https://github.com/MoonBottle/hsweb-framework

image

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

字段类型是包装器类型还是基本数据类型

我再看看..

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

再试试

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

不过目前不能通过EntityPrepareModifyEvent设置null值

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

不过目前不能通过EntityPrepareModifyEvent设置null值

抱歉,我有点没说清楚,现在这个现象和 EntityPrepareModifyEvent 没有关系了,是一个单独的问题

刚才又试了下,setNull 似乎不生效了,最终执行的 sql 中没有 set null 的语句

已确认刷新过 maven

image

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024
image image

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

奇怪,我本地确实不行,maven 也刷新了

image

测试代码地址:https://github.com/MoonBottle/hsweb-framework/blob/358e783a7ffc4ec51848afa3cb1e4d3eb9bcc14f/hsweb-commons/hsweb-commons-crud/src/test/java/org/hswebframework/web/crud/events/EntityEventListenerTest.java#L88

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

代码 没同步完? hs-web/hsweb-framework@74d7421

from jetlinks-community.

MoonBottle avatar MoonBottle commented on June 14, 2024

代码 没同步完? hs-web/hsweb-framework@74d7421

抱歉抱歉,我没注意到 PR 有新的 commit,代码没同步完

同步后测试成功了,大佬🐂🍺,非常感谢!🙏

from jetlinks-community.

zhou-hao avatar zhou-hao commented on June 14, 2024

好的。没有问题我就合并了。

from jetlinks-community.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.