IntegralRuleMapper.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.yijia.dao.IntegralRuleMapper">
  4. <!--积分规则返回结果-->
  5. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.IntegralRule">
  6. <id column="id" jdbcType="INTEGER" property="id" />
  7. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  8. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  9. <result column="term_date_manage" jdbcType="VARCHAR" property="termDateManage" />
  10. <result column="empty_date" jdbcType="DATE" property="emptyDate" />
  11. <result column="expiration_reminder" jdbcType="VARCHAR" property="expirationReminder" />
  12. <result column="remind_date" jdbcType="DATE" property="remindDate" />
  13. <result column="integral_activity" jdbcType="VARCHAR" property="integralActivity" />
  14. <result column="date_picker" jdbcType="VARCHAR" property="datePicker" />
  15. <result column="date_picker_time" jdbcType="VARCHAR" property="datePickerTime" />
  16. <result column="integral_proportion" jdbcType="VARCHAR" property="integralProportion" />
  17. <result column="integral_deduction_oil" jdbcType="VARCHAR" property="integralDeductionOil" />
  18. <collection property="integralRuleDetailList" resultMap="IntegralRuleDetailResultMap"/>
  19. </resultMap>
  20. <!--积分规则明细表-->
  21. <resultMap id="IntegralRuleDetailResultMap" type="com.platform.yijia.pojo.IntegralRuleDetail">
  22. <id column="integralRuleDetailId" jdbcType="INTEGER" property="integralRuleDetailId" />
  23. <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
  24. <result column="rule_type" jdbcType="VARCHAR" property="ruleType" />
  25. <result column="rule_terms" jdbcType="DECIMAL" property="ruleTerms" />
  26. <result column="gread_id" jdbcType="INTEGER" property="greadId"/>
  27. <result column="gread" jdbcType="VARCHAR" property="gread" />
  28. <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
  29. <result column="sale_amt" jdbcType="DECIMAL" property="saleAmt" />
  30. <result column="integral" jdbcType="DECIMAL" property="integral" />
  31. <result column="oil_type" jdbcType="VARCHAR" property="oilType" />
  32. </resultMap>
  33. <!--查询油站积分规则信息-->
  34. <select id="getIntegralRule" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.IntegralRule">
  35. SELECT
  36. T1.id,
  37. T1.station_id,
  38. T1.station_name,
  39. T1.term_date_manage,
  40. T1.empty_date,
  41. T1.expiration_reminder,
  42. T1.remind_date,
  43. T1.integral_activity,
  44. T1.date_picker,
  45. T1.date_picker_time,
  46. T1.integral_proportion,
  47. T1.integral_deduction_oil,
  48. T2.id AS integralRuleDetailId,
  49. T2.rule_type,
  50. T2.rule_terms,
  51. T2.parent_id,
  52. T2.gread_id,
  53. T2.gread,
  54. T2.oil_name,
  55. T2.sale_amt,
  56. T2.integral,
  57. T2.oil_type
  58. FROM
  59. integral_rule AS T1 LEFT JOIN integral_rule_detail AS T2 ON T1.id = T2.parent_id
  60. <where>
  61. <if test="stationId !=null and stationId !=''">
  62. T1.station_id = #{stationId}
  63. </if>
  64. <if test="oilName !=null and oilName !=''">
  65. AND T2.oil_name = #{oilName}
  66. </if>
  67. <if test="emptyDate !=null">
  68. <![CDATA[ AND T1.empty_date >= #{emptyDate} ]]>
  69. </if>
  70. <if test="oilType !=null and oilType !=''">
  71. AND T2.oil_type = #{oilType}
  72. </if>
  73. </where>
  74. ORDER BY T2.rule_terms DESC
  75. </select>
  76. </mapper>