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