BasicProductMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.miniapp.bus.mapper.BasicProductMapper">
  6. <resultMap type="com.miniapp.bus.domain.BasicProduct" id="BasicProductResult">
  7. <result property="id" column="id" />
  8. <result property="productName" column="productName" />
  9. <result property="type" column="type" />
  10. <result property="productType" column="productType" />
  11. <result property="upload" column="upload" />
  12. <result property="deltag" column="deltag" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="remark" column="remark" />
  18. </resultMap>
  19. <sql id="selectBasicProductVo">
  20. select id, productName, type, productType, upload, deltag, create_by, create_time, update_by, update_time, remark from basic_product
  21. </sql>
  22. <select id="selectBasicProductList" parameterType="BasicProduct" resultMap="BasicProductResult">
  23. <include refid="selectBasicProductVo"/>
  24. <where>
  25. <if test="productName != null and productName != ''"> and productName like concat('%', #{productName}, '%')</if>
  26. <if test="type != null and type != ''"> and type = #{type}</if>
  27. <if test="productType != null and productType != ''"> and productType = #{productType}</if>
  28. <if test="upload != null and upload != ''"> and upload = #{upload}</if>
  29. <if test="deltag != null and deltag != ''"> and deltag = #{deltag}</if>
  30. </where>
  31. </select>
  32. <select id="selectBasicProductById" parameterType="Long" resultMap="BasicProductResult">
  33. <include refid="selectBasicProductVo"/>
  34. where id = #{id}
  35. </select>
  36. <insert id="insertBasicProduct" parameterType="BasicProduct" useGeneratedKeys="true" keyProperty="id">
  37. insert into basic_product
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="productName != null">productName,</if>
  40. <if test="type != null">type,</if>
  41. <if test="productType != null">productType,</if>
  42. <if test="upload != null">upload,</if>
  43. <if test="deltag != null">deltag,</if>
  44. <if test="createBy != null">create_by,</if>
  45. <if test="createTime != null">create_time,</if>
  46. <if test="updateBy != null">update_by,</if>
  47. <if test="updateTime != null">update_time,</if>
  48. <if test="remark != null">remark,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="productName != null">#{productName},</if>
  52. <if test="type != null">#{type},</if>
  53. <if test="productType != null">#{productType},</if>
  54. <if test="upload != null">#{upload},</if>
  55. <if test="deltag != null">#{deltag},</if>
  56. <if test="createBy != null">#{createBy},</if>
  57. <if test="createTime != null">#{createTime},</if>
  58. <if test="updateBy != null">#{updateBy},</if>
  59. <if test="updateTime != null">#{updateTime},</if>
  60. <if test="remark != null">#{remark},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateBasicProduct" parameterType="BasicProduct">
  64. update basic_product
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="productName != null">productName = #{productName},</if>
  67. <if test="type != null">type = #{type},</if>
  68. <if test="productType != null">productType = #{productType},</if>
  69. <if test="upload != null">upload = #{upload},</if>
  70. <if test="deltag != null">deltag = #{deltag},</if>
  71. <if test="createBy != null">create_by = #{createBy},</if>
  72. <if test="createTime != null">create_time = #{createTime},</if>
  73. <if test="updateBy != null">update_by = #{updateBy},</if>
  74. <if test="updateTime != null">update_time = #{updateTime},</if>
  75. <if test="remark != null">remark = #{remark},</if>
  76. </trim>
  77. where id = #{id}
  78. </update>
  79. <delete id="deleteBasicProductById" parameterType="Long">
  80. delete from basic_product where id = #{id}
  81. </delete>
  82. <delete id="deleteBasicProductByIds" parameterType="String">
  83. delete from basic_product where id in
  84. <foreach item="id" collection="array" open="(" separator="," close=")">
  85. #{id}
  86. </foreach>
  87. </delete>
  88. </mapper>