电速宝智配引擎
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProductMapper.xml 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.ruoyi.system.mapper.ProductMapper">
  6. <resultMap type="Product" id="ProductResult">
  7. <id property="id" column="id"/>
  8. <result property="productId" column="product_id"/>
  9. <result property="deviceType" column="device_type"/>
  10. <result property="productTypeId" column="product_type_id"/>
  11. <result property="picture" column="picture"/>
  12. <result property="document" column="document"/>
  13. <result property="describe" column="describe"/>
  14. <result property="type" column="type"/>
  15. <result property="createBy" column="create_by"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="updateBy" column="update_by"/>
  18. <result property="updateTime" column="update_time"/>
  19. </resultMap>
  20. <sql id="selectProductVo">
  21. select id, product_id,device_type,product_type_id, picture, document, `describe`, type, create_by, create_time, update_by, update_time
  22. from product
  23. </sql>
  24. <select id="selectProductList" parameterType="Product" resultMap="ProductResult">
  25. <include refid="selectProductVo"/>
  26. <where>
  27. <if test="productId != null and productId != ''">
  28. AND product_id = #{productId}
  29. </if>
  30. <if test="deviceType != null and deviceType != ''">
  31. AND deviceType = #{device_type}
  32. </if>
  33. <if test="productTypeId != null">
  34. AND product_type_id = #{productTypeId}
  35. </if>
  36. <if test="type != null">
  37. AND type = #{type}
  38. </if>
  39. <if test="params.beginTime != null and params.beginTime != ''">
  40. and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
  41. </if>
  42. <if test="params.endTime != null and params.endTime != ''">
  43. and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
  44. </if>
  45. </where>
  46. </select>
  47. <select id="selectProductById" parameterType="String" resultMap="ProductResult">
  48. <include refid="selectProductVo"/>
  49. where product_id = #{productId}
  50. </select>
  51. <select id="selectProductId" parameterType="Long" resultMap="ProductResult">
  52. <include refid="selectProductVo"/>
  53. where id = #{id}
  54. </select>
  55. <insert id="insertProduct" parameterType="Product">
  56. insert into product (
  57. <if test="productId != null and productId != ''">product_id,</if>
  58. <if test="deviceType != null and deviceType != ''">device_type,</if>
  59. <if test="productTypeId != null">product_type_id,</if>
  60. <if test="picture != null and picture != ''">picture,</if>
  61. <if test="document != null and document != ''">document,</if>
  62. <if test="describe != null and describe != ''">`describe`,</if>
  63. <if test="type != null">type,</if>
  64. <if test="createBy != null">create_by,</if>
  65. create_time
  66. )values(
  67. <if test="productId != null and productId != ''">#{productId},</if>
  68. <if test="deviceType != null and deviceType != ''">#{deviceType},</if>
  69. <if test="productTypeId != null">#{productTypeId},</if>
  70. <if test="picture != null and picture != ''">#{picture},</if>
  71. <if test="document != null and document != ''">#{document},</if>
  72. <if test="describe != null and describe != ''">#{describe},</if>
  73. <if test="type != null">#{type},</if>
  74. <if test="createBy != null">#{createBy},</if>
  75. sysdate()
  76. )
  77. </insert>
  78. <update id="updateProduct" parameterType="Product">
  79. update product
  80. <set>
  81. <if test="productId != null and productId != ''">product_id = #{productId},</if>
  82. <if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
  83. <if test="productTypeId != null">product_type_id = #{productTypeId},</if>
  84. <if test="picture != null and picture != ''">picture = #{picture},</if>
  85. <if test="document != null and document != ''">document = #{document},</if>
  86. <if test="describe != null and describe != ''">`describe` = #{describe},</if>
  87. <if test="type != null">type = #{type},</if>
  88. <if test="updateBy != null">update_by = #{updateBy},</if>
  89. update_time = sysdate()
  90. </set>
  91. where id = #{id}
  92. </update>
  93. <delete id="deleteProductById" parameterType="String">
  94. delete from product where product_id = #{productId}
  95. </delete>
  96. <delete id="deleteProductByIds" parameterType="Long">
  97. delete from product where id in
  98. <foreach item="id" collection="array" open="(" separator="," close=")">
  99. #{id}
  100. </foreach>
  101. </delete>
  102. </mapper>