🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` 1. /** 2. * get test bean by UID. 3. * 4. * @param id 5. * @return 6. */ 7. @SelectProvider(type = TestSqlProvider.class, method = "getSql") 8. @Options(useCache = true, flushCache = false, timeout = 10000) 9. @Results(value = { 10. @Result(id = true, property = "id", column = "test_id", javaType = String.class, jdbcType = JdbcType.VARCHAR), 11. @Result(property = "testText", column = "test_text", javaType = String.class, jdbcType = JdbcType.VARCHAR) }) 12. public TestBean get(@Param("id") String id); 13. 14. /** 15. * get all tests. 16. * 17. * @return 18. */ 19. @SelectProvider(type = TestSqlProvider.class, method = "getAllSql") 20. @Options(useCache = true, flushCache = false, timeout = 10000) 21. @Results(value = { 22. @Result(id = true, property = "id", column = "test_id", javaType = String.class, jdbcType = JdbcType.VARCHAR), 23. @Result(property = "testText", column = "test_text", javaType = String.class, jdbcType = JdbcType.VARCHAR) }) 24. public List<TestBean> getAll(); 25. 26. /** 27. * get tests by test text. 28. * 29. * @param testText 30. * @return 31. */ 32. @SelectProvider(type = TestSqlProvider.class, method = "getByTestTextSql") 33. @Options(useCache = true, flushCache = false, timeout = 10000) 34. @ResultMap(value = "getByTestText") 35. public List<TestBean> getByTestText(@Param("testText") String testText); 36. 37. /** 38. * insert a test bean into database. 39. * 40. * @param testBean 41. */ 42. @InsertProvider(type = TestSqlProvider.class, method = "insertSql") 43. @Options(flushCache = true, timeout = 20000) 44. public void insert(@Param("testBean") TestBean testBean); 45. 46. /** 47. * update a test bean with database. 48. * 49. * @param testBean 50. */ 51. @UpdateProvider(type = TestSqlProvider.class, method = "updateSql") 52. @Options(flushCache = true, timeout = 20000) 53. public void update(@Param("testBean") TestBean testBean); 54. 55. /** 56. * delete a test by UID. 57. * 58. * @param id 59. */ 60. @DeleteProvider(type = TestSqlProvider.class, method = "deleteSql") 61. @Options(flushCache = true, timeout = 20000) 62. public void delete(@Param("id") String id); 63. } ```