BdglRepairMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.BdglRepairMapper">
  6. <resultMap type="BdglRepair" id="BdglRepairResult">
  7. <result property="id" column="id" />
  8. <result property="contacts" column="contacts" />
  9. <result property="contactInformation" column="contact_information" />
  10. <result property="addressUnit" column="address_unit" />
  11. <result property="repairType" column="repair_type" />
  12. <result property="description" column="description" />
  13. <result property="state" column="state" />
  14. </resultMap>
  15. <sql id="selectBdglRepairVo">
  16. select id, contacts, contact_information, address_unit, repair_type, description, state from bdgl_repair
  17. </sql>
  18. <select id="selectBdglRepairList" parameterType="BdglRepair" resultMap="BdglRepairResult">
  19. <include refid="selectBdglRepairVo"/>
  20. <where>
  21. <if test="contacts != null and contacts != ''"> and contacts = #{contacts}</if>
  22. <if test="contactInformation != null and contactInformation != ''"> and contact_information = #{contactInformation}</if>
  23. <if test="addressUnit != null and addressUnit != ''"> and address_unit = #{addressUnit}</if>
  24. <if test="repairType != null "> and repair_type = #{repairType}</if>
  25. <if test="description != null and description != ''"> and description = #{description}</if>
  26. <if test="state != null "> and state = #{state}</if>
  27. </where>
  28. </select>
  29. <select id="selectBdglRepairById" parameterType="Long" resultMap="BdglRepairResult">
  30. <include refid="selectBdglRepairVo"/>
  31. where id = #{id}
  32. </select>
  33. <insert id="insertBdglRepair" parameterType="BdglRepair" useGeneratedKeys="true" keyProperty="id">
  34. insert into bdgl_repair
  35. <trim prefix="(" suffix=")" suffixOverrides=",">
  36. <if test="contacts != null">contacts,</if>
  37. <if test="contactInformation != null">contact_information,</if>
  38. <if test="addressUnit != null">address_unit,</if>
  39. <if test="repairType != null">repair_type,</if>
  40. <if test="description != null">description,</if>
  41. <if test="state != null">state,</if>
  42. </trim>
  43. <trim prefix="values (" suffix=")" suffixOverrides=",">
  44. <if test="contacts != null">#{contacts},</if>
  45. <if test="contactInformation != null">#{contactInformation},</if>
  46. <if test="addressUnit != null">#{addressUnit},</if>
  47. <if test="repairType != null">#{repairType},</if>
  48. <if test="description != null">#{description},</if>
  49. <if test="state != null">#{state},</if>
  50. </trim>
  51. </insert>
  52. <update id="updateBdglRepair" parameterType="BdglRepair">
  53. update bdgl_repair
  54. <trim prefix="SET" suffixOverrides=",">
  55. <if test="contacts != null">contacts = #{contacts},</if>
  56. <if test="contactInformation != null">contact_information = #{contactInformation},</if>
  57. <if test="addressUnit != null">address_unit = #{addressUnit},</if>
  58. <if test="repairType != null">repair_type = #{repairType},</if>
  59. <if test="description != null">description = #{description},</if>
  60. <if test="state != null">state = #{state},</if>
  61. </trim>
  62. where id = #{id}
  63. </update>
  64. <delete id="deleteBdglRepairById" parameterType="Long">
  65. delete from bdgl_repair where id = #{id}
  66. </delete>
  67. <delete id="deleteBdglRepairByIds" parameterType="String">
  68. delete from bdgl_repair where id in
  69. <foreach item="id" collection="array" open="(" separator="," close=")">
  70. #{id}
  71. </foreach>
  72. </delete>
  73. </mapper>