MaterialRegistrationMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.supervision.materialManagement.mapper.MaterialRegistrationMapper">
  6. <resultMap type="MaterialRegistration" id="MaterialRegistrationResult">
  7. <result property="id" column="id" />
  8. <result property="barcode" column="barcode" />
  9. <result property="wuPinType" column="wu_pin_type" />
  10. <result property="name" column="name" />
  11. <result property="materialSpecification" column="material_specification" />
  12. <result property="materialXh" column="material_xh" />
  13. <result property="yingJuType" column="ying_ju_type" />
  14. <result property="responsibilityUnit" column="responsibility_unit" />
  15. <result property="personLiable" column="person_liable" />
  16. <result property="putInt" column="put_int" />
  17. <result property="createName" column="create_name" />
  18. <result property="createTime" column="create_time" />
  19. <result property="storageTime" column="storage_time" />
  20. <result property="inboundNo" column="inbound_no" />
  21. <result property="storageLocation" column="storage_location" />
  22. <result property="buyingTime" column="buying_time" />
  23. <result property="price" column="price" />
  24. <result property="remark" column="remark" />
  25. <result property="warehouse" column="warehouse" />
  26. <result property="archivesId" column="archives_id" />
  27. <result property="unitId" column="unit_id" />
  28. <result property="total" column="total" />
  29. </resultMap>
  30. <sql id="selectMaterialRegistrationVo">
  31. select id,barcode, wu_pin_type, name, material_specification, material_xh, ying_ju_type, responsibility_unit, person_liable, put_int, create_name, create_time, storage_time, inbound_no, storage_location, buying_time, price, remark, warehouse, archives_id,unit_id,total from material_registration
  32. </sql>
  33. <select id="selectMaterialRegistrationList" parameterType="MaterialRegistration" resultMap="MaterialRegistrationResult">
  34. <include refid="selectMaterialRegistrationVo"/>
  35. <where>
  36. <if test="wuPinType != null and wuPinType != ''"> and wu_pin_type = #{wuPinType}</if>
  37. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  38. <if test="materialSpecification != null and materialSpecification != ''"> and material_specification = #{materialSpecification}</if>
  39. <if test="materialXh != null and materialXh != ''"> and material_xh = #{materialXh}</if>
  40. <if test="yingJuType != null and yingJuType != ''"> and ying_ju_type = #{yingJuType}</if>
  41. <if test="responsibilityUnit != null and responsibilityUnit != ''"> and responsibility_unit = #{responsibilityUnit}</if>
  42. <if test="personLiable != null and personLiable != ''"> and person_liable = #{personLiable}</if>
  43. <if test="putInt != null "> and put_int = #{putInt}</if>
  44. <if test="createName != null and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
  45. <if test="storageTime != null "> and storage_time = #{storageTime}</if>
  46. <if test="inboundNo != null and inboundNo != ''"> and inbound_no = #{inboundNo}</if>
  47. <if test="storageLocation != null and storageLocation != ''"> and storage_location = #{storageLocation}</if>
  48. <if test="buyingTime != null "> and buying_time = #{buyingTime}</if>
  49. <if test="price != null "> and price = #{price}</if>
  50. <if test="warehouse != null and warehouse != ''"> and warehouse = #{warehouse}</if>
  51. <if test="archivesId != null "> and archives_id = #{archivesId}</if>
  52. <if test="unitId != null "> and unit_id = #{unitId}</if>
  53. <if test="total != null "> and total = #{total}</if>
  54. </where>
  55. order by id desc
  56. </select>
  57. <select id="selectMaterialRegistrationById" parameterType="Long" resultMap="MaterialRegistrationResult">
  58. <include refid="selectMaterialRegistrationVo"/>
  59. where id = #{id}
  60. </select>
  61. <select id="selectMaterialRegistrationByBarCode" resultMap="MaterialRegistrationResult">
  62. select id,price from material_registration where barcode = #{barcode}
  63. </select>
  64. <insert id="insertMaterialRegistration" parameterType="MaterialRegistration">
  65. insert into material_registration
  66. <trim prefix="(" suffix=")" suffixOverrides=",">
  67. <if test="id != null">id,</if>
  68. <if test="barcode != null">barcode,</if>
  69. <if test="wuPinType != null">wu_pin_type,</if>
  70. <if test="name != null">name,</if>
  71. <if test="materialSpecification != null">material_specification,</if>
  72. <if test="materialXh != null">material_xh,</if>
  73. <if test="yingJuType != null">ying_ju_type,</if>
  74. <if test="responsibilityUnit != null">responsibility_unit,</if>
  75. <if test="personLiable != null">person_liable,</if>
  76. <if test="putInt != null">put_int,</if>
  77. <if test="createName != null">create_name,</if>
  78. <if test="createTime != null">create_time,</if>
  79. <if test="storageTime != null">storage_time,</if>
  80. <if test="inboundNo != null">inbound_no,</if>
  81. <if test="storageLocation != null">storage_location,</if>
  82. <if test="buyingTime != null">buying_time,</if>
  83. <if test="price != null">price,</if>
  84. <if test="remark != null">remark,</if>
  85. <if test="warehouse != null">warehouse,</if>
  86. <if test="archivesId != null">archives_id,</if>
  87. <if test="unitId != null">unit_id,</if>
  88. <if test="total != null">total,</if>
  89. </trim>
  90. <trim prefix="values (" suffix=")" suffixOverrides=",">
  91. <if test="id != null">#{id},</if>
  92. <if test="barcode != null">#{barcode},</if>
  93. <if test="wuPinType != null">#{wuPinType},</if>
  94. <if test="name != null">#{name},</if>
  95. <if test="materialSpecification != null">#{materialSpecification},</if>
  96. <if test="materialXh != null">#{materialXh},</if>
  97. <if test="yingJuType != null">#{yingJuType},</if>
  98. <if test="responsibilityUnit != null">#{responsibilityUnit},</if>
  99. <if test="personLiable != null">#{personLiable},</if>
  100. <if test="putInt != null">#{putInt},</if>
  101. <if test="createName != null">#{createName},</if>
  102. <if test="createTime != null">#{createTime},</if>
  103. <if test="storageTime != null">#{storageTime},</if>
  104. <if test="inboundNo != null">#{inboundNo},</if>
  105. <if test="storageLocation != null">#{storageLocation},</if>
  106. <if test="buyingTime != null">#{buyingTime},</if>
  107. <if test="price != null">#{price},</if>
  108. <if test="remark != null">#{remark},</if>
  109. <if test="warehouse != null">#{warehouse},</if>
  110. <if test="archivesId != null">#{archivesId},</if>
  111. <if test="unitId != null">#{unitId},</if>
  112. <if test="total != null">#{total},</if>
  113. </trim>
  114. </insert>
  115. <update id="updateMaterialRegistration" parameterType="MaterialRegistration">
  116. update material_registration
  117. <trim prefix="SET" suffixOverrides=",">
  118. <if test="wuPinType != null">wu_pin_type = #{wuPinType},</if>
  119. <if test="name != null">name = #{name},</if>
  120. <if test="materialSpecification != null">material_specification = #{materialSpecification},</if>
  121. <if test="materialXh != null">material_xh = #{materialXh},</if>
  122. <if test="yingJuType != null">ying_ju_type = #{yingJuType},</if>
  123. <if test="responsibilityUnit != null">responsibility_unit = #{responsibilityUnit},</if>
  124. <if test="personLiable != null">person_liable = #{personLiable},</if>
  125. <if test="putInt != null">put_int = #{putInt},</if>
  126. <if test="createName != null">create_name = #{createName},</if>
  127. <if test="createTime != null">create_time = #{createTime},</if>
  128. <if test="storageTime != null">storage_time = #{storageTime},</if>
  129. <if test="inboundNo != null">inbound_no = #{inboundNo},</if>
  130. <if test="storageLocation != null">storage_location = #{storageLocation},</if>
  131. <if test="buyingTime != null">buying_time = #{buyingTime},</if>
  132. <if test="price != null">price = #{price},</if>
  133. <if test="remark != null">remark = #{remark},</if>
  134. <if test="warehouse != null">warehouse = #{warehouse},</if>
  135. <if test="archivesId != null">archives_id = #{archivesId},</if>
  136. <if test="unitId != null">unit_id = #{unitId},</if>
  137. <if test="total != null">total = #{total},</if>
  138. </trim>
  139. where id = #{id}
  140. </update>
  141. <delete id="deleteMaterialRegistrationById" parameterType="Long">
  142. delete from material_registration where id = #{id}
  143. </delete>
  144. <delete id="deleteMaterialRegistrationByIds" parameterType="String">
  145. delete from material_registration where id in
  146. <foreach item="id" collection="array" open="(" separator="," close=")">
  147. #{id}
  148. </foreach>
  149. </delete>
  150. </mapper>