IntegralRuleDetailMapper.xml 5.2 KB

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