GoodsDOMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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.cdu.lys.graduation.repository.dao.GoodsDOMapper" >
  4. <resultMap id="BaseResultMap" type="com.cdu.lys.graduation.repository.entity.GoodsDO" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="goods_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  8. <arg column="description" jdbcType="VARCHAR" javaType="java.lang.String" />
  9. <arg column="ingredients" jdbcType="VARCHAR" javaType="java.lang.String" />
  10. <arg column="weight" jdbcType="VARCHAR" javaType="java.lang.String" />
  11. <arg column="taste" jdbcType="VARCHAR" javaType="java.lang.String" />
  12. <arg column="is_meat" jdbcType="CHAR" javaType="java.lang.String" />
  13. <arg column="price" jdbcType="DOUBLE" javaType="java.lang.Double" />
  14. <arg column="stock" jdbcType="INTEGER" javaType="java.lang.Integer" />
  15. <arg column="sales" jdbcType="INTEGER" javaType="java.lang.Integer" />
  16. <arg column="score" jdbcType="DOUBLE" javaType="java.lang.Double" />
  17. <arg column="cost" jdbcType="DOUBLE" javaType="java.lang.Double" />
  18. <arg column="goods_type" jdbcType="INTEGER" javaType="java.lang.Integer" />
  19. <arg column="create_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  20. <arg column="update_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  21. <arg column="is_delete" jdbcType="CHAR" javaType="java.lang.String" />
  22. </constructor>
  23. </resultMap>
  24. <sql id="Example_Where_Clause" >
  25. <where >
  26. <foreach collection="oredCriteria" item="criteria" separator="or" >
  27. <if test="criteria.valid" >
  28. <trim prefix="(" suffix=")" prefixOverrides="and" >
  29. <foreach collection="criteria.criteria" item="criterion" >
  30. <choose >
  31. <when test="criterion.noValue" >
  32. and ${criterion.condition}
  33. </when>
  34. <when test="criterion.singleValue" >
  35. and ${criterion.condition} #{criterion.value}
  36. </when>
  37. <when test="criterion.betweenValue" >
  38. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  39. </when>
  40. <when test="criterion.listValue" >
  41. and ${criterion.condition}
  42. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  43. #{listItem}
  44. </foreach>
  45. </when>
  46. </choose>
  47. </foreach>
  48. </trim>
  49. </if>
  50. </foreach>
  51. </where>
  52. </sql>
  53. <sql id="Update_By_Example_Where_Clause" >
  54. <where >
  55. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  56. <if test="criteria.valid" >
  57. <trim prefix="(" suffix=")" prefixOverrides="and" >
  58. <foreach collection="criteria.criteria" item="criterion" >
  59. <choose >
  60. <when test="criterion.noValue" >
  61. and ${criterion.condition}
  62. </when>
  63. <when test="criterion.singleValue" >
  64. and ${criterion.condition} #{criterion.value}
  65. </when>
  66. <when test="criterion.betweenValue" >
  67. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  68. </when>
  69. <when test="criterion.listValue" >
  70. and ${criterion.condition}
  71. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  72. #{listItem}
  73. </foreach>
  74. </when>
  75. </choose>
  76. </foreach>
  77. </trim>
  78. </if>
  79. </foreach>
  80. </where>
  81. </sql>
  82. <sql id="Base_Column_List" >
  83. id, goods_name, description, ingredients, weight, taste, is_meat, price, stock, sales,
  84. score, cost, goods_type, create_time, update_time, is_delete
  85. </sql>
  86. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDOExample" >
  87. select
  88. <if test="distinct" >
  89. distinct
  90. </if>
  91. 'true' as QUERYID,
  92. <include refid="Base_Column_List" />
  93. from tb_goods
  94. <if test="_parameter != null" >
  95. <include refid="Example_Where_Clause" />
  96. </if>
  97. <if test="orderByClause != null" >
  98. order by ${orderByClause}
  99. </if>
  100. </select>
  101. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  102. select
  103. <include refid="Base_Column_List" />
  104. from tb_goods
  105. where id = #{id,jdbcType=INTEGER}
  106. </select>
  107. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  108. delete from tb_goods
  109. where id = #{id,jdbcType=INTEGER}
  110. </delete>
  111. <delete id="deleteByExample" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDOExample" >
  112. delete from tb_goods
  113. <if test="_parameter != null" >
  114. <include refid="Example_Where_Clause" />
  115. </if>
  116. </delete>
  117. <insert id="insert" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDO" >
  118. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  119. SELECT LAST_INSERT_ID()
  120. </selectKey>
  121. insert into tb_goods (goods_name, description, ingredients,
  122. weight, taste, is_meat,
  123. price, stock, sales,
  124. score, cost, goods_type,
  125. create_time, update_time, is_delete
  126. )
  127. values (#{goodsName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{ingredients,jdbcType=VARCHAR},
  128. #{weight,jdbcType=VARCHAR}, #{taste,jdbcType=VARCHAR}, #{isMeat,jdbcType=CHAR},
  129. #{price,jdbcType=DOUBLE}, #{stock,jdbcType=INTEGER}, #{sales,jdbcType=INTEGER},
  130. #{score,jdbcType=DOUBLE}, #{cost,jdbcType=DOUBLE}, #{goodsType,jdbcType=INTEGER},
  131. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=CHAR}
  132. )
  133. </insert>
  134. <insert id="insertSelective" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDO" >
  135. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  136. SELECT LAST_INSERT_ID()
  137. </selectKey>
  138. insert into tb_goods
  139. <trim prefix="(" suffix=")" suffixOverrides="," >
  140. <if test="goodsName != null" >
  141. goods_name,
  142. </if>
  143. <if test="description != null" >
  144. description,
  145. </if>
  146. <if test="ingredients != null" >
  147. ingredients,
  148. </if>
  149. <if test="weight != null" >
  150. weight,
  151. </if>
  152. <if test="taste != null" >
  153. taste,
  154. </if>
  155. <if test="isMeat != null" >
  156. is_meat,
  157. </if>
  158. <if test="price != null" >
  159. price,
  160. </if>
  161. <if test="stock != null" >
  162. stock,
  163. </if>
  164. <if test="sales != null" >
  165. sales,
  166. </if>
  167. <if test="score != null" >
  168. score,
  169. </if>
  170. <if test="cost != null" >
  171. cost,
  172. </if>
  173. <if test="goodsType != null" >
  174. goods_type,
  175. </if>
  176. <if test="createTime != null" >
  177. create_time,
  178. </if>
  179. <if test="updateTime != null" >
  180. update_time,
  181. </if>
  182. <if test="isDelete != null" >
  183. is_delete,
  184. </if>
  185. </trim>
  186. <trim prefix="values (" suffix=")" suffixOverrides="," >
  187. <if test="goodsName != null" >
  188. #{goodsName,jdbcType=VARCHAR},
  189. </if>
  190. <if test="description != null" >
  191. #{description,jdbcType=VARCHAR},
  192. </if>
  193. <if test="ingredients != null" >
  194. #{ingredients,jdbcType=VARCHAR},
  195. </if>
  196. <if test="weight != null" >
  197. #{weight,jdbcType=VARCHAR},
  198. </if>
  199. <if test="taste != null" >
  200. #{taste,jdbcType=VARCHAR},
  201. </if>
  202. <if test="isMeat != null" >
  203. #{isMeat,jdbcType=CHAR},
  204. </if>
  205. <if test="price != null" >
  206. #{price,jdbcType=DOUBLE},
  207. </if>
  208. <if test="stock != null" >
  209. #{stock,jdbcType=INTEGER},
  210. </if>
  211. <if test="sales != null" >
  212. #{sales,jdbcType=INTEGER},
  213. </if>
  214. <if test="score != null" >
  215. #{score,jdbcType=DOUBLE},
  216. </if>
  217. <if test="cost != null" >
  218. #{cost,jdbcType=DOUBLE},
  219. </if>
  220. <if test="goodsType != null" >
  221. #{goodsType,jdbcType=INTEGER},
  222. </if>
  223. <if test="createTime != null" >
  224. #{createTime,jdbcType=TIMESTAMP},
  225. </if>
  226. <if test="updateTime != null" >
  227. #{updateTime,jdbcType=TIMESTAMP},
  228. </if>
  229. <if test="isDelete != null" >
  230. #{isDelete,jdbcType=CHAR},
  231. </if>
  232. </trim>
  233. </insert>
  234. <select id="countByExample" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDOExample" resultType="java.lang.Integer" >
  235. select count(*) from tb_goods
  236. <if test="_parameter != null" >
  237. <include refid="Example_Where_Clause" />
  238. </if>
  239. </select>
  240. <update id="updateByExampleSelective" parameterType="map" >
  241. update tb_goods
  242. <set >
  243. <if test="record.id != null" >
  244. id = #{record.id,jdbcType=INTEGER},
  245. </if>
  246. <if test="record.goodsName != null" >
  247. goods_name = #{record.goodsName,jdbcType=VARCHAR},
  248. </if>
  249. <if test="record.description != null" >
  250. description = #{record.description,jdbcType=VARCHAR},
  251. </if>
  252. <if test="record.ingredients != null" >
  253. ingredients = #{record.ingredients,jdbcType=VARCHAR},
  254. </if>
  255. <if test="record.weight != null" >
  256. weight = #{record.weight,jdbcType=VARCHAR},
  257. </if>
  258. <if test="record.taste != null" >
  259. taste = #{record.taste,jdbcType=VARCHAR},
  260. </if>
  261. <if test="record.isMeat != null" >
  262. is_meat = #{record.isMeat,jdbcType=CHAR},
  263. </if>
  264. <if test="record.price != null" >
  265. price = #{record.price,jdbcType=DOUBLE},
  266. </if>
  267. <if test="record.stock != null" >
  268. stock = #{record.stock,jdbcType=INTEGER},
  269. </if>
  270. <if test="record.sales != null" >
  271. sales = #{record.sales,jdbcType=INTEGER},
  272. </if>
  273. <if test="record.score != null" >
  274. score = #{record.score,jdbcType=DOUBLE},
  275. </if>
  276. <if test="record.cost != null" >
  277. cost = #{record.cost,jdbcType=DOUBLE},
  278. </if>
  279. <if test="record.goodsType != null" >
  280. goods_type = #{record.goodsType,jdbcType=INTEGER},
  281. </if>
  282. <if test="record.createTime != null" >
  283. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  284. </if>
  285. <if test="record.updateTime != null" >
  286. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  287. </if>
  288. <if test="record.isDelete != null" >
  289. is_delete = #{record.isDelete,jdbcType=CHAR},
  290. </if>
  291. </set>
  292. <if test="_parameter != null" >
  293. <include refid="Update_By_Example_Where_Clause" />
  294. </if>
  295. </update>
  296. <update id="updateByExample" parameterType="map" >
  297. update tb_goods
  298. set id = #{record.id,jdbcType=INTEGER},
  299. goods_name = #{record.goodsName,jdbcType=VARCHAR},
  300. description = #{record.description,jdbcType=VARCHAR},
  301. ingredients = #{record.ingredients,jdbcType=VARCHAR},
  302. weight = #{record.weight,jdbcType=VARCHAR},
  303. taste = #{record.taste,jdbcType=VARCHAR},
  304. is_meat = #{record.isMeat,jdbcType=CHAR},
  305. price = #{record.price,jdbcType=DOUBLE},
  306. stock = #{record.stock,jdbcType=INTEGER},
  307. sales = #{record.sales,jdbcType=INTEGER},
  308. score = #{record.score,jdbcType=DOUBLE},
  309. cost = #{record.cost,jdbcType=DOUBLE},
  310. goods_type = #{record.goodsType,jdbcType=INTEGER},
  311. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  312. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  313. is_delete = #{record.isDelete,jdbcType=CHAR}
  314. <if test="_parameter != null" >
  315. <include refid="Update_By_Example_Where_Clause" />
  316. </if>
  317. </update>
  318. <update id="updateByPrimaryKeySelective" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDO" >
  319. update tb_goods
  320. <set >
  321. <if test="goodsName != null" >
  322. goods_name = #{goodsName,jdbcType=VARCHAR},
  323. </if>
  324. <if test="description != null" >
  325. description = #{description,jdbcType=VARCHAR},
  326. </if>
  327. <if test="ingredients != null" >
  328. ingredients = #{ingredients,jdbcType=VARCHAR},
  329. </if>
  330. <if test="weight != null" >
  331. weight = #{weight,jdbcType=VARCHAR},
  332. </if>
  333. <if test="taste != null" >
  334. taste = #{taste,jdbcType=VARCHAR},
  335. </if>
  336. <if test="isMeat != null" >
  337. is_meat = #{isMeat,jdbcType=CHAR},
  338. </if>
  339. <if test="price != null" >
  340. price = #{price,jdbcType=DOUBLE},
  341. </if>
  342. <if test="stock != null" >
  343. stock = #{stock,jdbcType=INTEGER},
  344. </if>
  345. <if test="sales != null" >
  346. sales = #{sales,jdbcType=INTEGER},
  347. </if>
  348. <if test="score != null" >
  349. score = #{score,jdbcType=DOUBLE},
  350. </if>
  351. <if test="cost != null" >
  352. cost = #{cost,jdbcType=DOUBLE},
  353. </if>
  354. <if test="goodsType != null" >
  355. goods_type = #{goodsType,jdbcType=INTEGER},
  356. </if>
  357. <if test="createTime != null" >
  358. create_time = #{createTime,jdbcType=TIMESTAMP},
  359. </if>
  360. <if test="updateTime != null" >
  361. update_time = #{updateTime,jdbcType=TIMESTAMP},
  362. </if>
  363. <if test="isDelete != null" >
  364. is_delete = #{isDelete,jdbcType=CHAR},
  365. </if>
  366. </set>
  367. where id = #{id,jdbcType=INTEGER}
  368. </update>
  369. <update id="updateByPrimaryKey" parameterType="com.cdu.lys.graduation.repository.entity.GoodsDO" >
  370. update tb_goods
  371. set goods_name = #{goodsName,jdbcType=VARCHAR},
  372. description = #{description,jdbcType=VARCHAR},
  373. ingredients = #{ingredients,jdbcType=VARCHAR},
  374. weight = #{weight,jdbcType=VARCHAR},
  375. taste = #{taste,jdbcType=VARCHAR},
  376. is_meat = #{isMeat,jdbcType=CHAR},
  377. price = #{price,jdbcType=DOUBLE},
  378. stock = #{stock,jdbcType=INTEGER},
  379. sales = #{sales,jdbcType=INTEGER},
  380. score = #{score,jdbcType=DOUBLE},
  381. cost = #{cost,jdbcType=DOUBLE},
  382. goods_type = #{goodsType,jdbcType=INTEGER},
  383. create_time = #{createTime,jdbcType=TIMESTAMP},
  384. update_time = #{updateTime,jdbcType=TIMESTAMP},
  385. is_delete = #{isDelete,jdbcType=CHAR}
  386. where id = #{id,jdbcType=INTEGER}
  387. </update>
  388. </mapper>