综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcMaterialBuyMapper.xml 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.ruoyi.oa.mapper.CmcMaterialBuyMapper">
  6. <resultMap type="CmcMaterialBuy" id="CmcMaterialBuyResult">
  7. <result property="buyId" column="buy_id" />
  8. <result property="materialId" column="material_id" />
  9. <result property="buyTime" column="buy_time" />
  10. <result property="place" column="place" />
  11. <result property="totalNum" column="total_num" />
  12. <result property="price" column="price" />
  13. <result property="amount" column="amount" />
  14. <result property="buyer" column="buyer" />
  15. <result property="remark" column="remark" />
  16. <association property="buyUser" javaType="SysUser" resultMap="SysUserResult" />
  17. <association property="material" javaType="CmcMaterial" resultMap="CmcMaterialResult" />
  18. </resultMap>
  19. <resultMap type="SysUser" id="SysUserResult">
  20. <result property="userId" column="user_id" />
  21. <result property="nickName" column="buy_nick_name" />
  22. </resultMap>
  23. <resultMap type="CmcMaterial" id="CmcMaterialResult">
  24. <result property="materialId" column="material_id" />
  25. <result property="name" column="name" />
  26. <result property="series" column="series" />
  27. <result property="brand" column="brand" />
  28. </resultMap>
  29. <sql id="selectCmcMaterialBuyVo">
  30. select mb.buy_id, mb.material_id, mb.buy_time, mb.place, mb.total_num, mb.price, mb.amount, mb.buyer, mb.remark, u.nick_name as buy_nick_name, m.brand, m.name, m.series from cmc_material_buy as mb
  31. left join sys_user as u on u.user_id = mb.buyer
  32. left join cmc_material as m on m.material_id = mb.material_id
  33. </sql>
  34. <select id="selectCmcMaterialBuyList" parameterType="CmcMaterialBuy" resultMap="CmcMaterialBuyResult">
  35. <include refid="selectCmcMaterialBuyVo"/>
  36. <where>
  37. <if test="materialId != null "> and mb.material_id = #{materialId}</if>
  38. <if test="buyTime != null "> and mb.buy_time = #{buyTime}</if>
  39. <if test="place != null and place != ''"> and mb.place = #{place}</if>
  40. <if test="totalNum != null "> and mb.total_num = #{totalNum}</if>
  41. <if test="price != null "> and mb.price = #{price}</if>
  42. <if test="amount != null "> and mb.amount = #{amount}</if>
  43. <if test="buyer != null "> and mb.buyer = #{buyer}</if>
  44. </where>
  45. order by mb.buy_time desc
  46. </select>
  47. <select id="selectCmcMaterialBuyByBuyId" parameterType="Integer" resultMap="CmcMaterialBuyResult">
  48. <include refid="selectCmcMaterialBuyVo"/>
  49. where mb.buy_id = #{buyId}
  50. </select>
  51. <insert id="insertCmcMaterialBuy" parameterType="CmcMaterialBuy" useGeneratedKeys="true" keyProperty="buyId">
  52. insert into cmc_material_buy
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="materialId != null">material_id,</if>
  55. <if test="buyTime != null">buy_time,</if>
  56. <if test="place != null">place,</if>
  57. <if test="totalNum != null">total_num,</if>
  58. <if test="price != null">price,</if>
  59. <if test="amount != null">amount,</if>
  60. <if test="buyer != null">buyer,</if>
  61. <if test="remark != null">remark,</if>
  62. </trim>
  63. <trim prefix="values (" suffix=")" suffixOverrides=",">
  64. <if test="materialId != null">#{materialId},</if>
  65. <if test="buyTime != null">#{buyTime},</if>
  66. <if test="place != null">#{place},</if>
  67. <if test="totalNum != null">#{totalNum},</if>
  68. <if test="price != null">#{price},</if>
  69. <if test="amount != null">#{amount},</if>
  70. <if test="buyer != null">#{buyer},</if>
  71. <if test="remark != null">#{remark},</if>
  72. </trim>
  73. </insert>
  74. <update id="updateCmcMaterialBuy" parameterType="CmcMaterialBuy">
  75. update cmc_material_buy
  76. <trim prefix="SET" suffixOverrides=",">
  77. <if test="materialId != null">material_id = #{materialId},</if>
  78. <if test="buyTime != null">buy_time = #{buyTime},</if>
  79. <if test="place != null">place = #{place},</if>
  80. <if test="totalNum != null">total_num = #{totalNum},</if>
  81. <if test="price != null">price = #{price},</if>
  82. <if test="amount != null">amount = #{amount},</if>
  83. <if test="buyer != null">buyer = #{buyer},</if>
  84. <if test="remark != null">remark = #{remark},</if>
  85. </trim>
  86. where buy_id = #{buyId}
  87. </update>
  88. <delete id="deleteCmcMaterialBuyByBuyId" parameterType="Integer">
  89. delete from cmc_material_buy where buy_id = #{buyId}
  90. </delete>
  91. <delete id="deleteCmcMaterialBuyByBuyIds" parameterType="String">
  92. delete from cmc_material_buy where buy_id in
  93. <foreach item="buyId" collection="array" open="(" separator="," close=")">
  94. #{buyId}
  95. </foreach>
  96. </delete>
  97. </mapper>