MaterialAttributeMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.jsh.erp.datasource.mappers.MaterialAttributeMapper">
  4. <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialAttribute">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="attribute_name" jdbcType="VARCHAR" property="attributeName" />
  7. <result column="attribute_value" jdbcType="VARCHAR" property="attributeValue" />
  8. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  9. <result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
  10. </resultMap>
  11. <sql id="Example_Where_Clause">
  12. <where>
  13. <foreach collection="oredCriteria" item="criteria" separator="or">
  14. <if test="criteria.valid">
  15. <trim prefix="(" prefixOverrides="and" suffix=")">
  16. <foreach collection="criteria.criteria" item="criterion">
  17. <choose>
  18. <when test="criterion.noValue">
  19. and ${criterion.condition}
  20. </when>
  21. <when test="criterion.singleValue">
  22. and ${criterion.condition} #{criterion.value}
  23. </when>
  24. <when test="criterion.betweenValue">
  25. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  26. </when>
  27. <when test="criterion.listValue">
  28. and ${criterion.condition}
  29. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  30. #{listItem}
  31. </foreach>
  32. </when>
  33. </choose>
  34. </foreach>
  35. </trim>
  36. </if>
  37. </foreach>
  38. </where>
  39. </sql>
  40. <sql id="Update_By_Example_Where_Clause">
  41. <where>
  42. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  43. <if test="criteria.valid">
  44. <trim prefix="(" prefixOverrides="and" suffix=")">
  45. <foreach collection="criteria.criteria" item="criterion">
  46. <choose>
  47. <when test="criterion.noValue">
  48. and ${criterion.condition}
  49. </when>
  50. <when test="criterion.singleValue">
  51. and ${criterion.condition} #{criterion.value}
  52. </when>
  53. <when test="criterion.betweenValue">
  54. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  55. </when>
  56. <when test="criterion.listValue">
  57. and ${criterion.condition}
  58. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  59. #{listItem}
  60. </foreach>
  61. </when>
  62. </choose>
  63. </foreach>
  64. </trim>
  65. </if>
  66. </foreach>
  67. </where>
  68. </sql>
  69. <sql id="Base_Column_List">
  70. id, attribute_name, attribute_value, tenant_id, delete_flag
  71. </sql>
  72. <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialAttributeExample" resultMap="BaseResultMap">
  73. select
  74. <if test="distinct">
  75. distinct
  76. </if>
  77. <include refid="Base_Column_List" />
  78. from jsh_material_attribute
  79. <if test="_parameter != null">
  80. <include refid="Example_Where_Clause" />
  81. </if>
  82. <if test="orderByClause != null">
  83. order by ${orderByClause}
  84. </if>
  85. </select>
  86. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  87. select
  88. <include refid="Base_Column_List" />
  89. from jsh_material_attribute
  90. where id = #{id,jdbcType=BIGINT}
  91. </select>
  92. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  93. delete from jsh_material_attribute
  94. where id = #{id,jdbcType=BIGINT}
  95. </delete>
  96. <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialAttributeExample">
  97. delete from jsh_material_attribute
  98. <if test="_parameter != null">
  99. <include refid="Example_Where_Clause" />
  100. </if>
  101. </delete>
  102. <insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialAttribute">
  103. insert into jsh_material_attribute (id, attribute_name, attribute_value,
  104. tenant_id, delete_flag)
  105. values (#{id,jdbcType=BIGINT}, #{attributeName,jdbcType=VARCHAR}, #{attributeValue,jdbcType=VARCHAR},
  106. #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
  107. </insert>
  108. <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialAttribute">
  109. insert into jsh_material_attribute
  110. <trim prefix="(" suffix=")" suffixOverrides=",">
  111. <if test="id != null">
  112. id,
  113. </if>
  114. <if test="attributeName != null">
  115. attribute_name,
  116. </if>
  117. <if test="attributeValue != null">
  118. attribute_value,
  119. </if>
  120. <if test="tenantId != null">
  121. tenant_id,
  122. </if>
  123. <if test="deleteFlag != null">
  124. delete_flag,
  125. </if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="id != null">
  129. #{id,jdbcType=BIGINT},
  130. </if>
  131. <if test="attributeName != null">
  132. #{attributeName,jdbcType=VARCHAR},
  133. </if>
  134. <if test="attributeValue != null">
  135. #{attributeValue,jdbcType=VARCHAR},
  136. </if>
  137. <if test="tenantId != null">
  138. #{tenantId,jdbcType=BIGINT},
  139. </if>
  140. <if test="deleteFlag != null">
  141. #{deleteFlag,jdbcType=VARCHAR},
  142. </if>
  143. </trim>
  144. </insert>
  145. <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialAttributeExample" resultType="java.lang.Long">
  146. select count(*) from jsh_material_attribute
  147. <if test="_parameter != null">
  148. <include refid="Example_Where_Clause" />
  149. </if>
  150. </select>
  151. <update id="updateByExampleSelective" parameterType="map">
  152. update jsh_material_attribute
  153. <set>
  154. <if test="record.id != null">
  155. id = #{record.id,jdbcType=BIGINT},
  156. </if>
  157. <if test="record.attributeName != null">
  158. attribute_name = #{record.attributeName,jdbcType=VARCHAR},
  159. </if>
  160. <if test="record.attributeValue != null">
  161. attribute_value = #{record.attributeValue,jdbcType=VARCHAR},
  162. </if>
  163. <if test="record.tenantId != null">
  164. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  165. </if>
  166. <if test="record.deleteFlag != null">
  167. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
  168. </if>
  169. </set>
  170. <if test="_parameter != null">
  171. <include refid="Update_By_Example_Where_Clause" />
  172. </if>
  173. </update>
  174. <update id="updateByExample" parameterType="map">
  175. update jsh_material_attribute
  176. set id = #{record.id,jdbcType=BIGINT},
  177. attribute_name = #{record.attributeName,jdbcType=VARCHAR},
  178. attribute_value = #{record.attributeValue,jdbcType=VARCHAR},
  179. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  180. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
  181. <if test="_parameter != null">
  182. <include refid="Update_By_Example_Where_Clause" />
  183. </if>
  184. </update>
  185. <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.MaterialAttribute">
  186. update jsh_material_attribute
  187. <set>
  188. <if test="attributeName != null">
  189. attribute_name = #{attributeName,jdbcType=VARCHAR},
  190. </if>
  191. <if test="attributeValue != null">
  192. attribute_value = #{attributeValue,jdbcType=VARCHAR},
  193. </if>
  194. <if test="tenantId != null">
  195. tenant_id = #{tenantId,jdbcType=BIGINT},
  196. </if>
  197. <if test="deleteFlag != null">
  198. delete_flag = #{deleteFlag,jdbcType=VARCHAR},
  199. </if>
  200. </set>
  201. where id = #{id,jdbcType=BIGINT}
  202. </update>
  203. <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.MaterialAttribute">
  204. update jsh_material_attribute
  205. set attribute_name = #{attributeName,jdbcType=VARCHAR},
  206. attribute_value = #{attributeValue,jdbcType=VARCHAR},
  207. tenant_id = #{tenantId,jdbcType=BIGINT},
  208. delete_flag = #{deleteFlag,jdbcType=VARCHAR}
  209. where id = #{id,jdbcType=BIGINT}
  210. </update>
  211. </mapper>