1
0

MkActivitiesAssociationDao.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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.kmall.admin.dao.mk.MkActivitiesAssociationDao">
  4. <resultMap type="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity" id="mkActivitiesAssociationMap">
  5. <result property="mkaaId" column="mkaa_id"/>
  6. <result property="mkCode" column="mk_code"/>
  7. <result property="mkaId" column="mka_id"/>
  8. <result property="merchSn" column="merch_sn"/>
  9. <result property="thirdMerchSn" column="third_merch_sn"/>
  10. <result property="mkaStoreId" column="mka_store_id"/>
  11. <result property="mkaStatus" column="mka_status"/>
  12. <result property="mkaStartTime" column="mka_start_time"/>
  13. <result property="mkdEndTime" column="mkd_end_time"/>
  14. <result property="mkaEndEarly" column="mka_end_early"/>
  15. <result property="mkdEndEarlyTime" column="mkd_end_early_time"/>
  16. </resultMap>
  17. <select id="queryObject" resultType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity">
  18. select
  19. `mkaa_id`,
  20. `mk_code`,
  21. `mka_id`,
  22. `mka_store_id`,
  23. `mka_status`,
  24. `mka_start_time`,
  25. `mkd_end_time`,
  26. `mka_end_early`,
  27. `mkd_end_early_time`
  28. from mk_activities_association
  29. where mkaa_id = #{id}
  30. </select>
  31. <select id="queryList" resultType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity">
  32. select
  33. `mkaa_id`,
  34. `mk_code`,
  35. `mka_id`,
  36. `mka_store_id`,
  37. `mka_status`,
  38. `mka_start_time`,
  39. `mkd_end_time`,
  40. `mka_end_early`,
  41. `mkd_end_early_time`
  42. from mk_activities_association
  43. WHERE 1=1
  44. <if test="name != null and name.trim() != ''">
  45. AND name LIKE concat('%',#{name},'%')
  46. </if>
  47. <if test="mkCode != null and mkCode != ''">
  48. AND mk_code=#{mkCode}
  49. </if>
  50. <if test="mkaStatus != null and mkaStatus != ''">
  51. AND mka_status=#{mkaStatus}
  52. </if>
  53. <choose>
  54. <when test="sidx != null and sidx.trim() != ''">
  55. order by ${sidx} ${order}
  56. </when>
  57. <otherwise>
  58. order by mkaa_id desc
  59. </otherwise>
  60. </choose>
  61. <if test="offset != null and limit != null">
  62. limit #{offset}, #{limit}
  63. </if>
  64. </select>
  65. <select id="queryTotal" resultType="int">
  66. select count(*) from mk_activities_association
  67. WHERE 1=1
  68. <if test="name != null and name.trim() != ''">
  69. AND name LIKE concat('%',#{name},'%')
  70. </if>
  71. </select>
  72. <select id="queryByMkCodeAndTopic" resultType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity">
  73. select
  74. maa.mkaa_id,
  75. maa.mk_code,
  76. maa.mka_id,
  77. maa.mka_store_id,
  78. maa.mka_status,
  79. maa.mka_start_time,
  80. maa.mkd_end_time,
  81. maa.mka_end_early,
  82. maa.mkd_end_early_time
  83. from mk_activities_association maa,
  84. mk_activities ma
  85. <where>
  86. maa.mka_id = ma.mka_id
  87. and maa.mk_code = #{mkCode}
  88. and ma.mka_topic = #{mkaTopic}
  89. and maa.mka_store_id = #{mkaStoreId}
  90. </where>
  91. </select>
  92. <insert id="save" parameterType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity" useGeneratedKeys="true" keyProperty="mkaaId">
  93. insert into mk_activities_association(
  94. `mk_code`,
  95. `mka_id`,
  96. `merch_sn`,
  97. `third_merch_sn`,
  98. `mka_store_id`,
  99. `mka_status`,
  100. `mka_start_time`,
  101. `mkd_end_time`,
  102. `mka_end_early`,
  103. `mkd_end_early_time`)
  104. values(
  105. #{mkCode},
  106. #{mkaId},
  107. #{merchSn},
  108. #{thirdMerchSn},
  109. #{mkaStoreId},
  110. #{mkaStatus},
  111. #{mkaStartTime},
  112. #{mkdEndTime},
  113. #{mkaEndEarly},
  114. #{mkdEndEarlyTime})
  115. </insert>
  116. <update id="update" parameterType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity">
  117. update mk_activities_association
  118. <set>
  119. <if test="mkCode != null">`mk_code` = #{mkCode}, </if>
  120. <if test="mkaId != null">`mka_id` = #{mkaId}, </if>
  121. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  122. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  123. <if test="mkaStoreId != null">`mka_store_id` = #{mkaStoreId}, </if>
  124. <if test="mkaStatus != null">`mka_status` = #{mkaStatus}, </if>
  125. <if test="mkaStartTime != null">`mka_start_time` = #{mkaStartTime}, </if>
  126. <if test="mkdEndTime != null">`mkd_end_time` = #{mkdEndTime}, </if>
  127. <if test="mkaEndEarly != null">`mka_end_early` = #{mkaEndEarly}, </if>
  128. <if test="mkdEndEarlyTime != null">`mkd_end_early_time` = #{mkdEndEarlyTime}</if>
  129. </set>
  130. where mkaa_id = #{mkaaId}
  131. </update>
  132. <delete id="delete">
  133. delete from mk_activities_association where mkaa_id = #{value}
  134. </delete>
  135. <delete id="deleteBatch">
  136. delete from mk_activities_association where mka_id in
  137. <foreach item="mkaId" collection="array" open="(" separator="," close=")">
  138. #{mkaId}
  139. </foreach>
  140. </delete>
  141. <delete id="deleteByMkaId">
  142. delete from mk_activities_association where mka_id = #{mkaId}
  143. </delete>
  144. <update id="updateByMkaId" parameterType="com.kmall.admin.entity.mk.MkActivitiesAssociationEntity">
  145. update mk_activities_association
  146. <set>
  147. <if test="mkCode != null">`mk_code` = #{mkCode}, </if>
  148. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  149. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  150. <if test="mkaStoreId != null">`mka_store_id` = #{mkaStoreId}, </if>
  151. <if test="mkaStatus != null">`mka_status` = #{mkaStatus}, </if>
  152. <if test="mkaStartTime != null">`mka_start_time` = #{mkaStartTime}, </if>
  153. <if test="mkdEndTime != null">`mkd_end_time` = #{mkdEndTime}, </if>
  154. <if test="mkaEndEarly != null">`mka_end_early` = #{mkaEndEarly}, </if>
  155. <if test="mkdEndEarlyTime != null">`mkd_end_early_time` = #{mkdEndEarlyTime}</if>
  156. </set>
  157. where `mka_id` = #{mkaId}
  158. </update>
  159. </mapper>