Universal Mapper is my favorite ORM helper framework, which can help generate SQL dynamically, and there are many official written extensions, but also can customize the extension of dynamic SQL, there are endless possibilities

Official Gitee address

The general Mapper can find many questions from the same users in the issue, which may solve your confusion

The official extension

We can define a BaseMapper so that the Mapper of our various objects inherits from BaseMapper, thus having officially extended dynamic SQL methods

Now have such a question: before using the updateByPrimaryKeySelective (model), the simple is updated according to the primary key attribute is not null values, the front-end transfer what to what, but the problem is, how to empty time field? If null is passed, the time cannot be set to null

At this point we make BaseMapper extends UpdateByPrimaryKeySelectiveForceMapper, so all the subclass object mapper have updateByPrimaryKeySelectiveForce method, namely to update the object at the same time, can also pass in a mandatory update list, for its Properties in are not ignored

Set the extension

Also based on the BaseMapper pattern, there is a requirement that duplicate primary keys exist in the inserted data, so you need to use insert Ignore, whereas the default InsertListMapper provides only inserts

So this process, rewrite its InsertListMapper or custom new generic Mapper, let BaseMapper inherit, organize rewrite process can imitate Tkmapper source code written, customized

As shown, I customized the INSERT Ignore statement

Tool extensibility

ORM auxiliary tool TKMAPPER’s good scalability can greatly improve work efficiency, gradually accumulated BaseMapper will gradually become a dynamic SQL machine, with a variety of dynamic SQL capabilities