IntegralRuleMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.IntegralRuleMapper">
  6. <resultMap type="IntegralRule" id="IntegralRuleResult">
  7. <result property="id" column="id" />
  8. <result property="stationId" column="station_id" />
  9. <result property="stationName" column="station_name" />
  10. <result property="ruleType" column="rule_type" />
  11. <result property="termDateManage" column="term_date_manage" />
  12. <result property="emptyDate" column="empty_date" />
  13. <result property="expirationReminder" column="expiration_reminder" />
  14. <result property="remindDate" column="remind_date" />
  15. <result property="integralActivity" column="integral_activity" />
  16. <result property="datePicker" column="date_picker" />
  17. <result property="integralProportion" column="integral_proportion" />
  18. <result property="integralDeductionOil" column="integral_deduction_oil" />
  19. <result property="datePickerTime" column="date_picker_time" />
  20. </resultMap>
  21. <sql id="selectIntegralRuleVo">
  22. select id, station_id, station_name, rule_type, term_date_manage, empty_date, expiration_reminder, remind_date, integral_activity, date_picker, integral_proportion, integral_deduction_oil,date_picker_time from integral_rule
  23. </sql>
  24. <select id="selectIntegralRuleList" parameterType="IntegralRule" resultMap="IntegralRuleResult">
  25. <include refid="selectIntegralRuleVo"/>
  26. <where>
  27. <if test="stationId != null "> and station_id = #{stationId}</if>
  28. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  29. <if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</if>
  30. <if test="termDateManage != null and termDateManage != ''"> and term_date_manage = #{termDateManage}</if>
  31. <if test="emptyDate != null "> and empty_date = #{emptyDate}</if>
  32. <if test="expirationReminder != null and expirationReminder != ''"> and expiration_reminder = #{expirationReminder}</if>
  33. <if test="remindDate != null "> and remind_date = #{remindDate}</if>
  34. <if test="integralActivity != null and integralActivity != ''"> and integral_activity = #{integralActivity}</if>
  35. <if test="datePicker != null and datePicker != ''"> and date_picker = #{datePicker}</if>
  36. <if test="integralProportion != null and integralProportion != ''"> and integral_proportion = #{integralProportion}</if>
  37. <if test="integralDeductionOil != null and integralDeductionOil != ''"> and integral_deduction_oil = #{integralDeductionOil}</if>
  38. <if test="datePickerTime != null and datePickerTime != ''"> and date_picker_time = #{datePickerTime}</if>
  39. <if test="stationIdList != null ">
  40. and station_id in
  41. <foreach item="item" index="index" collection="stationIdList"
  42. open="(" separator="," close=")">
  43. #{item}
  44. </foreach>
  45. </if>
  46. </where>
  47. order by id desc
  48. </select>
  49. <select id="selectIntegralRuleById" parameterType="Long" resultMap="IntegralRuleResult">
  50. <include refid="selectIntegralRuleVo"/>
  51. where id = #{id}
  52. </select>
  53. <insert id="insertIntegralRule" parameterType="IntegralRule" useGeneratedKeys="true" keyProperty="id">
  54. insert into integral_rule
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="stationId != null">station_id,</if>
  57. <if test="stationName != null">station_name,</if>
  58. <if test="ruleType != null">rule_type,</if>
  59. <if test="termDateManage != null">term_date_manage,</if>
  60. <if test="emptyDate != null">empty_date,</if>
  61. <if test="expirationReminder != null">expiration_reminder,</if>
  62. <if test="remindDate != null">remind_date,</if>
  63. <if test="integralActivity != null">integral_activity,</if>
  64. <if test="datePicker != null">date_picker,</if>
  65. <if test="integralProportion != null">integral_proportion,</if>
  66. <if test="integralDeductionOil != null">integral_deduction_oil,</if>
  67. <if test="datePickerTime != null">date_picker_time,</if>
  68. </trim>
  69. <trim prefix="values (" suffix=")" suffixOverrides=",">
  70. <if test="stationId != null">#{stationId},</if>
  71. <if test="stationName != null">#{stationName},</if>
  72. <if test="ruleType != null">#{ruleType},</if>
  73. <if test="termDateManage != null">#{termDateManage},</if>
  74. <if test="emptyDate != null">#{emptyDate},</if>
  75. <if test="expirationReminder != null">#{expirationReminder},</if>
  76. <if test="remindDate != null">#{remindDate},</if>
  77. <if test="integralActivity != null">#{integralActivity},</if>
  78. <if test="datePicker != null">#{datePicker},</if>
  79. <if test="integralProportion != null">#{integralProportion},</if>
  80. <if test="integralDeductionOil != null">#{integralDeductionOil},</if>
  81. <if test="datePickerTime != null">#{datePickerTime},</if>
  82. </trim>
  83. </insert>
  84. <update id="updateIntegralRule" parameterType="IntegralRule">
  85. update integral_rule
  86. <trim prefix="SET" suffixOverrides=",">
  87. <if test="stationId != null">station_id = #{stationId},</if>
  88. <if test="stationName != null">station_name = #{stationName},</if>
  89. <if test="ruleType != null">rule_type = #{ruleType},</if>
  90. <if test="termDateManage != null">term_date_manage = #{termDateManage},</if>
  91. <if test="emptyDate != null">empty_date = #{emptyDate},</if>
  92. <if test="expirationReminder != null">expiration_reminder = #{expirationReminder},</if>
  93. <if test="remindDate != null">remind_date = #{remindDate},</if>
  94. <if test="integralActivity != null">integral_activity = #{integralActivity},</if>
  95. <if test="datePicker != null">date_picker = #{datePicker},</if>
  96. <if test="integralProportion != null">integral_proportion = #{integralProportion},</if>
  97. <if test="integralDeductionOil != null">integral_deduction_oil = #{integralDeductionOil},</if>
  98. <if test="datePickerTime != null and datePickerTime != ''"> date_picker_time = #{datePickerTime},</if>
  99. </trim>
  100. where id = #{id}
  101. </update>
  102. <delete id="deleteIntegralRuleById" parameterType="Long">
  103. delete from integral_rule where id = #{id}
  104. </delete>
  105. <delete id="deleteIntegralRuleByIds" parameterType="String">
  106. delete from integral_rule where id in
  107. <foreach item="id" collection="array" open="(" separator="," close=")">
  108. #{id}
  109. </foreach>
  110. </delete>
  111. </mapper>