IntegralWaresMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.yijia.integral.mapper.IntegralWaresMapper">
  6. <resultMap type="IntegralWares" id="IntegralWaresResult">
  7. <result property="id" column="id" />
  8. <result property="waresType" column="wares_type" />
  9. <result property="waresName" column="wares_name" />
  10. <result property="saleIntegral" column="sale_integral" />
  11. <result property="waresPic" column="wares_pic" />
  12. <result property="waresDetail" column="wares_detail" />
  13. <result property="waresCount" column="wares_count" />
  14. <result property="waresOutCount" column="wares_out_count" />
  15. <result property="waresStatus" column="wares_status" />
  16. <result property="createTime" column="create_time" />
  17. <result property="createBy" column="create_by" />
  18. <result property="updateTime" column="update_time" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateName" column="update_name" />
  21. <result property="stationId" column="station_id" />
  22. <result property="stationName" column="station_name" />
  23. </resultMap>
  24. <sql id="selectIntegralWaresVo">
  25. select w.id, wares_type, wares_name, w.sale_integral, wares_pic, wares_detail,
  26. wares_count, wares_out_count, wares_status, w.create_time, w.create_by,
  27. w.update_time, w.update_by, w.station_id,d.dept_name as station_name
  28. from integral_wares w join sys_dept d on w.station_id = d.dept_id
  29. </sql>
  30. <select id="selectIntegralWaresList" parameterType="IntegralWares" resultMap="IntegralWaresResult">
  31. <include refid="selectIntegralWaresVo"/>
  32. <where>
  33. <if test="waresType != null and waresType != ''"> and wares_type = #{waresType}</if>
  34. <if test="waresName != null and waresName != ''"> and wares_name like concat('%', #{waresName}, '%')</if>
  35. <if test="saleIntegral != null "> and w.sale_integral = #{saleIntegral}</if>
  36. <if test="waresPic != null and waresPic != ''"> and w.wares_pic = #{waresPic}</if>
  37. <if test="waresDetail != null and waresDetail != ''"> and wares_detail = #{waresDetail}</if>
  38. <if test="waresCount != null "> and wares_count = #{waresCount}</if>
  39. <if test="waresOutCount != null "> and wares_out_count = #{waresOutCount}</if>
  40. <if test="waresStatusList != null ">
  41. and wares_status in
  42. <foreach item="item" index="index" collection="waresStatusList" open="(" separator="," close=")">
  43. #{item}
  44. </foreach>
  45. </if>
  46. <if test="stationId != null "> and w.station_id = #{stationId}</if>
  47. <if test="stationIdList != null ">
  48. and station_id in
  49. <foreach item="item" index="index" collection="stationIdList"
  50. open="(" separator="," close=")">
  51. #{item}
  52. </foreach>
  53. </if>
  54. </where>
  55. order by wares_status
  56. </select>
  57. <select id="selectIntegralWaresById" parameterType="Long" resultMap="IntegralWaresResult">
  58. <include refid="selectIntegralWaresVo"/>
  59. where id = #{id}
  60. </select>
  61. <insert id="insertIntegralWares" parameterType="IntegralWares" useGeneratedKeys="true" keyProperty="id">
  62. insert into integral_wares
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="waresType != null">wares_type,</if>
  65. <if test="waresName != null">wares_name,</if>
  66. <if test="saleIntegral != null">sale_integral,</if>
  67. <if test="waresPic != null">wares_pic,</if>
  68. <if test="waresDetail != null">wares_detail,</if>
  69. <if test="waresCount != null">wares_count,</if>
  70. <if test="waresOutCount != null">wares_out_count,</if>
  71. <if test="waresStatus != null">wares_status,</if>
  72. <if test="createTime != null">create_time,</if>
  73. <if test="createBy != null">create_by,</if>
  74. <if test="createName != null">create_name,</if>
  75. <if test="updateTime != null">update_time,</if>
  76. <if test="updateBy != null">update_by,</if>
  77. <if test="updateName != null">update_name,</if>
  78. <if test="stationId != null">station_id,</if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="waresType != null">#{waresType},</if>
  82. <if test="waresName != null">#{waresName},</if>
  83. <if test="saleIntegral != null">#{saleIntegral},</if>
  84. <if test="waresPic != null">#{waresPic},</if>
  85. <if test="waresDetail != null">#{waresDetail},</if>
  86. <if test="waresCount != null">#{waresCount},</if>
  87. <if test="waresOutCount != null">#{waresOutCount},</if>
  88. <if test="waresStatus != null">#{waresStatus},</if>
  89. <if test="createTime != null">#{createTime},</if>
  90. <if test="createBy != null">#{createBy},</if>
  91. <if test="createName != null">#{createName},</if>
  92. <if test="updateTime != null">#{updateTime},</if>
  93. <if test="updateBy != null">#{updateBy},</if>
  94. <if test="updateName != null">#{updateName},</if>
  95. <if test="stationId != null">#{stationId},</if>
  96. </trim>
  97. </insert>
  98. <update id="updateIntegralWares" parameterType="IntegralWares">
  99. update integral_wares
  100. <trim prefix="SET" suffixOverrides=",">
  101. <if test="waresType != null">wares_type = #{waresType},</if>
  102. <if test="waresName != null">wares_name = #{waresName},</if>
  103. <if test="saleIntegral != null">sale_integral = #{saleIntegral},</if>
  104. <if test="waresPic != null">wares_pic = #{waresPic},</if>
  105. <if test="waresDetail != null">wares_detail = #{waresDetail},</if>
  106. <if test="waresCount != null">wares_count = #{waresCount},</if>
  107. <if test="waresOutCount != null">wares_out_count = #{waresOutCount},</if>
  108. <if test="waresStatus != null">wares_status = #{waresStatus},</if>
  109. <if test="createTime != null">create_time = #{createTime},</if>
  110. <if test="createBy != null">create_by = #{createBy},</if>
  111. <if test="updateTime != null">update_time = #{updateTime},</if>
  112. <if test="updateBy != null">update_by = #{updateBy},</if>
  113. <if test="stationId != null">station_id = #{stationId},</if>
  114. </trim>
  115. where id = #{id}
  116. </update>
  117. <delete id="deleteIntegralWaresById" parameterType="Long">
  118. delete from integral_wares where id = #{id}
  119. </delete>
  120. <delete id="deleteIntegralWaresByIds" parameterType="String">
  121. delete from integral_wares where id in
  122. <foreach item="id" collection="array" open="(" separator="," close=")">
  123. #{id}
  124. </foreach>
  125. </delete>
  126. </mapper>