SefCarCalculateInforMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.jkcredit.invoice.mapper.calculateInfor.SelfCarCalculateInforMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor">
  6. <id column="id" property="id"/>
  7. <result column="customId" property="customId"/>
  8. <result column="companyNum" property="companyNum"/>
  9. <result column="tradeId" property="tradeId"/>
  10. <result column="fee" property="fee"/>
  11. <result column="calculateTime" property="calculateTime"/>
  12. <result column="ctype" property="ctype"/>
  13. <result column="invoiceMkTime" property="invoiceMkTime"/>
  14. <result column="companyReferencenum" property="companyReferencenum"/>
  15. </resultMap>
  16. <sql id="baseSql">
  17. id,
  18. customId,
  19. companyNum,
  20. etcNum,
  21. fee,
  22. calTime,
  23. invoiceMkTime,
  24. companyReferencenum
  25. </sql>
  26. <select id="selectAllByPage" resultMap="BaseResultMap">
  27. select
  28. <include refid="baseSql" />
  29. from t_SelfCalculateInfor
  30. <if test="calculateInfor.customId != null and calculateInfor.customId != ''">
  31. and customId LIKE CONCAT('%',#{calculateInfor.customId},'%')
  32. </if>
  33. <if test="calculateInfor.companyReferencenum != null and calculateInfor.companyReferencenum != ''">
  34. and companyReferencenum =#{calculateInfor.companyReferencenum}
  35. </if>
  36. <if test="calculateInfor.etcNum != null and calculateInfor.etcNum != ''">
  37. and etcNum = #{calculateInfor.etcNum}
  38. </if>
  39. <if test="calculateInfor.calTime != null and calculateInfor.calTime != ''">
  40. and calTime BETWEEN #{calTimeStart} and #{calculateInfor.calTimeEnd}
  41. </if>
  42. </select>
  43. <select id="selectByEtcAndTime" resultMap="BaseResultMap" parameterType="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor">
  44. select
  45. <include refid="baseSql" />
  46. from t_SelfCalculateInfor where calTime = #{calTime,jdbcType=VARCHAR} and etcNum = #{etcNum,jdbcType=VARCHAR}
  47. </select>
  48. <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor" >
  49. insert into t_SelfCalculateInfor (
  50. customId,
  51. companyNum,
  52. etcNum,
  53. fee,
  54. calTime,invoiceMkTime,companyReferencenum
  55. )
  56. values ( #{customId,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR},
  57. #{etcNum,jdbcType=VARCHAR}, #{fee,jdbcType=DOUBLE},#{calTime,jdbcType=VARCHAR},#{invoiceMkTime,jdbcType=VARCHAR},#{companyReferencenum,jdbcType=VARCHAR}
  58. )
  59. </insert>
  60. <resultMap id="staticResultMap" type="java.util.Map">
  61. <result column="customId" property="customId"/>
  62. <result column="companyNum" property="companyNum"/>
  63. <result column="companyReferencenum" property="companyReferencenum"/>
  64. <result column="etcNum" property="etcNum"/>
  65. <result column="tradeIdNum" property="tradeIdNum"/>
  66. <result column="feeNum" property="feeNum"/>
  67. </resultMap>
  68. <select id="findSelfcarCalculateInfoSta" resultMap="staticResultMap">
  69. select k.*,
  70. (
  71. select count(1) from (select DISTINCT f.etcNum from t_SelfCalculateInfor f where f.companyNum = companyNum
  72. <if test="etcNum != null and etcNum != ''">
  73. and f.etcNum = #{etcNum}
  74. </if>
  75. <if test="calTime != null and calTime != ''">
  76. and f.calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
  77. </if>
  78. ) g
  79. ) etcNum,
  80. (select count(1) from t_SellCarTrade t where t.companyNum = k.companyNum
  81. and t.cardId in (select DISTINCT f.etcNum from t_SelfCalculateInfor f where f.companyNum = k.companyNum
  82. <if test="etcNum != null and etcNum != ''">
  83. and f.etcNum = #{etcNum}
  84. </if>
  85. <if test="calTime != null and calTime != ''">
  86. and f.calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
  87. </if>
  88. )
  89. <if test="calTime != null and calTime != ''">
  90. and t.exTime BETWEEN #{calTimeStart} and #{calTimeEnd}
  91. </if>
  92. ) tradeIdNum
  93. from (
  94. select
  95. customId,
  96. companyNum,
  97. companyReferencenum,
  98. count(1) feeNum
  99. from t_SelfCalculateInfor h
  100. <where>
  101. <if test="customId != null and customId != ''">
  102. and customId LIKE CONCAT('%',#{customId},'%')
  103. </if>
  104. <if test="companyReferencenum != null and companyReferencenum != ''">
  105. and companyReferencenum =#{companyReferencenum}
  106. </if>
  107. <if test="etcNum != null and etcNum != ''">
  108. and etcNum = #{etcNum}
  109. </if>
  110. <if test="calTime != null and calTime != ''">
  111. and calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
  112. </if>
  113. </where>
  114. GROUP by customId,companyNum,companyReferencenum) k
  115. </select>
  116. <select id="selectEtcNum" resultMap="BaseResultMap">
  117. select
  118. <include refid="baseSql" />
  119. from t_SelfCalculateInfor
  120. </select>
  121. <select id="selectAllByPage" resultMap="BaseResultMap">
  122. select
  123. <include refid="baseSql" />
  124. from t_SelfCalculateInfor
  125. </select>
  126. </mapper>