AirPartInfoMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.kgraph.web.mapper.AirPartInfoMapper">
  6. <resultMap type="AirPartInfo" id="AirPartInfoResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="modelComponentId" column="model_component_id" />
  10. <result property="modelNumber" column="model_number" />
  11. <result property="airModelId" column="air_model_id" />
  12. <result property="airNumber" column="air_number" />
  13. <result property="serial" column="serial" />
  14. <result property="productionDate" column="production_date" />
  15. <result property="manufacturerInfo" column="manufacturer_info" />
  16. <result property="version" column="version" />
  17. <result property="createBy" column="create_by" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. </resultMap>
  22. <sql id="selectAirPartInfoVo">
  23. SELECT
  24. api.id,
  25. api.`name`,
  26. api.model_component_id,
  27. api.model_number,
  28. api.air_model_id,
  29. ami.air_number,
  30. api.serial,
  31. api.production_date,
  32. api.manufacturer_info,
  33. api.version,
  34. api.create_by,
  35. api.create_time,
  36. api.update_by,
  37. api.update_time
  38. FROM
  39. t_air_part_info api
  40. LEFT JOIN t_air_model_info ami ON api.air_model_id = ami.id
  41. </sql>
  42. <select id="selectAirPartInfoList" parameterType="AirPartInfo" resultMap="AirPartInfoResult">
  43. <include refid="selectAirPartInfoVo"/>
  44. <where>
  45. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  46. <if test="modelComponentId != null "> and model_component_id = #{modelComponentId}</if>
  47. <if test="modelNumber != null and modelNumber != ''"> and model_number = #{modelNumber}</if>
  48. <if test="airModelId != null "> and air_model_id = #{airModelId}</if>
  49. <if test="airNumber != null and airNumber != ''"> and air_number = #{airNumber}</if>
  50. <if test="serial != null and serial != ''"> and serial = #{serial}</if>
  51. <if test="productionDate != null "> and production_date = #{productionDate}</if>
  52. <if test="manufacturerInfo != null and manufacturerInfo != ''"> and manufacturer_info = #{manufacturerInfo}</if>
  53. <if test="version != null and version != ''"> and version = #{version}</if>
  54. </where>
  55. </select>
  56. <select id="selectAirPartInfoById" parameterType="Long" resultMap="AirPartInfoResult">
  57. <include refid="selectAirPartInfoVo"/>
  58. where api.id = #{id}
  59. </select>
  60. <insert id="insertAirPartInfo" parameterType="AirPartInfo" useGeneratedKeys="true" keyProperty="id">
  61. insert into t_air_part_info
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="name != null">name,</if>
  64. <if test="modelComponentId != null">model_component_id,</if>
  65. <if test="modelNumber != null">model_number,</if>
  66. <if test="airModelId != null">air_model_id,</if>
  67. <if test="airNumber != null">air_number,</if>
  68. <if test="serial != null">serial,</if>
  69. <if test="productionDate != null">production_date,</if>
  70. <if test="manufacturerInfo != null">manufacturer_info,</if>
  71. <if test="version != null">version,</if>
  72. <if test="createBy != null">create_by,</if>
  73. <if test="createTime != null">create_time,</if>
  74. <if test="updateBy != null">update_by,</if>
  75. <if test="updateTime != null">update_time,</if>
  76. </trim>
  77. <trim prefix="values (" suffix=")" suffixOverrides=",">
  78. <if test="name != null">#{name},</if>
  79. <if test="modelComponentId != null">#{modelComponentId},</if>
  80. <if test="modelNumber != null">#{modelNumber},</if>
  81. <if test="airModelId != null">#{airModelId},</if>
  82. <if test="airNumber != null">#{airNumber},</if>
  83. <if test="serial != null">#{serial},</if>
  84. <if test="productionDate != null">#{productionDate},</if>
  85. <if test="manufacturerInfo != null">#{manufacturerInfo},</if>
  86. <if test="version != null">#{version},</if>
  87. <if test="createBy != null">#{createBy},</if>
  88. <if test="createTime != null">#{createTime},</if>
  89. <if test="updateBy != null">#{updateBy},</if>
  90. <if test="updateTime != null">#{updateTime},</if>
  91. </trim>
  92. </insert>
  93. <update id="updateAirPartInfo" parameterType="AirPartInfo">
  94. update t_air_part_info
  95. <trim prefix="SET" suffixOverrides=",">
  96. <if test="name != null">name = #{name},</if>
  97. <if test="modelComponentId != null">model_component_id = #{modelComponentId},</if>
  98. <if test="modelNumber != null">model_number = #{modelNumber},</if>
  99. <if test="airModelId != null">air_model_id = #{airModelId},</if>
  100. <if test="airNumber != null">air_number = #{airNumber},</if>
  101. <if test="serial != null">serial = #{serial},</if>
  102. <if test="productionDate != null">production_date = #{productionDate},</if>
  103. <if test="manufacturerInfo != null">manufacturer_info = #{manufacturerInfo},</if>
  104. <if test="version != null">version = #{version},</if>
  105. <if test="createBy != null">create_by = #{createBy},</if>
  106. <if test="createTime != null">create_time = #{createTime},</if>
  107. <if test="updateBy != null">update_by = #{updateBy},</if>
  108. <if test="updateTime != null">update_time = #{updateTime},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <delete id="deleteAirPartInfoById" parameterType="Long">
  113. delete from t_air_part_info where id = #{id}
  114. </delete>
  115. <delete id="deleteAirPartInfoByIds" parameterType="String">
  116. delete from t_air_part_info where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. </mapper>