ElePartDao.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.inspur.idm.media.dao.ElePartDao">
  4. <resultMap id="BaseResultMap" type="com.inspur.idm.media.po.part.ElePart">
  5. <id column="part_id" jdbcType="VARCHAR" property="partId" />
  6. <result column="brand_id" jdbcType="VARCHAR" property="brandId" />
  7. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  8. <result column="data_status" jdbcType="INTEGER" property="dataStatus" />
  9. <result column="description" jdbcType="VARCHAR" property="description" />
  10. <result column="manufact_company_id" jdbcType="VARCHAR" property="manufactCompanyId" />
  11. <result column="parent_id" jdbcType="VARCHAR" property="parentId" />
  12. <result column="part_model" jdbcType="VARCHAR" property="partModel" />
  13. <result column="part_name" jdbcType="VARCHAR" property="partName" />
  14. <result column="part_type_id" jdbcType="VARCHAR" property="partTypeId" />
  15. <result column="validity" jdbcType="INTEGER" property="validity" />
  16. <result column="create_company" jdbcType="VARCHAR" property="createCompany" />
  17. </resultMap>
  18. <sql id="Base_Column_List">
  19. part_id, brand_id, create_time, data_status, description, manufact_company_id, parent_id,
  20. part_model, part_name, part_type_id, validity, create_company
  21. </sql>
  22. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  23. select
  24. <include refid="Base_Column_List" />
  25. from `ele_part`
  26. where part_id = #{partId,jdbcType=VARCHAR}
  27. <if test="limitCompany!= null">
  28. and ele_part.create_company = #{limitCompany}
  29. </if>
  30. </select>
  31. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  32. delete from `ele_part`
  33. where part_id = #{partId,jdbcType=VARCHAR}
  34. </delete>
  35. <insert id="insert" parameterType="com.inspur.idm.media.po.part.ElePart">
  36. insert into `ele_part` (part_id, brand_id, create_time,
  37. data_status, description, manufact_company_id,
  38. parent_id, part_model, part_name,
  39. part_type_id, validity)
  40. values (#{partId,jdbcType=VARCHAR}, #{brandId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  41. #{dataStatus,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{manufactCompanyId,jdbcType=VARCHAR},
  42. #{parentId,jdbcType=VARCHAR}, #{partModel,jdbcType=VARCHAR}, #{partName,jdbcType=VARCHAR},
  43. #{partTypeId,jdbcType=VARCHAR}, #{validity,jdbcType=INTEGER})
  44. </insert>
  45. <insert id="insertSelective" parameterType="com.inspur.idm.media.po.part.ElePart">
  46. insert into `ele_part`
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="partId != null">
  49. part_id,
  50. </if>
  51. <if test="brandId != null">
  52. brand_id,
  53. </if>
  54. <if test="createTime != null">
  55. create_time,
  56. </if>
  57. <if test="dataStatus != null">
  58. data_status,
  59. </if>
  60. <if test="description != null">
  61. description,
  62. </if>
  63. <if test="manufactCompanyId != null">
  64. manufact_company_id,
  65. </if>
  66. <if test="parentId != null">
  67. parent_id,
  68. </if>
  69. <if test="partModel != null">
  70. part_model,
  71. </if>
  72. <if test="partName != null">
  73. part_name,
  74. </if>
  75. <if test="partTypeId != null">
  76. part_type_id,
  77. </if>
  78. <if test="validity != null">
  79. validity,
  80. </if>
  81. <if test="createCompany != null">
  82. create_company,
  83. </if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="partId != null">
  87. #{partId,jdbcType=VARCHAR},
  88. </if>
  89. <if test="brandId != null">
  90. #{brandId,jdbcType=VARCHAR},
  91. </if>
  92. <if test="createTime != null">
  93. #{createTime,jdbcType=TIMESTAMP},
  94. </if>
  95. <if test="dataStatus != null">
  96. #{dataStatus,jdbcType=INTEGER},
  97. </if>
  98. <if test="description != null">
  99. #{description,jdbcType=VARCHAR},
  100. </if>
  101. <if test="manufactCompanyId != null">
  102. #{manufactCompanyId,jdbcType=VARCHAR},
  103. </if>
  104. <if test="parentId != null">
  105. #{parentId,jdbcType=VARCHAR},
  106. </if>
  107. <if test="partModel != null">
  108. #{partModel,jdbcType=VARCHAR},
  109. </if>
  110. <if test="partName != null">
  111. #{partName,jdbcType=VARCHAR},
  112. </if>
  113. <if test="partTypeId != null">
  114. #{partTypeId,jdbcType=VARCHAR},
  115. </if>
  116. <if test="validity != null">
  117. #{validity,jdbcType=INTEGER},
  118. </if>
  119. <if test="createCompany != null">
  120. #{createCompany,jdbcType=VARCHAR},
  121. </if>
  122. </trim>
  123. </insert>
  124. <update id="updateByPrimaryKeySelective" parameterType="com.inspur.idm.media.po.part.ElePart">
  125. update `ele_part`
  126. <set>
  127. <if test="brandId != null">
  128. brand_id = #{brandId,jdbcType=VARCHAR},
  129. </if>
  130. <if test="createTime != null">
  131. create_time = #{createTime,jdbcType=TIMESTAMP},
  132. </if>
  133. <if test="dataStatus != null">
  134. data_status = #{dataStatus,jdbcType=INTEGER},
  135. </if>
  136. <if test="description != null">
  137. description = #{description,jdbcType=VARCHAR},
  138. </if>
  139. <if test="manufactCompanyId != null">
  140. manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR},
  141. </if>
  142. <if test="parentId != null">
  143. parent_id = #{parentId,jdbcType=VARCHAR},
  144. </if>
  145. <if test="partModel != null">
  146. part_model = #{partModel,jdbcType=VARCHAR},
  147. </if>
  148. <if test="partName != null">
  149. part_name = #{partName,jdbcType=VARCHAR},
  150. </if>
  151. <if test="partTypeId != null">
  152. part_type_id = #{partTypeId,jdbcType=VARCHAR},
  153. </if>
  154. <if test="validity != null">
  155. validity = #{validity,jdbcType=INTEGER},
  156. </if>
  157. <if test="createCompany != null">
  158. create_company = #{createCompany,jdbcType=VARCHAR},
  159. </if>
  160. </set>
  161. where part_id = #{partId,jdbcType=VARCHAR}
  162. </update>
  163. <update id="updateByPrimaryKey" parameterType="com.inspur.idm.media.po.part.ElePart">
  164. update `ele_part`
  165. set brand_id = #{brandId,jdbcType=VARCHAR},
  166. create_time = #{createTime,jdbcType=TIMESTAMP},
  167. data_status = #{dataStatus,jdbcType=INTEGER},
  168. description = #{description,jdbcType=VARCHAR},
  169. manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR},
  170. parent_id = #{parentId,jdbcType=VARCHAR},
  171. part_model = #{partModel,jdbcType=VARCHAR},
  172. part_name = #{partName,jdbcType=VARCHAR},
  173. part_type_id = #{partTypeId,jdbcType=VARCHAR},
  174. validity = #{validity,jdbcType=INTEGER}
  175. where part_id = #{partId,jdbcType=VARCHAR}
  176. </update>
  177. <select id="selectByQuery" resultType="com.inspur.idm.media.vo.part.ElePartVO">
  178. select a.*, IFNULL(b.part_type_name, '') as part_type_name
  179. from `ele_part` a, `ele_part_type` b
  180. <where>
  181. a.part_type_id = b.part_type_id
  182. <if test="partTypeId!= null">
  183. and a.part_type_id = #{partTypeId,jdbcType=VARCHAR}
  184. </if>
  185. <if test="parentId!= null">
  186. and a.parent_id = #{parentId,jdbcType=VARCHAR}
  187. </if>
  188. <if test="brandId!= null">
  189. and a.brand_id = #{brandId,jdbcType=VARCHAR}
  190. </if>
  191. <if test="querySearch!= null and querySearch != ''">
  192. and a.part_name like concat('%',#{querySearch,jdbcType=VARCHAR},'%')
  193. </if>
  194. <if test="partName!= null">
  195. and a.part_name like concat('%',#{partName,jdbcType=VARCHAR},'%')
  196. </if>
  197. <if test="manufactCompanyId!= null">
  198. and a.manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR}
  199. </if>
  200. <if test="dataStatus!= null">
  201. and a.data_status = #{dataStatus,jdbcType=INTEGER}
  202. </if>
  203. <if test="limitCompany!= null">
  204. and a.create_company = #{limitCompany}
  205. </if>
  206. </where>
  207. <choose>
  208. <when test="orderByClause == 'partTypeAsc'.toString()">
  209. order by b.part_type_name
  210. </when>
  211. <when test="orderByClause == 'partTypeDesc'.toString()">
  212. order by b.part_type_name desc
  213. </when>
  214. <when test="orderByClause == 'validityAsc'.toString()">
  215. order by a.validity
  216. </when>
  217. <when test="orderByClause == 'validityDesc'.toString()">
  218. order by a.validity desc
  219. </when>
  220. <otherwise>
  221. order by a.create_time desc
  222. </otherwise>
  223. </choose>
  224. </select>
  225. </mapper>