CibeBlessingCompoMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.modules.cibe.dao.CibeBlessingCompoDao">
  4. <sql id="cibeBlessingCompoColumns">
  5. a.id AS "id",
  6. a.userId AS "userId",
  7. a.mobile AS "mobile",
  8. a.blessNum AS "blessNum",
  9. a.blessCode AS "blessCode",
  10. a.getWay AS "getWay",
  11. a.getTime AS "getTime",
  12. a.activeNum AS "activeNum",
  13. a.activeStartTime AS "activeStartTime",
  14. a.activeEndTime AS "activeEndTime",
  15. a.openStatus AS "openStatus",
  16. a.prizeType AS "prizeType",
  17. a.prizeDescribe AS "prizeDescribe",
  18. a.money AS "money",
  19. a.goPrize AS "goPrize"
  20. </sql>
  21. <sql id="cibeBlessingCompoJoins">
  22. </sql>
  23. <select id="get" resultType="CibeBlessingCompo">
  24. SELECT
  25. <include refid="cibeBlessingCompoColumns"/>
  26. FROM cibe_blessing_compo a
  27. <include refid="cibeBlessingCompoJoins"/>
  28. WHERE a.id = #{id}
  29. </select>
  30. <select id="findList" resultType="CibeBlessingCompo">
  31. SELECT
  32. a.*,cu.userType AS "userType",cu.userName AS "userName",cu.address AS "address"
  33. FROM cibe_blessing_compo a
  34. LEFT JOIN cibe_user cu ON cu.userId = a.userId
  35. <where>
  36. <if test="userId != null and userId != ''">
  37. AND a.userId = #{userId}
  38. </if>
  39. <if test="mobile != null and mobile != ''">
  40. AND a.mobile = #{mobile}
  41. </if>
  42. <if test="blessCode != null and blessCode != ''">
  43. AND a.blessCode = #{blessCode}
  44. </if>
  45. <if test="getWay != null and getWay != ''">
  46. AND a.getWay = #{getWay}
  47. </if>
  48. </where>
  49. <choose>
  50. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  51. ORDER BY ${page.orderBy}
  52. </when>
  53. <otherwise>
  54. </otherwise>
  55. </choose>
  56. </select>
  57. <select id="findAllList" resultType="CibeBlessingCompo">
  58. SELECT
  59. <include refid="cibeBlessingCompoColumns"/>
  60. FROM cibe_blessing_compo a
  61. <include refid="cibeBlessingCompoJoins"/>
  62. <where>
  63. </where>
  64. <choose>
  65. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  66. ORDER BY ${page.orderBy}
  67. </when>
  68. <otherwise>
  69. </otherwise>
  70. </choose>
  71. </select>
  72. <insert id="insert" parameterType="CibeBlessingCompo" keyProperty="id" useGeneratedKeys="true">
  73. INSERT INTO cibe_blessing_compo(
  74. userId,
  75. mobile,
  76. blessNum,
  77. blessCode,
  78. getWay,
  79. getTime,
  80. activeNum,
  81. activeStartTime,
  82. activeEndTime,
  83. openStatus,
  84. prizeType,
  85. prizeDescribe,
  86. money,
  87. goPrize
  88. ) VALUES (
  89. #{userId},
  90. #{mobile},
  91. #{blessNum},
  92. #{blessCode},
  93. #{getWay},
  94. #{getTime},
  95. #{activeNum},
  96. #{activeStartTime},
  97. #{activeEndTime},
  98. #{openStatus},
  99. #{prizeType},
  100. #{prizeDescribe},
  101. #{money},
  102. #{goPrize}
  103. )
  104. </insert>
  105. <update id="update">
  106. UPDATE cibe_blessing_compo SET
  107. mobile = #{mobile},
  108. blessNum = #{blessNum},
  109. blessCode = #{blessCode},
  110. getWay = #{getWay},
  111. getTime = #{getTime},
  112. activeNum = #{activeNum},
  113. activeStartTime = #{activeStartTime},
  114. activeEndTime = #{activeEndTime},
  115. openStatus = #{openStatus},
  116. prizeType = #{prizeType},
  117. prizeDescribe = #{prizeDescribe},
  118. money = #{money},
  119. goPrize = #{goPrize}
  120. WHERE id = #{id}
  121. </update>
  122. <update id="updateLottery">
  123. UPDATE cibe_blessing_compo SET
  124. goPrize = 1
  125. WHERE id = #{id}
  126. </update>
  127. <delete id="delete">
  128. DELETE FROM cibe_blessing_compo
  129. WHERE id = #{id}
  130. </delete>
  131. </mapper>