CmOrganizeBuyerMapper.xml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.weisha.dao.CmOrganizeBuyerDao">
  4. <sql id="cmOrganizeBuyerColumns">
  5. a.id AS "id",
  6. a.organizeId AS "organizeId",
  7. a.name AS "name",
  8. a.mobile AS "mobile",
  9. a.invitationCode AS "invitationCode",
  10. a.status AS "status",
  11. a.nickName AS "nickName",
  12. a.openid AS "openid",
  13. a.addTime AS "addTime",
  14. a.invitationCodeTime AS "invitationCodeTime",
  15. a.bindTime AS "bindTime",
  16. a.updateTime AS "updateTime",
  17. a.delFlag AS "delFlag"
  18. </sql>
  19. <sql id="cmOrganizeBuyerJoins">
  20. </sql>
  21. <select id="get" resultType="CmOrganizeBuyer">
  22. SELECT
  23. <include refid="cmOrganizeBuyerColumns"/>
  24. FROM cm_organize_buyer a
  25. <include refid="cmOrganizeBuyerJoins"/>
  26. WHERE a.id = #{id}
  27. </select>
  28. <select id="findList" resultType="CmOrganizeBuyer">
  29. SELECT
  30. <include refid="cmOrganizeBuyerColumns"/>
  31. FROM cm_organize_buyer a
  32. <where>
  33. a.delFlag = 0
  34. AND a.organizeId = #{organizeId}
  35. <if test="name != null and name != ''">
  36. AND a.name LIKE
  37. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  38. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  39. </if>
  40. <if test="mobile != null and mobile != ''">
  41. AND a.mobile = #{mobile}
  42. </if>
  43. <if test="status != null and status != ''">
  44. AND a.status = #{status}
  45. </if>
  46. <if test="startTime != null">
  47. AND a.addTime <![CDATA[ > ]]> #{startTime}
  48. </if>
  49. <if test="endTime != null">
  50. AND a.addTime <![CDATA[ < ]]> #{endTime}
  51. </if>
  52. <if test="invitationCode != null and invitationCode != ''">
  53. AND a.invitationCode = #{invitationCode}
  54. </if>
  55. </where>
  56. <choose>
  57. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  58. ORDER BY ${page.orderBy}
  59. </when>
  60. <otherwise>
  61. ORDER BY a.addTime DESC
  62. </otherwise>
  63. </choose>
  64. </select>
  65. <select id="findAllList" resultType="CmOrganizeBuyer">
  66. SELECT
  67. <include refid="cmOrganizeBuyerColumns"/>
  68. FROM cm_organize_buyer a
  69. <include refid="cmOrganizeBuyerJoins"/>
  70. <where>
  71. </where>
  72. <choose>
  73. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  74. ORDER BY ${page.orderBy}
  75. </when>
  76. <otherwise>
  77. </otherwise>
  78. </choose>
  79. </select>
  80. <insert id="insert" parameterType="CmOrganizeBuyer" keyProperty="id" useGeneratedKeys="true">
  81. INSERT INTO cm_organize_buyer(
  82. organizeId,
  83. name,
  84. mobile,
  85. invitationCode,
  86. status,
  87. nickName,
  88. openid,
  89. addTime,
  90. invitationCodeTime,
  91. bindTime,
  92. updateTime,
  93. delFlag
  94. ) VALUES (
  95. #{organizeId},
  96. #{name},
  97. #{mobile},
  98. #{invitationCode},
  99. #{status},
  100. #{nickName},
  101. #{openid},
  102. #{addTime},
  103. #{invitationCodeTime},
  104. #{bindTime},
  105. #{updateTime},
  106. #{delFlag}
  107. )
  108. </insert>
  109. <update id="update">
  110. UPDATE cm_organize_buyer SET
  111. name = #{name},
  112. mobile = #{mobile},
  113. invitationCode = #{invitationCode},
  114. status = #{status},
  115. nickName = #{nickName},
  116. openid = #{openid},
  117. invitationCodeTime = #{invitationCodeTime},
  118. bindTime = #{bindTime},
  119. updateTime = #{updateTime},
  120. delFlag = #{delFlag}
  121. WHERE id = #{id}
  122. </update>
  123. <select id="findByMobile" resultType="com.caimei.modules.weisha.entity.CmOrganizeBuyer">
  124. SELECT
  125. <include refid="cmOrganizeBuyerColumns"/>
  126. FROM cm_organize_buyer a
  127. WHERE a.mobile = #{mobile} AND delFlag = 0
  128. </select>
  129. </mapper>