OperationRecordMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ematou.wxbase.mapper.OperationRecordMapper">
  6. <sql id="Base_Column_List">
  7. op_id, app_code, creater_sn, create_time, moder_sn, mod_time, tstm
  8. </sql>
  9. <insert id="insertRecord" keyColumn="op_id" keyProperty="opId" useGeneratedKeys="true" parameterType="com.ematou.wxbase.entity.OperationRecord">
  10. <selectKey keyProperty="opId" keyColumn="op_id" order="AFTER" resultType="java.lang.Integer">
  11. select LAST_INSERT_ID() as opId
  12. </selectKey>
  13. insert into wx_operation_record
  14. <trim prefix="(" suffix=")" suffixOverrides="," >
  15. <if test="record.appCode != null">
  16. app_code,
  17. </if>
  18. <if test="record.merchSn != null">
  19. merch_sn,
  20. </if>
  21. <if test="record.tokenType != null">
  22. token_type,
  23. </if>
  24. <if test="record.createrSn != null">
  25. creater_sn,
  26. </if>
  27. <if test="record.createTime != null">
  28. create_time,
  29. </if>
  30. <if test="record.moderSn != null">
  31. moder_sn,
  32. </if>
  33. <if test="record.modTime != null">
  34. mod_time,
  35. </if>
  36. <if test="record.tstm != null">
  37. tstm,
  38. </if>
  39. </trim>
  40. <trim prefix="values (" suffix=")" suffixOverrides="," >
  41. <if test="record.appCode != null">
  42. #{record.appCode},
  43. </if>
  44. <if test="record.merchSn != null">
  45. #{record.merchSn},
  46. </if>
  47. <if test="record.tokenType != null">
  48. #{record.tokenType},
  49. </if>
  50. <if test="record.createrSn != null">
  51. #{record.createrSn},
  52. </if>
  53. <if test="record.createTime != null">
  54. #{record.createTime,jdbcType=VARCHAR},
  55. </if>
  56. <if test="record.moderSn != null">
  57. #{record.moderSn},
  58. </if>
  59. <if test="record.modTime != null">
  60. #{record.modTime,jdbcType=VARCHAR},
  61. </if>
  62. <if test="record.tstm != null">
  63. #{record.tstm},
  64. </if>
  65. </trim>
  66. </insert>
  67. <select id="queryAll" resultType="com.ematou.wxbase.entity.OperationRecord" parameterType="map">
  68. select
  69. <include refid="Base_Column_List"/>
  70. from wx_operation_record
  71. <if test="param.containsKey('order')">
  72. order by #{param.order}
  73. </if>
  74. <if test="param.containsKey('page') and param.containsKey('limit')">
  75. limit #{param.page},#{param.limit}
  76. </if>
  77. <if test="param.containsKey('page') == false and param.containsKey('limit')">
  78. limit #{param.limit}
  79. </if>
  80. </select>
  81. <select id="queryLatestId" resultType="java.lang.Integer">
  82. select op_id from wx_operation_record order by op_id desc limit 1
  83. </select>
  84. </mapper>