BdglPrivateAccessLogMapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.supervision.militaryvehicleManagement.mapper.BdglPrivateAccessLogMapper">
  6. <resultMap type="BdglPrivateAccessLog" id="BdglPrivateAccessLogResult">
  7. <result property="id" column="id" />
  8. <result property="privateCarId" column="private_car_id" />
  9. <result property="vehiclenumber" column="vehiclenumber" />
  10. <result property="vehiclecategory" column="vehiclecategory" />
  11. <result property="vehiclemodel" column="vehiclemodel" />
  12. <result property="vehiclecolor" column="vehiclecolor" />
  13. <result property="peopleId" column="people_id" />
  14. <result property="peopleName" column="people_name" />
  15. <result property="contactnumber" column="contactnumber" />
  16. <result property="jinrushiajin" column="jinrushiajin" />
  17. <result property="adminId" column="admin_id" />
  18. <result property="likaishitian" column="likaishitian" />
  19. <result property="createtime" column="createtime" />
  20. <result property="updatetime" column="updatetime" />
  21. <result property="remark" column="remark" />
  22. </resultMap>
  23. <sql id="selectBdglPrivateAccessLogVo">
  24. select id, private_car_id, vehiclenumber, vehiclecategory, vehiclemodel, vehiclecolor, people_id, people_name, contactnumber, jinrushiajin, admin_id, likaishitian, createtime, updatetime,remark from bdgl_private_access_log
  25. </sql>
  26. <select id="selectBdglPrivateAccessLogList" parameterType="BdglPrivateAccessLog" resultMap="BdglPrivateAccessLogResult">
  27. <include refid="selectBdglPrivateAccessLogVo"/>
  28. <where>
  29. <if test="privateCarId != null "> and private_car_id = #{privateCarId}</if>
  30. <if test="vehiclenumber != null and vehiclenumber != ''"> and vehiclenumber = #{vehiclenumber}</if>
  31. <if test="vehiclecategory != null and vehiclecategory != ''"> and vehiclecategory = #{vehiclecategory}</if>
  32. <if test="vehiclemodel != null and vehiclemodel != ''"> and vehiclemodel = #{vehiclemodel}</if>
  33. <if test="vehiclecolor != null and vehiclecolor != ''"> and vehiclecolor = #{vehiclecolor}</if>
  34. <if test="peopleId != null and peopleId != ''"> and people_id = #{peopleId}</if>
  35. <if test="peopleName != null and peopleName != ''"> and people_name like concat('%', #{peopleName}, '%')</if>
  36. <if test="contactnumber != null and contactnumber != ''"> and contactnumber = #{contactnumber}</if>
  37. <if test="jinrushiajin != null "> and jinrushiajin &gt;= #{jinrushiajin} </if>
  38. <if test="adminId != null "> and admin_id = #{adminId}</if>
  39. <if test="likaishitian != null "> and likaishitian &lt;= #{likaishitian}</if>
  40. <if test="createtime != null "> and createtime = #{createtime}</if>
  41. <if test="updatetime != null "> and updatetime = #{updatetime}</if>
  42. <if test="remark != null "> and remark = #{remark}</if>
  43. </where>
  44. </select>
  45. <select id="selectBdglPrivateAccessLog" parameterType="BdglPrivateAccessLog" resultMap="BdglPrivateAccessLogResult">
  46. <include refid="selectBdglPrivateAccessLogVo"/>
  47. <where>
  48. DATEDIFF(jinrushiajin,NOW())=0
  49. </where>
  50. </select>
  51. <select id="selectBdglPrivateAccessLogById" parameterType="Integer" resultMap="BdglPrivateAccessLogResult">
  52. <include refid="selectBdglPrivateAccessLogVo"/>
  53. where id = #{id}
  54. </select>
  55. <select id="selectBdglPrivateAccessLogLists" resultMap="BdglPrivateAccessLogResult">
  56. <include refid="selectBdglPrivateAccessLogVo"/>
  57. where
  58. <![CDATA[ jinrushiajin>=#{jinrushiajin}and jinrushiajin<=#{likaishitian}]]>
  59. </select>
  60. <select id="selectPersonalCarInStat"
  61. resultType="com.supervision.militaryvehicleManagement.domain.vo.PersonalCarStat">
  62. SELECT
  63. vehiclenumber as chePaiNum,
  64. count(vehiclenumber) AS inCount,
  65. jinrushiajin as inTime,
  66. likaishitian as outTime
  67. FROM
  68. bdgl_private_access_log
  69. <where>
  70. <if test="chePaiNum != null and chePaiNum != ''">and vehiclenumber = #{chePaiNum}</if>
  71. <if test="startTime != null and endTime != null">and jinrushiajin BETWEEN #{startTime} AND #{endTime}</if>
  72. </where>
  73. GROUP BY vehiclenumber
  74. ORDER BY inCount DESC
  75. </select>
  76. <select id="selectPersonalCarOutStat" resultType="java.lang.Long">
  77. SELECT count(vehiclenumber) from bdgl_private_access_log
  78. WHERE
  79. vehiclenumber = #{chePaiNum} and
  80. jinrushiajin BETWEEN #{startTime} AND #{endTime}
  81. </select>
  82. <insert id="insertBdglPrivateAccessLog" parameterType="BdglPrivateAccessLog" useGeneratedKeys="true" keyProperty="id">
  83. insert into bdgl_private_access_log
  84. <trim prefix="(" suffix=")" suffixOverrides=",">
  85. <if test="privateCarId != null">private_car_id,</if>
  86. <if test="vehiclenumber != null">vehiclenumber,</if>
  87. <if test="vehiclecategory != null">vehiclecategory,</if>
  88. <if test="vehiclemodel != null">vehiclemodel,</if>
  89. <if test="vehiclecolor != null">vehiclecolor,</if>
  90. <if test="peopleId != null">people_id,</if>
  91. <if test="peopleName != null">people_name,</if>
  92. <if test="contactnumber != null">contactnumber,</if>
  93. <if test="jinrushiajin != null">jinrushiajin,</if>
  94. <if test="adminId != null">admin_id,</if>
  95. <if test="likaishitian != null">likaishitian,</if>
  96. <if test="createtime != null">createtime,</if>
  97. <if test="updatetime != null">updatetime,</if>
  98. <if test="remark != null">remark,</if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="privateCarId != null">#{privateCarId},</if>
  102. <if test="vehiclenumber != null">#{vehiclenumber},</if>
  103. <if test="vehiclecategory != null">#{vehiclecategory},</if>
  104. <if test="vehiclemodel != null">#{vehiclemodel},</if>
  105. <if test="vehiclecolor != null">#{vehiclecolor},</if>
  106. <if test="peopleId != null">#{peopleId},</if>
  107. <if test="peopleName != null">#{peopleName},</if>
  108. <if test="contactnumber != null">#{contactnumber},</if>
  109. <if test="jinrushiajin != null">#{jinrushiajin},</if>
  110. <if test="adminId != null">#{adminId},</if>
  111. <if test="likaishitian != null">#{likaishitian},</if>
  112. <if test="createtime != null">#{createtime},</if>
  113. <if test="updatetime != null">#{updatetime},</if>
  114. <if test="remark != null">#{remark},</if>
  115. </trim>
  116. </insert>
  117. <update id="updateBdglPrivateAccessLog" parameterType="BdglPrivateAccessLog">
  118. update bdgl_private_access_log
  119. <trim prefix="SET" suffixOverrides=",">
  120. <if test="privateCarId != null">private_car_id = #{privateCarId},</if>
  121. <if test="vehiclenumber != null">vehiclenumber = #{vehiclenumber},</if>
  122. <if test="vehiclecategory != null">vehiclecategory = #{vehiclecategory},</if>
  123. <if test="vehiclemodel != null">vehiclemodel = #{vehiclemodel},</if>
  124. <if test="vehiclecolor != null">vehiclecolor = #{vehiclecolor},</if>
  125. <if test="peopleId != null">people_id = #{peopleId},</if>
  126. <if test="peopleName != null">people_name = #{peopleName},</if>
  127. <if test="contactnumber != null">contactnumber = #{contactnumber},</if>
  128. <if test="jinrushiajin != null">jinrushiajin = #{jinrushiajin},</if>
  129. <if test="adminId != null">admin_id = #{adminId},</if>
  130. <if test="likaishitian != null">likaishitian = #{likaishitian},</if>
  131. <if test="createtime != null">createtime = #{createtime},</if>
  132. <if test="updatetime != null">updatetime = #{updatetime},</if>
  133. <if test="remark != null">remark = #{remark},</if>
  134. </trim>
  135. where id = #{id}
  136. </update>
  137. <delete id="deleteBdglPrivateAccessLogById" parameterType="Integer">
  138. delete from bdgl_private_access_log where id = #{id}
  139. </delete>
  140. <delete id="deleteBdglPrivateAccessLogByIds" parameterType="String">
  141. delete from bdgl_private_access_log where id in
  142. <foreach item="id" collection="array" open="(" separator="," close=")">
  143. #{id}
  144. </foreach>
  145. </delete>
  146. </mapper>