// 基于jfinal enjoy实现注解形式的sql统一管理 // 集成到jfinal或spring boot都可行 // 完善后近期开源共享一下 public interface UserInfoDBService extends QueryRepository { String tableName = "system_user"; //查.sql模板模板 @Namespace("systemUser.list") List<Record> findNamespaceList(); //返回SqlPara @Sql("select * from system_user where username = #para(0)") SqlPara getSqlPara(String username); //Long int String boolean @Sql("select count(*) from system_user ") int count(); @Sql("select username from system_user where username = #para(0)") String userName(String username); //第一种用法 para(0)模式 @Sql("select * from system_user ") @Sql("where id > #para(0) and username = #para(1)") Record findFirstList(Integer id,String username); //@Source 多数据源 @Sql("select * from system_user ") @Sql("where id > #para(0) and username = #para(1)") Record findFirstList(Integer id,String username,@Source String source); //第二种用法 Kv模式 @Sql("select * from system_user ") @Sql("where id > #para(id) and username = #para(username)") Record findFirstListByPara(@Para Kv kv); @Sql("select * from system_user ") @Sql("where id > #para(0) and username = #para(1)") List<Record> findList(Integer id,String username); @Sql("select * from system_user ") @Sql("where id > #para(0) and username = #para(1)") Page<Record> paginate(@PageNumber int index,@PageSize int size,Integer id,String username); default Record save(Record entity){ return save(tableName, entity); } default boolean update(Record entity){ return update(tableName, entity); } default boolean delete(Serializable id){ return deleteById(tableName, id); } }