BdglRegisDutyMapper.xml 6.1 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.combatduty.mapper.BdglRegisDutyMapper">
  6. <resultMap type="BdglRegisDuty" id="BdglRegisDutyResult">
  7. <result property="id" column="id" />
  8. <result property="unitName" column="unit_name" />
  9. <result property="unitId" column="unit_id" />
  10. <result property="equipmentName" column="equipment_name" />
  11. <result property="equipmentId" column="equipment_id" />
  12. <result property="equipmentNumber" column="equipment_number" />
  13. <result property="type" column="type" />
  14. <result property="equipmentStates" column="equipment_states" />
  15. <result property="standbyPosition" column="standby_position" />
  16. <result property="attendedTime" column="attended_time" />
  17. <result property="remarks" column="remarks" />
  18. <result property="isonduty" column="isonduty" />
  19. <result property="typenumber" column="typenumber" />
  20. </resultMap>
  21. <sql id="selectBdglRegisDutyVo">
  22. select id, unit_name, unit_id, equipment_name, equipment_id, equipment_number, type, equipment_states, standby_position, attended_time, remarks,isonduty from bdgl_regis_duty
  23. </sql>
  24. <select id="selectBdglRegisDutyList" parameterType="BdglRegisDuty" resultMap="BdglRegisDutyResult">
  25. <include refid="selectBdglRegisDutyVo"/>
  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="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
  30. <if test="equipmentId != null and equipmentId != ''"> and equipment_id = #{equipmentId}</if>
  31. <if test="equipmentNumber != null "> and equipment_number = #{equipmentNumber}</if>
  32. <if test="type != null and type != ''"> and type = #{type}</if>
  33. <if test="equipmentStates != null and equipmentStates != ''"> and equipment_states = #{equipmentStates}</if>
  34. <if test="standbyPosition != null and standbyPosition != ''"> and standby_position = #{standbyPosition}</if>
  35. <if test="attendedTime != null and attendedTime != ''"> and attended_time = #{attendedTime}</if>
  36. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  37. <if test="isonduty != null and isonduty != ''"> and isonduty = #{isonduty}</if>
  38. </where>
  39. order by id desc
  40. </select>
  41. <select id="selectBdglRegisDutyById" parameterType="Long" resultMap="BdglRegisDutyResult">
  42. <include refid="selectBdglRegisDutyVo"/>
  43. where id = #{id}
  44. </select>
  45. <insert id="insertBdglRegisDuty" parameterType="BdglRegisDuty" useGeneratedKeys="true" keyProperty="id">
  46. insert into bdgl_regis_duty
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="unitName != null">unit_name,</if>
  49. <if test="unitId != null">unit_id,</if>
  50. <if test="equipmentName != null">equipment_name,</if>
  51. <if test="equipmentId != null">equipment_id,</if>
  52. <if test="equipmentNumber != null">equipment_number,</if>
  53. <if test="type != null">type,</if>
  54. <if test="equipmentStates != null">equipment_states,</if>
  55. <if test="standbyPosition != null">standby_position,</if>
  56. <if test="attendedTime != null">attended_time,</if>
  57. <if test="remarks != null">remarks,</if>
  58. <if test="isonduty != null">isonduty,</if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="unitName != null">#{unitName},</if>
  62. <if test="unitId != null">#{unitId},</if>
  63. <if test="equipmentName != null">#{equipmentName},</if>
  64. <if test="equipmentId != null">#{equipmentId},</if>
  65. <if test="equipmentNumber != null">#{equipmentNumber},</if>
  66. <if test="type != null">#{type},</if>
  67. <if test="equipmentStates != null">#{equipmentStates},</if>
  68. <if test="standbyPosition != null">#{standbyPosition},</if>
  69. <if test="attendedTime != null">#{attendedTime},</if>
  70. <if test="remarks != null">#{remarks},</if>
  71. <if test="isonduty != null">#{isonduty},</if>
  72. </trim>
  73. </insert>
  74. <update id="updateBdglRegisDuty" parameterType="BdglRegisDuty">
  75. update bdgl_regis_duty
  76. <trim prefix="SET" suffixOverrides=",">
  77. <if test="unitName != null">unit_name = #{unitName},</if>
  78. <if test="unitId != null">unit_id = #{unitId},</if>
  79. <if test="equipmentName != null">equipment_name = #{equipmentName},</if>
  80. <if test="equipmentId != null">equipment_id = #{equipmentId},</if>
  81. <if test="equipmentNumber != null">equipment_number = #{equipmentNumber},</if>
  82. <if test="type != null">type = #{type},</if>
  83. <if test="equipmentStates != null">equipment_states = #{equipmentStates},</if>
  84. <if test="standbyPosition != null">standby_position = #{standbyPosition},</if>
  85. attended_time = #{attendedTime},
  86. <if test="remarks != null">remarks = #{remarks},</if>
  87. <if test="isonduty != null">isonduty = #{isonduty},</if>
  88. </trim>
  89. where id = #{id}
  90. </update>
  91. <select id="selectBdglRegisDutyNumber" parameterType="BdglRegisDuty" resultMap="BdglRegisDutyResult">
  92. SELECT a.type, count(a.type) as typenumber from bdgl_regis_duty a
  93. WHERE 1=1 GROUP BY a.type
  94. </select>
  95. <delete id="deleteBdglRegisDutyById" parameterType="Long">
  96. delete from bdgl_regis_duty where id = #{id}
  97. </delete>
  98. <delete id="deleteBdglRegisDutyByIds" parameterType="String">
  99. delete from bdgl_regis_duty where id in
  100. <foreach item="id" collection="array" open="(" separator="," close=")">
  101. #{id}
  102. </foreach>
  103. </delete>
  104. </mapper>