BdglTaskdutyMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.BdglTaskdutyMapper">
  6. <resultMap type="BdglTaskduty" id="BdglTaskdutyResult">
  7. <result property="id" column="id" />
  8. <result property="unitName" column="unit_name" />
  9. <result property="unitId" column="unit_id" />
  10. <result property="commanderName" column="commander_name" />
  11. <result property="commanderId" column="commander_id" />
  12. <result property="commanderPhone" column="commander_phone" />
  13. <result property="participantsName" column="participants_name" />
  14. <result property="participantsId" column="participants_id" />
  15. <result property="startTime" column="start_time" />
  16. <result property="endTime" column="end_time" />
  17. <result property="adress" column="adress" />
  18. <result property="question" column="question" />
  19. <result property="remarks" column="remarks" />
  20. </resultMap>
  21. <sql id="selectBdglTaskdutyVo">
  22. select id, unit_name, unit_id, commander_name, commander_id, commander_phone, participants_name, participants_id, start_time, end_time, adress, question, remarks from bdgl_taskduty
  23. </sql>
  24. <select id="selectBdglTaskdutyList" parameterType="BdglTaskduty" resultMap="BdglTaskdutyResult">
  25. <include refid="selectBdglTaskdutyVo"/>
  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="commanderName != null and commanderName != ''"> and commander_name like concat('%', #{commanderName}, '%')</if>
  30. <if test="commanderId != null "> and commander_id = #{commanderId}</if>
  31. <if test="commanderPhone != null and commanderPhone != ''"> and commander_phone = #{commanderPhone}</if>
  32. <if test="participantsName != null and participantsName != ''"> and participants_name like concat('%', #{participantsName}, '%')</if>
  33. <if test="participantsId != null and participantsId != ''"> and participants_id = #{participantsId}</if>
  34. <if test="startTime != null and startTime != ''">
  35. <![CDATA[
  36. start_time<=#{startTime} and end_time>=#{startTime}
  37. ]]>
  38. </if>
  39. <!--and start_time = #{startTime}</if>-->
  40. <!--<if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if>-->
  41. <if test="adress != null and adress != ''"> and adress = #{adress}</if>
  42. <if test="question != null and question != ''"> and question = #{question}</if>
  43. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  44. </where>
  45. order by id desc
  46. </select>
  47. <select id="selectBdglTaskdutyById" parameterType="Long" resultMap="BdglTaskdutyResult">
  48. <include refid="selectBdglTaskdutyVo"/>
  49. where id = #{id}
  50. </select>
  51. <insert id="insertBdglTaskduty" parameterType="BdglTaskduty" useGeneratedKeys="true" keyProperty="id">
  52. insert into bdgl_taskduty
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="id != null">id,</if>
  55. <if test="unitName != null">unit_name,</if>
  56. <if test="unitId != null">unit_id,</if>
  57. <if test="commanderName != null">commander_name,</if>
  58. <if test="commanderId != null">commander_id,</if>
  59. <if test="commanderPhone != null">commander_phone,</if>
  60. <if test="participantsName != null">participants_name,</if>
  61. <if test="participantsId != null">participants_id,</if>
  62. <if test="startTime != null">start_time,</if>
  63. <if test="endTime != null">end_time,</if>
  64. <if test="adress != null">adress,</if>
  65. <if test="question != null">question,</if>
  66. <if test="remarks != null">remarks,</if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="id != null">#{id},</if>
  70. <if test="unitName != null">#{unitName},</if>
  71. <if test="unitId != null">#{unitId},</if>
  72. <if test="commanderName != null">#{commanderName},</if>
  73. <if test="commanderId != null">#{commanderId},</if>
  74. <if test="commanderPhone != null">#{commanderPhone},</if>
  75. <if test="participantsName != null">#{participantsName},</if>
  76. <if test="participantsId != null">#{participantsId},</if>
  77. <if test="startTime != null">#{startTime},</if>
  78. <if test="endTime != null">#{endTime},</if>
  79. <if test="adress != null">#{adress},</if>
  80. <if test="question != null">#{question},</if>
  81. <if test="remarks != null">#{remarks},</if>
  82. </trim>
  83. </insert>
  84. <update id="updateBdglTaskduty" parameterType="BdglTaskduty">
  85. update bdgl_taskduty
  86. <trim prefix="SET" suffixOverrides=",">
  87. <if test="unitName != null">unit_name = #{unitName},</if>
  88. <if test="unitId != null">unit_id = #{unitId},</if>
  89. <if test="commanderName != null">commander_name = #{commanderName},</if>
  90. <if test="commanderId != null">commander_id = #{commanderId},</if>
  91. <if test="commanderPhone != null">commander_phone = #{commanderPhone},</if>
  92. <if test="participantsName != null">participants_name = #{participantsName},</if>
  93. <if test="participantsId != null">participants_id = #{participantsId},</if>
  94. <if test="startTime != null">start_time = #{startTime},</if>
  95. <if test="endTime != null">end_time = #{endTime},</if>
  96. <if test="adress != null">adress = #{adress},</if>
  97. <if test="question != null">question = #{question},</if>
  98. <if test="remarks != null">remarks = #{remarks},</if>
  99. </trim>
  100. where id = #{id}
  101. </update>
  102. <delete id="deleteBdglTaskdutyById" parameterType="Long">
  103. delete from bdgl_taskduty where id = #{id}
  104. </delete>
  105. <delete id="deleteBdglTaskdutyByIds" parameterType="String">
  106. delete from bdgl_taskduty where id in
  107. <foreach item="id" collection="array" open="(" separator="," close=")">
  108. #{id}
  109. </foreach>
  110. </delete>
  111. </mapper>