選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

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