IntegralRuleDetailMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.IntegralRuleDetailMapper">
  6. <resultMap type="IntegralRuleDetail" id="IntegralRuleDetailResult">
  7. <result property="id" column="id" />
  8. <result property="parentId" column="parent_id" />
  9. <result property="ruleTerms" column="rule_terms" />
  10. <result property="greadId" column="gread_id" />
  11. <result property="gread" column="gread" />
  12. <result property="oilName" column="oil_name" />
  13. <result property="saleAmt" column="sale_amt" />
  14. <result property="integral" column="integral" />
  15. <result property="ruleType" column="rule_type" />
  16. <result property="oilType" column="oil_type" />
  17. </resultMap>
  18. <sql id="selectIntegralRuleDetailVo">
  19. select id, parent_id, rule_terms, gread_id, gread, oil_name, sale_amt, integral, rule_type,oil_type from integral_rule_detail
  20. </sql>
  21. <select id="selectIntegralRuleDetailList" parameterType="IntegralRuleDetail" resultMap="IntegralRuleDetailResult">
  22. <include refid="selectIntegralRuleDetailVo"/>
  23. <where>
  24. <if test="parentId != null "> and parent_id = #{parentId}</if>
  25. <if test="ruleTerms != null "> and rule_terms = #{ruleTerms}</if>
  26. <if test="greadId != null "> and gread_id = #{greadId}</if>
  27. <if test="gread != null and gread != ''"> and gread = #{gread}</if>
  28. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  29. <if test="saleAmt != null "> and sale_amt = #{saleAmt}</if>
  30. <if test="integral != null "> and integral = #{integral}</if>
  31. <if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</if>
  32. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  33. </where>
  34. </select>
  35. <select id="selectIntegralRuleDetailById" parameterType="Long" resultMap="IntegralRuleDetailResult">
  36. <include refid="selectIntegralRuleDetailVo"/>
  37. where id = #{id}
  38. </select>
  39. <insert id="insertIntegralRuleDetail" parameterType="IntegralRuleDetail" useGeneratedKeys="true" keyProperty="id">
  40. insert into integral_rule_detail
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="parentId != null">parent_id,</if>
  43. <if test="ruleTerms != null">rule_terms,</if>
  44. <if test="greadId != null">gread_id,</if>
  45. <if test="gread != null">gread,</if>
  46. <if test="oilName != null">oil_name,</if>
  47. <if test="saleAmt != null">sale_amt,</if>
  48. <if test="integral != null">integral,</if>
  49. <if test="ruleType != null">rule_type,</if>
  50. <if test="oilType != null">oil_type,</if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides=",">
  53. <if test="parentId != null">#{parentId},</if>
  54. <if test="ruleTerms != null">#{ruleTerms},</if>
  55. <if test="greadId != null">#{greadId},</if>
  56. <if test="gread != null">#{gread},</if>
  57. <if test="oilName != null">#{oilName},</if>
  58. <if test="saleAmt != null">#{saleAmt},</if>
  59. <if test="integral != null">#{integral},</if>
  60. <if test="ruleType != null">#{ruleType},</if>
  61. <if test="oilType != null">#{oilType},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateIntegralRuleDetail" parameterType="IntegralRuleDetail">
  65. update integral_rule_detail
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="parentId != null">parent_id = #{parentId},</if>
  68. <if test="ruleTerms != null">rule_terms = #{ruleTerms},</if>
  69. <if test="greadId != null">gread_id = #{greadId},</if>
  70. <if test="gread != null">gread = #{gread},</if>
  71. <if test="oilName != null">oil_name = #{oilName},</if>
  72. <if test="saleAmt != null">sale_amt = #{saleAmt},</if>
  73. <if test="integral != null">integral = #{integral},</if>
  74. <if test="ruleType != null">rule_type = #{ruleType},</if>
  75. <if test="oilType != null">oil_type = #{oilType},</if>
  76. </trim>
  77. where id = #{id}
  78. </update>
  79. <delete id="deleteIntegralRuleDetailById" parameterType="Long">
  80. delete from integral_rule_detail where id = #{id}
  81. </delete>
  82. <delete id="deleteIntegralRuleDetailByIds" parameterType="String">
  83. delete from integral_rule_detail where id in
  84. <foreach item="id" collection="array" open="(" separator="," close=")">
  85. #{id}
  86. </foreach>
  87. </delete>
  88. <delete id="deleteIntegralRuleDetail" parameterType="Long">
  89. delete from integral_rule_detail
  90. <where>
  91. <if test="parentId != null "> and parent_id = #{parentId}</if>
  92. <if test="ruleTerms != null "> and rule_terms = #{ruleTerms}</if>
  93. <if test="greadId != null "> and gread_id = #{greadId}</if>
  94. <if test="gread != null and gread != ''"> and gread = #{gread}</if>
  95. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  96. <if test="saleAmt != null "> and sale_amt = #{saleAmt}</if>
  97. <if test="integral != null "> and integral = #{integral}</if>
  98. <if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</if>
  99. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  100. </where>
  101. </delete>
  102. </mapper>