TOwnCoinOrderMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.ruoyi.bussiness.mapper.TOwnCoinOrderMapper">
  6. <resultMap type="TOwnCoinOrder" id="TOwnCoinOrderResult">
  7. <result property="id" column="id" />
  8. <result property="orderId" column="order_id" />
  9. <result property="userId" column="user_id" />
  10. <result property="ownId" column="own_id" />
  11. <result property="ownCoin" column="own_coin" />
  12. <result property="amount" column="amount" />
  13. <result property="number" column="number" />
  14. <result property="price" column="price" />
  15. <result property="status" column="status" />
  16. <result property="adminUserIds" column="admin_user_ids" />
  17. <result property="adminParentIds" column="admin_parent_ids" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectTOwnCoinOrderVo">
  22. select id,user_id, order_id, own_id, own_coin, amount, number, price, status, admin_user_ids, admin_parent_ids, create_time, update_time from t_own_coin_order
  23. </sql>
  24. <select id="selectTOwnCoinOrderList" parameterType="TOwnCoinOrder" resultMap="TOwnCoinOrderResult">
  25. <include refid="selectTOwnCoinOrderVo"/>
  26. <where>
  27. <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
  28. <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
  29. <if test="ownId != null "> and own_id = #{ownId}</if>
  30. <if test="ownCoin != null and ownCoin != ''"> and own_coin = #{ownCoin}</if>
  31. <if test="amount != null "> and amount = #{amount}</if>
  32. <if test="number != null "> and number = #{number}</if>
  33. <if test="price != null "> and price = #{price}</if>
  34. <if test="status != null and status != ''"> and status = #{status}</if>
  35. <if test="adminUserIds != null and adminUserIds != ''"> and admin_user_ids = #{adminUserIds}</if>
  36. <if test="adminParentIds != null and adminParentIds != ''"> and admin_parent_ids = #{adminParentIds}</if>
  37. </where>
  38. </select>
  39. <select id="selectTOwnCoinOrderById" parameterType="Long" resultMap="TOwnCoinOrderResult">
  40. <include refid="selectTOwnCoinOrderVo"/>
  41. where id = #{id}
  42. </select>
  43. <select id="getAllAmountByUserIdAndCoinId" resultType="java.lang.Integer">
  44. SELECT IFNULL(sum(number),0) FROM t_own_coin_order WHERE own_id=#{ownId} and user_id=#{userId}
  45. </select>
  46. <insert id="insertTOwnCoinOrder" parameterType="TOwnCoinOrder" useGeneratedKeys="true" keyProperty="id">
  47. insert into t_own_coin_order
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="orderId != null">order_id,</if>
  50. <if test="userId != null">user_id,</if>
  51. <if test="ownId != null">own_id,</if>
  52. <if test="ownCoin != null">own_coin,</if>
  53. <if test="amount != null">amount,</if>
  54. <if test="number != null">number,</if>
  55. <if test="price != null">price,</if>
  56. <if test="status != null">status,</if>
  57. <if test="adminUserIds != null">admin_user_ids,</if>
  58. <if test="adminParentIds != null">admin_parent_ids,</if>
  59. <if test="createTime != null">create_time,</if>
  60. <if test="updateTime != null">update_time,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="orderId != null">#{orderId},</if>
  64. <if test="userId != null">#{userId},</if>
  65. <if test="ownId != null">#{ownId},</if>
  66. <if test="ownCoin != null">#{ownCoin},</if>
  67. <if test="amount != null">#{amount},</if>
  68. <if test="number != null">#{number},</if>
  69. <if test="price != null">#{price},</if>
  70. <if test="status != null">#{status},</if>
  71. <if test="adminUserIds != null">#{adminUserIds},</if>
  72. <if test="adminParentIds != null">#{adminParentIds},</if>
  73. <if test="createTime != null">#{createTime},</if>
  74. <if test="updateTime != null">#{updateTime},</if>
  75. </trim>
  76. </insert>
  77. <update id="updateTOwnCoinOrder" parameterType="TOwnCoinOrder">
  78. update t_own_coin_order
  79. <trim prefix="SET" suffixOverrides=",">
  80. <if test="orderId != null">order_id = #{orderId},</if>
  81. <if test="userId != null">user_id = #{userId},</if>
  82. <if test="ownId != null">own_id = #{ownId},</if>
  83. <if test="ownCoin != null">own_coin = #{ownCoin},</if>
  84. <if test="amount != null">amount = #{amount},</if>
  85. <if test="number != null">number = #{number},</if>
  86. <if test="price != null">price = #{price},</if>
  87. <if test="status != null">status = #{status},</if>
  88. <if test="adminUserIds != null">admin_user_ids = #{adminUserIds},</if>
  89. <if test="adminParentIds != null">admin_parent_ids = #{adminParentIds},</if>
  90. <if test="createTime != null">create_time = #{createTime},</if>
  91. <if test="updateTime != null">update_time = #{updateTime},</if>
  92. </trim>
  93. where id = #{id}
  94. </update>
  95. <delete id="deleteTOwnCoinOrderById" parameterType="Long">
  96. delete from t_own_coin_order where id = #{id}
  97. </delete>
  98. <delete id="deleteTOwnCoinOrderByIds" parameterType="String">
  99. delete from t_own_coin_order where id in
  100. <foreach item="id" collection="array" open="(" separator="," close=")">
  101. #{id}
  102. </foreach>
  103. </delete>
  104. </mapper>