Giter Site home page Giter Site logo

Comments (4)

1015770492 avatar 1015770492 commented on September 24, 2024

不建议进行jdbc来完成数据字典转换,我建议你用我这个工具进行导入将其转换为javaBeanList。
然后再将javaBean通过数据字典进行更新。

如果excel里 有1w条数据,我总不能进行1w次查询吧?况且这1w条数据可能有1千条重复的字典项,结果我重复了1k次,完全没必要(做了很多无用功)。因此需要考虑做缓存。

我倒是觉得与其你上述的配置,不如果注解中配一条sql,sql的结果就是返回的key和value 最终会是一个map存起来。


我说的那个功能可以考虑做一下。 类似于 @dict(sql="select column1 as key,column2 as value from TableA where condition in (select distinct condition from tableB)")
可以通过加一个tableB 来控制这个select column1 as key , column2 as value from xxxTable结果返回的内容,只需要更新tableB中相应的数据来控制TableA 返回的数据


如果一些常量数据建议直接用@MapEntry(key=,value=)的形式完成字典映射。
举个例子:@MapEntry(key="是",value="1")
导入的逻辑:类似与单元个内容值为 “是” 则会变成 "1"
导出:反过来处理


当然你可以在v1.3.6这个分支上提交代码,我可以帮你打一个包到maven仓库。

from excel-import-export.

TomYule avatar TomYule commented on September 24, 2024

注解一次查出数据库的值存入map @dict(dictTable = "sys_user", dicCode = "username", dicText = "realname " queryAll =true)
做一下 性能 模式 或者速度模式 区分标识 数据量大小
数据量小全部查询 数据量大 单独查询

from excel-import-export.

1015770492 avatar 1015770492 commented on September 24, 2024

打算做一下这个字典项,会在导入的过程中就将其进行映射

from excel-import-export.

1015770492 avatar 1015770492 commented on September 24, 2024

今天合并了一下之前写的代码。
最新版本:1.3.13 的ExcelImportExportUtils是带映射和逻辑空校验,jsr303也是支持的。
有时间做一下查询数据库获得到数据字典的情况。


ExcelImportExportUtils 通过 @MapEntry 先将表中的值进行映射和替换,如果excel的值有重复的,例如:

贵阳市-贵阳市 要求替换成区域码,可以配一个

@MapEntry(key="贵阳市","GYS")
@ExcelTitleBind(index="A",replaceAll=true)
private String position;

position字段会变成 "GYS"
replaceAll 如果设置为false,则变成"GYS-GYS"

另外逻辑校验也是支持的,ExcelTitleBind本身的nullable只是单纯的空校验,
如果加了@CheckValues 可以解决字段之间的一些逻辑空校验;
利用当a字段的值为X的时候,字段b不能为空。

from excel-import-export.

Related Issues (8)

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.