TemporaryCheckinMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.barracksManagement.mapper.TemporaryCheckinMapper">
  6. <resultMap type="TemporaryCheckin" id="TemporaryCheckinResult">
  7. <result property="id" column="id" />
  8. <result property="unitName" column="unit_name" />
  9. <result property="unitId" column="unit_id" />
  10. <result property="creatTime" column="creat_time" />
  11. <result property="creatId" column="creat_id" />
  12. <result property="position" column="position" />
  13. <result property="occupant" column="occupant" />
  14. <result property="entryTime" column="entry_time" />
  15. <result property="endTime" column="end_time" />
  16. <result property="creatName" column="creat_name" />
  17. <result property="remark" column="remark" />
  18. <result property="position2" column="position2" />
  19. </resultMap>
  20. <sql id="selectTemporaryCheckinVo">
  21. select id, unit_name, unit_id, creat_time, creat_id, position, occupant, entry_time, end_time, creat_name,remark,position2 from temporary_checkin
  22. </sql>
  23. <select id="selectTemporaryCheckinList" parameterType="TemporaryCheckin" resultMap="TemporaryCheckinResult">
  24. select*from(
  25. <include refid="selectTemporaryCheckinVo"/>
  26. <where>
  27. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  28. <if test="unitId != null "> and unit_id = #{unitId}</if>
  29. <if test="creatTime != null "> and creat_time = #{creatTime}</if>
  30. <if test="creatId != null "> and creat_id = #{creatId}</if>
  31. <if test="position != null and position != ''"> and position = #{position}</if>
  32. <if test="occupant != null and occupant != ''"> and occupant like concat('%', #{occupant}, '%')</if>
  33. <if test="entryTime != null "> and entry_time = #{entryTime}</if>
  34. <if test="endTime != null "> and end_time = #{endTime}</if>
  35. <if test="creatName != null and creatName != ''"> and creat_name like concat('%', #{creatName}, '%')</if>
  36. <if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
  37. <if test="position2 != null and position2 != ''"> and position2 like concat('%', #{position2}, '%')</if>
  38. </where>
  39. ORDER BY
  40. id desc
  41. )a
  42. ORDER BY
  43. a.id desc
  44. </select>
  45. <select id="selectTemporaryCheckinById" parameterType="Long" resultMap="TemporaryCheckinResult">
  46. <include refid="selectTemporaryCheckinVo"/>
  47. where id = #{id}
  48. </select>
  49. <insert id="insertTemporaryCheckin" parameterType="TemporaryCheckin">
  50. insert into temporary_checkin
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="id != null">id,</if>
  53. <if test="unitName != null">unit_name,</if>
  54. <if test="unitId != null">unit_id,</if>
  55. <if test="creatTime != null">creat_time,</if>
  56. <if test="creatId != null">creat_id,</if>
  57. <if test="position != null">position,</if>
  58. <if test="occupant != null">occupant,</if>
  59. <if test="entryTime != null">entry_time,</if>
  60. <if test="endTime != null">end_time,</if>
  61. <if test="creatName != null">creat_name,</if>
  62. <if test="remark != null">remark,</if>
  63. <if test="position2 != null">position2,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="id != null">#{id},</if>
  67. <if test="unitName != null">#{unitName},</if>
  68. <if test="unitId != null">#{unitId},</if>
  69. <if test="creatTime != null">#{creatTime},</if>
  70. <if test="creatId != null">#{creatId},</if>
  71. <if test="position != null">#{position},</if>
  72. <if test="occupant != null">#{occupant},</if>
  73. <if test="entryTime != null">#{entryTime},</if>
  74. <if test="endTime != null">#{endTime},</if>
  75. <if test="creatName != null">#{creatName},</if>
  76. <if test="remark != null">#{remark},</if>
  77. <if test="position2 != null">#{position2},</if>
  78. </trim>
  79. </insert>
  80. <update id="updateTemporaryCheckin" parameterType="TemporaryCheckin">
  81. update temporary_checkin
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="unitName != null">unit_name = #{unitName},</if>
  84. <if test="unitId != null">unit_id = #{unitId},</if>
  85. <if test="creatTime != null">creat_time = #{creatTime},</if>
  86. <if test="creatId != null">creat_id = #{creatId},</if>
  87. <if test="position != null">position = #{position},</if>
  88. <if test="occupant != null">occupant = #{occupant},</if>
  89. <if test="entryTime != null">entry_time = #{entryTime},</if>
  90. <if test="endTime != null">end_time = #{endTime},</if>
  91. <if test="creatName != null">creat_name = #{creatName},</if>
  92. <if test="remark != null">remark = #{remark},</if>
  93. <if test="position2 != null">position2 = #{position2},</if>
  94. </trim>
  95. where id = #{id}
  96. </update>
  97. <delete id="deleteTemporaryCheckinById" parameterType="Long">
  98. delete from temporary_checkin where id = #{id}
  99. </delete>
  100. <delete id="deleteTemporaryCheckinByIds" parameterType="String">
  101. delete from temporary_checkin where id in
  102. <foreach item="id" collection="array" open="(" separator="," close=")">
  103. #{id}
  104. </foreach>
  105. </delete>
  106. </mapper>