BdglMilitarydutyMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.combatduty.mapper.BdglMilitarydutyMapper">
  6. <resultMap type="BdglMilitaryduty" id="BdglMilitarydutyResult">
  7. <result property="id" column="id" />
  8. <result property="attendedTime" column="attended_time" />
  9. <result property="numberPlateId" column="number_plate_id" />
  10. <result property="numberPlateName" column="number_plate_name" />
  11. <result property="carUnitId" column="car_unit_id" />
  12. <result property="carUnitName" column="car_unit_name" />
  13. <result property="carType" column="car_type" />
  14. <result property="carStates" column="car_states" />
  15. <result property="adress" column="adress" />
  16. <result property="driverId" column="driver_id" />
  17. <result property="driverName" column="driver_name" />
  18. <result property="telephone" column="telephone" />
  19. <result property="modelInfo" column="model_info" />
  20. <result property="modelText" column="model_text" />
  21. <result property="color" column="color" />
  22. <result property="driverUnit" column="driver_unit" />
  23. <result property="driverUnitId" column="driver_unit_id" />
  24. </resultMap>
  25. <sql id="selectBdglMilitarydutyVo">
  26. select id, attended_time, number_plate_id, number_plate_name, car_unit_id, car_unit_name, car_type, car_states, adress, driver_id, driver_name, telephone, model_info, model_text, color, driver_unit, driver_unit_id from bdgl_militaryduty
  27. </sql>
  28. <select id="selectBdglMilitarydutyList" parameterType="BdglMilitaryduty" resultMap="BdglMilitarydutyResult">
  29. <include refid="selectBdglMilitarydutyVo"/>
  30. <where>
  31. <if test="attendedTime != null and attendedTime != ''"> and attended_time = #{attendedTime}</if>
  32. <if test="numberPlateId != null "> and number_plate_id = #{numberPlateId}</if>
  33. <if test="numberPlateName != null and numberPlateName != ''"> and number_plate_name like concat('%', #{numberPlateName}, '%')</if>
  34. <if test="carUnitId != null "> and car_unit_id = #{carUnitId}</if>
  35. <if test="carUnitName != null and carUnitName != ''"> and car_unit_name like concat('%', #{carUnitName}, '%')</if>
  36. <if test="carType != null and carType != ''"> and car_type = #{carType}</if>
  37. <if test="carStates != null and carStates != ''"> and car_states = #{carStates}</if>
  38. <if test="adress != null and adress != ''"> and adress = #{adress}</if>
  39. <if test="driverId != null "> and driver_id = #{driverId}</if>
  40. <if test="driverName != null and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
  41. <if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
  42. <if test="modelInfo != null and modelInfo != ''"> and model_info = #{modelInfo}</if>
  43. <if test="modelText != null and modelText != ''"> and model_text = #{modelText}</if>
  44. <if test="color != null and color != ''"> and color = #{color}</if>
  45. <if test="driverUnit != null and driverUnit != ''"> and driver_unit = #{driverUnit}</if>
  46. <if test="driverUnitId != null "> and driver_unit_id = #{driverUnitId}</if>
  47. <if test="attendedTimeGe != null"> and attended_time &gt;= #{attendedTimeGe}</if>
  48. <if test="attendedTimeLe != null"> and attended_time &lt;= #{attendedTimeLe}</if>
  49. </where>
  50. order by id desc
  51. </select>
  52. <select id="selectBdglMilitarydutyById" parameterType="Long" resultMap="BdglMilitarydutyResult">
  53. <include refid="selectBdglMilitarydutyVo"/>
  54. where id = #{id}
  55. </select>
  56. <insert id="insertBdglMilitaryduty" parameterType="BdglMilitaryduty" useGeneratedKeys="true" keyProperty="id">
  57. insert into bdgl_militaryduty
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="attendedTime != null">attended_time,</if>
  60. <if test="numberPlateId != null">number_plate_id,</if>
  61. <if test="numberPlateName != null">number_plate_name,</if>
  62. <if test="carUnitId != null">car_unit_id,</if>
  63. <if test="carUnitName != null">car_unit_name,</if>
  64. <if test="carType != null">car_type,</if>
  65. <if test="carStates != null">car_states,</if>
  66. <if test="adress != null">adress,</if>
  67. <if test="driverId != null">driver_id,</if>
  68. <if test="driverName != null">driver_name,</if>
  69. <if test="telephone != null">telephone,</if>
  70. <if test="modelInfo != null">model_info,</if>
  71. <if test="modelText != null">model_text,</if>
  72. <if test="color != null">color,</if>
  73. <if test="driverUnit != null">driver_unit,</if>
  74. <if test="driverUnitId != null">driver_unit_id,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="attendedTime != null">#{attendedTime},</if>
  78. <if test="numberPlateId != null">#{numberPlateId},</if>
  79. <if test="numberPlateName != null">#{numberPlateName},</if>
  80. <if test="carUnitId != null">#{carUnitId},</if>
  81. <if test="carUnitName != null">#{carUnitName},</if>
  82. <if test="carType != null">#{carType},</if>
  83. <if test="carStates != null">#{carStates},</if>
  84. <if test="adress != null">#{adress},</if>
  85. <if test="driverId != null">#{driverId},</if>
  86. <if test="driverName != null">#{driverName},</if>
  87. <if test="telephone != null">#{telephone},</if>
  88. <if test="modelInfo != null">#{modelInfo},</if>
  89. <if test="modelText != null">#{modelText},</if>
  90. <if test="color != null">#{color},</if>
  91. <if test="driverUnit != null">#{driverUnit},</if>
  92. <if test="driverUnitId != null">#{driverUnitId},</if>
  93. </trim>
  94. </insert>
  95. <update id="updateBdglMilitaryduty" parameterType="BdglMilitaryduty">
  96. update bdgl_militaryduty
  97. <trim prefix="SET" suffixOverrides=",">
  98. <if test="attendedTime != null">attended_time = #{attendedTime},</if>
  99. <if test="numberPlateId != null">number_plate_id = #{numberPlateId},</if>
  100. <if test="numberPlateName != null">number_plate_name = #{numberPlateName},</if>
  101. <if test="carUnitId != null">car_unit_id = #{carUnitId},</if>
  102. <if test="carUnitName != null">car_unit_name = #{carUnitName},</if>
  103. <if test="carType != null">car_type = #{carType},</if>
  104. <if test="carStates != null">car_states = #{carStates},</if>
  105. <if test="adress != null">adress = #{adress},</if>
  106. <if test="driverId != null">driver_id = #{driverId},</if>
  107. <if test="driverName != null">driver_name = #{driverName},</if>
  108. <if test="telephone != null">telephone = #{telephone},</if>
  109. <if test="modelInfo != null">model_info = #{modelInfo},</if>
  110. <if test="modelText != null">model_text = #{modelText},</if>
  111. <if test="color != null">color = #{color},</if>
  112. <if test="driverUnit != null">driver_unit = #{driverUnit},</if>
  113. <if test="driverUnitId != null">driver_unit_id = #{driverUnitId},</if>
  114. </trim>
  115. where id = #{id}
  116. </update>
  117. <delete id="deleteBdglMilitarydutyById" parameterType="Long">
  118. delete from bdgl_militaryduty where id = #{id}
  119. </delete>
  120. <delete id="deleteBdglMilitarydutyByIds" parameterType="String">
  121. delete from bdgl_militaryduty where id in
  122. <foreach item="id" collection="array" open="(" separator="," close=")">
  123. #{id}
  124. </foreach>
  125. </delete>
  126. <select id="selectDutyListByAttendedTime" resultMap="BdglMilitarydutyResult">
  127. SELECT id,number_plate_id FROM bdgl_militaryduty where STR_TO_DATE(attended_time,'%Y-%m-%d') &gt;= CURDATE()
  128. </select>
  129. </mapper>