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

逻辑删除标识符的理解 #11

Closed
Gowther opened this issue Aug 3, 2017 · 5 comments
Closed

逻辑删除标识符的理解 #11

Gowther opened this issue Aug 3, 2017 · 5 comments

Comments

@Gowther
Copy link

Gowther commented Aug 3, 2017

不知道logicalDeleteValue/logicalUnDeleteValue和生成的常量DEL_FLAG_ON/OFF是一个怎样的对应关系呢?按照我的理解DEL_FLAG_ON是说明删除标识符被置为true,DEL_FLAG_OFF说明删除标识符被置为false,但是实际上生成的与我理解的正好相反,您是怎样理解这个删除常量的呢?
配置:

    <property name="logicalDeleteColumn" value="is_deleted"/>
    <!-- 逻辑删除-已删除值 -->
    <property name="logicalDeleteValue" value="1"/>
    <!-- 逻辑删除-未删除值 -->
    <property name="logicalUnDeleteValue" value="0"/>

实际生成:

    public static final Boolean DEL_FLAG_ON = false;
    public static final Boolean DEL_FLAG_OFF = true;
@itfsw
Copy link
Owner

itfsw commented Aug 4, 2017

logicalDeleteValue/logicalUnDeleteValue 分别对应 DEL_FLAG_OFF/DEL_FLAG_ON,这个是之前一些遗留项目作怪定下来的。按当时他们说法DEL_FLAG做开关,ON就是没删除OFF就是删除~~~~~,所以在写这个插件时为了兼顾这些所以就延续了这种说法,也是一时没想到更好的命名。

@Gowther
Copy link
Author

Gowther commented Aug 4, 2017

谢谢解答。我个人认为这个变量名有点反直觉,希望以后可以有一个更合适的命名~

@Gowther Gowther closed this as completed Aug 4, 2017
@swellwu
Copy link

swellwu commented Aug 15, 2017

一般的规范此列名为is_deleted,建议取名为 IS_DELETED/NOT_DELETED

@itfsw itfsw reopened this Aug 16, 2017
@itfsw
Copy link
Owner

itfsw commented Aug 17, 2017

已修正,同时增加相应配置选项方便自定义V1.0.17

@itfsw itfsw closed this as completed Aug 17, 2017
@yangjson
Copy link

关于唯一索引,有时候会把isdeleted字段设置加进唯一索引组合里面,所以删除字段我会改成 is_delete+1,但是在生成实体类的时候会报错,有点不方便,希望作者可以改进一下

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

No branches or pull requests

4 participants