GoodsIssueDao.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.GoodsIssueDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsIssueEntity" id="goodsIssueMap">
  5. <result property="id" column="id"/>
  6. <result property="question" column="question"/>
  7. <result property="answer" column="answer"/>
  8. <result property="merchSn" column="merch_sn"/>
  9. <result property="storeId" column="store_id"/>
  10. <result property="createrSn" column="creater_sn"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="moderSn" column="moder_sn"/>
  13. <result property="modTime" column="mod_time"/>
  14. <result property="tstm" column="tstm"/>
  15. </resultMap>
  16. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsIssueEntity">
  17. select
  18. `id`,
  19. `question`,
  20. `answer`,
  21. `merch_sn`,
  22. `store_id`,
  23. `creater_sn`,
  24. `create_time`,
  25. `moder_sn`,
  26. `mod_time`,
  27. `tstm`
  28. from mall_goods_issue
  29. where id = #{id}
  30. </select>
  31. <select id="queryList" resultType="com.kmall.admin.entity.GoodsIssueEntity">
  32. select
  33. f.id,
  34. f.question,
  35. f.answer,
  36. f.merch_sn,
  37. f.store_id,
  38. f.creater_sn,
  39. f.create_time,
  40. f.moder_sn,
  41. f.mod_time,
  42. f.tstm,
  43. s.store_name
  44. from mall_goods_issue f left join mall_store s on f.store_id = s.id
  45. WHERE 1=1
  46. <if test="storeId != null and storeId != '' ">
  47. AND f.store_id = #{storeId}
  48. </if>
  49. <if test="merchSn != null and merchSn.trim() != '' ">
  50. AND f.merch_sn = #{merchSn}
  51. </if>
  52. <if test="question != null and question.trim() != ''">
  53. AND f.question LIKE concat('%',#{question},'%')
  54. </if>
  55. <choose>
  56. <when test="sidx != null and sidx.trim() != ''">
  57. order by ${sidx} ${order}
  58. </when>
  59. <otherwise>
  60. order by f.id desc
  61. </otherwise>
  62. </choose>
  63. <if test="offset != null and limit != null">
  64. limit #{offset}, #{limit}
  65. </if>
  66. </select>
  67. <select id="queryTotal" resultType="int">
  68. select count(*) from mall_goods_issue
  69. WHERE 1=1
  70. <if test="storeId != null and storeId != '' ">
  71. AND store_id = #{storeId}
  72. </if>
  73. <if test="merchSn != null and merchSn.trim() != '' ">
  74. AND merch_sn = #{merchSn}
  75. </if>
  76. <if test="question != null and question.trim() != ''">
  77. AND question LIKE concat('%',#{question},'%')
  78. </if>
  79. </select>
  80. <insert id="save" parameterType="com.kmall.admin.entity.GoodsIssueEntity" useGeneratedKeys="true" keyProperty="id">
  81. insert into mall_goods_issue(
  82. `question`,
  83. `answer`,
  84. `merch_sn`,
  85. `store_id`,
  86. `creater_sn`,
  87. `create_time`,
  88. `moder_sn`,
  89. `mod_time`,
  90. `tstm`)
  91. values(
  92. #{question},
  93. #{answer},
  94. #{merchSn},
  95. #{storeId},
  96. #{createrSn},
  97. #{createTime},
  98. #{moderSn},
  99. #{modTime},
  100. #{tstm})
  101. </insert>
  102. <update id="update" parameterType="com.kmall.admin.entity.GoodsIssueEntity">
  103. update mall_goods_issue
  104. <set>
  105. <if test="question != null">`question` = #{question},</if>
  106. <if test="answer != null">`answer` = #{answer},</if>
  107. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  108. <if test="storeId != null">`store_id` = #{storeId}, </if>
  109. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  110. <if test="createTime != null">`create_time` = #{createTime}, </if>
  111. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  112. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  113. <if test="tstm != null">`tstm` = #{tstm}</if>
  114. </set>
  115. where id = #{id}
  116. </update>
  117. <delete id="delete">
  118. delete from mall_goods_issue where id = #{value}
  119. </delete>
  120. <delete id="deleteBatch">
  121. delete from mall_goods_issue where id in
  122. <foreach item="id" collection="array" open="(" separator="," close=")">
  123. #{id}
  124. </foreach>
  125. </delete>
  126. </mapper>