IntegralRuleMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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="rule_type" jdbcType="VARCHAR" property="ruleType" />
  10. <result column="term_date_manage" jdbcType="VARCHAR" property="termDateManage" />
  11. <result column="empty_date" jdbcType="DATE" property="emptyDate" />
  12. <result column="expiration_reminder" jdbcType="VARCHAR" property="expirationReminder" />
  13. <result column="remind_date" jdbcType="DATE" property="remindDate" />
  14. <result column="integral_activity" jdbcType="VARCHAR" property="integralActivity" />
  15. <result column="date_picker" jdbcType="VARCHAR" property="datePicker" />
  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_terms" jdbcType="DECIMAL" property="ruleTerms" />
  25. <result column="gread_id" jdbcType="INTEGER" property="greadId"/>
  26. <result column="gread" jdbcType="VARCHAR" property="gread" />
  27. <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
  28. <result column="sale_amt" jdbcType="DECIMAL" property="saleAmt" />
  29. <result column="integral" jdbcType="DECIMAL" property="integral" />
  30. </resultMap>
  31. <!--查询油站积分规则信息-->
  32. <select id="getIntegralRule" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.IntegralRule">
  33. SELECT
  34. T1.id,
  35. T1.station_id,
  36. T1.station_name,
  37. T1.rule_type,
  38. T1.term_date_manage,
  39. T1.empty_date,
  40. T1.expiration_reminder,
  41. T1.remind_date,
  42. T1.integral_activity,
  43. T1.date_picker,
  44. T1.integral_proportion,
  45. T1.integral_deduction_oil,
  46. T2.id AS integralRuleDetailId,
  47. T2.rule_terms,
  48. T2.parent_id,
  49. T2.gread_id,
  50. T2.gread,
  51. T2.oil_name,
  52. T2.sale_amt,
  53. T2.integral
  54. FROM
  55. integral_rule AS T1 LEFT JOIN integral_rule_detail AS T2 ON T1.id = T2.parent_id
  56. <where>
  57. <if test="stationId !=null and stationId !=''">
  58. T1.station_id = #{stationId}
  59. </if>
  60. <if test="oilName !=null and oilName !=''">
  61. AND T2.oil_name = #{oilName}
  62. </if>
  63. </where>
  64. ORDER BY T2.rule_terms DESC
  65. </select>
  66. </mapper>