Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

145 Zeilen
5.1 KiB

  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.iformall.mapper.WxCUserCarMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserCar">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  9. <result column="phone" jdbcType="VARCHAR" property="userPhone" />
  10. <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
  11. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  12. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  13. <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
  14. <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
  15. <result column="vendor_person_id" jdbcType="VARCHAR" property="vendorPersonId" />
  16. </resultMap>
  17. <sql id="allColumns">
  18. wcuc.`id`,wcuc.`tenant_id`,wcuc.`parent_tenant_id`,wcuc.`c_user_id`,wcuc.`car_number`,wcuc.`create_date`,wcuc.`update_date`,wcuc.`vendor_type`,wcuc.`vendor_params`,wcuc.`vendor_person_id`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. <if test=" null != id ">
  22. and wcuc.`id` = #{id}
  23. </if>
  24. <if test=" null != tenantId and '' != tenantId">
  25. and wcuc.`tenant_id` = #{tenantId}
  26. </if>
  27. <if test=" null != parentTenantId and '' != parentTenantId">
  28. and wcuc.`parent_tenant_id` = #{parentTenantId}
  29. </if>
  30. <if test=" null != cUserId ">
  31. and wcuc.`c_user_id` = #{cUserId}
  32. </if>
  33. <if test=" null != carNumber ">
  34. and wcuc.`car_number` like concat('%', #{carNumber},'%')
  35. </if>
  36. <!-- <if test=" null != carNumber ">
  37. and `car_number` like concat('%', #{carNumber},'%')
  38. </if> -->
  39. <if test=" null != createDate ">
  40. and wcuc.`create_date` = #{createDate}
  41. </if>
  42. <if test=" null != vendorType ">
  43. and wcuc.`vendor_type` = #{vendorType}
  44. </if>
  45. <!--<if test=" null != vendorParams ">
  46. and `vendor_params` like concat('%', #{vendorParams},'%')
  47. </if>-->
  48. <if test=" null != vendorPersonId ">
  49. and wcuc.`vendor_person_id` = #{vendorPersonId}
  50. </if>
  51. <if test=" null != ids ">
  52. and wcuc.id in
  53. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  54. #{idItem}
  55. </foreach>
  56. </if>
  57. <!-- <if test=" null != sortColumns"> order by ${sortColumns} </if>-->
  58. order by wcuc.create_date
  59. </sql>
  60. <select id="findList1" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
  61. select
  62. <include refid="allColumns"/>,wcubi.`phone`
  63. from wx_c_user_car wcuc
  64. left join wx_c_user_basic_info wcubi on wcubi.id = wcuc.c_user_id
  65. where 1 = 1
  66. <if test=" null != userPhone">
  67. and wcubi.`phone` like concat('%', #{userPhone},'%')
  68. </if>
  69. <include refid="dynamicWhereConditions" />
  70. </select>
  71. <select id="findList" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
  72. select
  73. <include refid="allColumns"/>
  74. from wx_c_user_car wcuc
  75. where 1 = 1
  76. <include refid="dynamicWhereConditions" />
  77. </select>
  78. <select id="countList" parameterType="com.iformall.domain.po.WxCUserCar" resultType="java.lang.Integer">
  79. select count(1) from wx_c_user_car wcuc
  80. where 1 = 1
  81. <include refid="dynamicWhereConditions" />
  82. </select>
  83. <select id="countUser" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Integer">
  84. select count(DISTINCT ubi.id) from wx_c_user_car uc, wx_c_user_basic_info ubi
  85. where uc.c_user_id = ubi.id
  86. <if test=" null != tenantId and '' != tenantId">
  87. and uc.tenant_id = #{tenantId}
  88. </if>
  89. <if test=" null != parentTenantId and '' != parentTenantId">
  90. and uc.parent_tenant_id = #{parentTenantId}
  91. </if>
  92. <if test=" null != startTime ">
  93. and ubi.create_date &gt;= #{startTime}
  94. </if>
  95. <if test=" null != endTime">
  96. and ubi.create_date &lt; #{endTime}
  97. </if>
  98. </select>
  99. <select id="queryCarCount" parameterType="hashmap" resultType="long">
  100. select count(id) from wx_c_user_car where 1=1
  101. <if test=" null != tenantId and '' != tenantId">
  102. and `tenant_id` = #{tenantId}
  103. </if>
  104. <if test=" null != parentTenantId and '' != parentTenantId">
  105. and `parent_tenant_id` = #{parentTenantId}
  106. </if>
  107. and create_date between #{startdate} and #{enddate}
  108. </select>
  109. <select id="queryCarCountHistory" resultType="hashmap" parameterType="hashmap">
  110. SELECT count(DISTINCT c.id) count, c.create_time FROM
  111. (SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time
  112. FROM wx_c_user_car uc, wx_c_user_basic_info ubi
  113. WHERE uc.c_user_id = ubi.id
  114. <if test=" null != tenantId and '' != tenantId">
  115. and uc.tenant_id = #{tenantId}
  116. </if>
  117. <if test=" null != parentTenantId and '' != parentTenantId">
  118. and uc.parent_tenant_id = #{parentTenantId}
  119. </if>
  120. AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c
  121. GROUP BY c.create_time ORDER BY c.create_time
  122. </select>
  123. </mapper>