Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

107 строки
3.6 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="c_user_id" jdbcType="BIGINT" property="cUserId" />
  8. <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
  9. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  10. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  11. <result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
  12. <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
  13. </resultMap>
  14. <sql id="allColumns">
  15. `id`,`tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`
  16. </sql>
  17. <sql id="dynamicWhereConditions">
  18. where 1 = 1
  19. <if test=" null != id ">
  20. and `id` = #{id}
  21. </if>
  22. <if test=" null != tenantId ">
  23. and `tenant_id` = #{tenantId}
  24. </if>
  25. <if test=" null != cUserId ">
  26. and `c_user_id` = #{cUserId}
  27. </if>
  28. <if test=" null != carNumber ">
  29. and `car_number` like concat('%', #{carNumber},'%')
  30. </if>
  31. <if test=" null != createDate ">
  32. and `create_date` = #{createDate}
  33. </if>
  34. <if test=" null != updateDate ">
  35. and `update_date` = #{updateDate}
  36. </if>
  37. <if test=" null != vendorType ">
  38. and `vendor_type` = #{vendorType}
  39. </if>
  40. <if test=" null != vendorParams ">
  41. and `vendor_params` like concat('%', #{vendorParams},'%')
  42. </if>
  43. <if test=" null != ids ">
  44. and id in
  45. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  46. #{idItem}
  47. </foreach>
  48. </if>
  49. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  50. </sql>
  51. <select id="findList" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
  52. select <include refid="allColumns" /> from wx_c_user_car
  53. <include refid="dynamicWhereConditions" />
  54. </select>
  55. <select id="countList" parameterType="com.iformall.domain.po.WxCUserCar" resultType="java.lang.Integer">
  56. select count(*) from wx_c_user_car
  57. <include refid="dynamicWhereConditions" />
  58. </select>
  59. <select id="countUser" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Integer">
  60. select count(DISTINCT ubi.id) from wx_c_user_car uc, wx_c_user_basic_info ubi
  61. where uc.c_user_id = ubi.id
  62. <if test=" null != tenantId ">
  63. and uc.tenant_id = #{tenantId}
  64. and ubi.tenant_id = #{tenantId}
  65. </if>
  66. <if test=" null != startTime ">
  67. and ubi.create_date &gt;= #{startTime}
  68. </if>
  69. <if test=" null != endTime">
  70. and ubi.create_date &lt; #{endTime}
  71. </if>
  72. </select>
  73. <select id="queryCarCount" parameterType="hashmap" resultType="long">
  74. select count(id) from wx_c_user_car where tenant_id=#{tenantId} and create_date between #{startdate} and #{enddate}
  75. </select>
  76. <select id="queryCarCountHistory" resultType="hashmap" parameterType="hashmap">
  77. SELECT count(DISTINCT c.id) count, c.create_time FROM
  78. (SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time FROM wx_c_user_car uc, wx_c_user_basic_info ubi WHERE uc.c_user_id = ubi.id
  79. AND uc.tenant_id = #{tenantId} AND ubi.tenant_id = #{tenantId} AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c
  80. GROUP BY c.create_time ORDER BY c.create_time
  81. </select>
  82. </mapper>