dotnetcore / SmartSql

SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
https://smartsql.net/
Apache License 2.0
1.1k stars 222 forks source link

实现mybatis 的 Example #142

Closed ghd258 closed 2 years ago

ghd258 commented 4 years ago

实现mybatis 的 Example https://www.jianshu.com/p/d022fbbc3f8c

int countByExample(UserExample example) thorws SQLException 按条件计数 int deleteByPrimaryKey(Integer id) thorws SQLException 按主键删除 int deleteByExample(UserExample example) thorws SQLException 按条件查询 String/Integer insert(User record) thorws SQLException 插入数据(返回值为ID) User selectByPrimaryKey(Integer id) thorws SQLException 按主键查询 ListselectByExample(UserExample example) thorws SQLException 按条件查询 ListselectByExampleWithBLOGs(UserExample example) thorws SQLException 按条件查询(包括BLOB字段)。只有当数据表中的字段类型有为二进制的才会产生。 int updateByPrimaryKey(User record) thorws SQLException 按主键更新 int updateByPrimaryKeySelective(User record) thorws SQLException 按主键更新值不为null的字段 int updateByExample(User record, UserExample example) thorws SQLException 按条件更新 int updateByExampleSelective(User record, UserExample example) thorws SQLException 按条件更新值不为null的字段

Ahoo-Wang commented 3 years ago

按条件更新值不为null的字段。 这个设计在我的角度来说是对开发者极大困扰的,null 也是一个值,为什么就把null排除在外了呢,假设就需要更新成 null 呢,所以关于动态更新的功能,我更加建议使用 SmartSql 提供的基于属性修改检测的动态更新功能更为稳妥。

ghd258 commented 3 years ago

我们吸取他的优点,好的我们采用 不好的弃用