GoodsIssueDao.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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="question != null and question.trim() != ''">
  71. AND mall_goods_issue.question LIKE concat('%',#{question},'%')
  72. </if>
  73. </select>
  74. <insert id="save" parameterType="com.kmall.admin.entity.GoodsIssueEntity" useGeneratedKeys="true" keyProperty="id">
  75. insert into mall_goods_issue(
  76. `question`,
  77. `answer`,
  78. `merch_sn`,
  79. `store_id`,
  80. `creater_sn`,
  81. `create_time`,
  82. `moder_sn`,
  83. `mod_time`,
  84. `tstm`)
  85. values(
  86. #{question},
  87. #{answer},
  88. #{merchSn},
  89. #{storeId},
  90. #{createrSn},
  91. #{createTime},
  92. #{moderSn},
  93. #{modTime},
  94. #{tstm})
  95. </insert>
  96. <update id="update" parameterType="com.kmall.admin.entity.GoodsIssueEntity">
  97. update mall_goods_issue
  98. <set>
  99. <if test="question != null">`question` = #{question},</if>
  100. <if test="answer != null">`answer` = #{answer},</if>
  101. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  102. <if test="storeId != null">`store_id` = #{storeId}, </if>
  103. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  104. <if test="createTime != null">`create_time` = #{createTime}, </if>
  105. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  106. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  107. <if test="tstm != null">`tstm` = #{tstm}</if>
  108. </set>
  109. where id = #{id}
  110. </update>
  111. <delete id="delete">
  112. delete from mall_goods_issue where id = #{value}
  113. </delete>
  114. <delete id="deleteBatch">
  115. delete from mall_goods_issue where id in
  116. <foreach item="id" collection="array" open="(" separator="," close=")">
  117. #{id}
  118. </foreach>
  119. </delete>
  120. </mapper>