MaterialCirculationMapper.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.zkqy.business.mapper.MaterialCirculationMapper">
  6. <resultMap type="com.zkqy.business.domain.MaterialCirculation" id="MaterialCirculationResult">
  7. <result property="id" column="id" />
  8. <result property="goodsname" column="goodsname" />
  9. <result property="goodsnum" column="goodsnum" />
  10. <result property="specifications" column="specifications" />
  11. <result property="weight" column="weight" />
  12. <result property="receivingProcess" column="receiving_process" />
  13. <result property="approvalStatus" column="approval_status" />
  14. <result property="documentStatus" column="document_status" />
  15. <result property="submitter" column="submitter" />
  16. <result property="approvedBy" column="approved_by" />
  17. <result property="completedBy" column="completed_by" />
  18. <result property="remark" column="remark" />
  19. <result property="createById" column="create_by_id" />
  20. <result property="createBy" column="create_by" />
  21. <result property="createTime" column="create_time" />
  22. <result property="updateById" column="update_by_id" />
  23. <result property="updateBy" column="update_by" />
  24. <result property="updateTime" column="update_time" />
  25. <result property="delFlag" column="del_flag" />
  26. <result property="taskProcessKey" column="task_process_key" />
  27. <result property="taskNodeKey" column="task_node_key" />
  28. </resultMap>
  29. <sql id="selectMaterialCirculationVo">
  30. select id, goodsname, goodsnum, specifications, weight, receiving_process, approval_status, document_status, submitter, approved_by, completed_by, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key from material_circulation
  31. </sql>
  32. <select id="selectMaterialCirculationList" parameterType="com.zkqy.business.domain.MaterialCirculation" resultMap="MaterialCirculationResult">
  33. <include refid="selectMaterialCirculationVo"/>
  34. <where>
  35. <if test="goodsname != null and goodsname != ''"> and goodsname like concat('%', #{goodsname}, '%')</if>
  36. <if test="goodsnum != null and goodsnum != ''"> and goodsnum = #{goodsnum}</if>
  37. <if test="specifications != null and specifications != ''"> and specifications = #{specifications}</if>
  38. <if test="weight != null and weight != ''"> and weight = #{weight}</if>
  39. <if test="receivingProcess != null and receivingProcess != ''"> and receiving_process = #{receivingProcess}</if>
  40. <if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
  41. <if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if>
  42. <if test="submitter != null and submitter != ''"> and submitter = #{submitter}</if>
  43. <if test="approvedBy != null and approvedBy != ''"> and approved_by = #{approvedBy}</if>
  44. <if test="completedBy != null and completedBy != ''"> and completed_by = #{completedBy}</if>
  45. <if test="createById != null "> and create_by_id = #{createById}</if>
  46. <if test="updateById != null "> and update_by_id = #{updateById}</if>
  47. <if test="taskProcessKey != null and taskProcessKey != ''"> and task_process_key = #{taskProcessKey}</if>
  48. <if test="taskNodeKey != null and taskNodeKey != ''"> and task_node_key = #{taskNodeKey}</if>
  49. </where>
  50. order by id desc
  51. </select>
  52. <select id="selectMaterialCirculationById" parameterType="Long" resultMap="MaterialCirculationResult">
  53. <include refid="selectMaterialCirculationVo"/>
  54. where id = #{id}
  55. </select>
  56. <insert id="insertMaterialCirculation" parameterType="com.zkqy.business.domain.MaterialCirculation" useGeneratedKeys="true" keyProperty="id">
  57. insert into material_circulation
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="goodsname != null">goodsname,</if>
  60. <if test="goodsnum != null">goodsnum,</if>
  61. <if test="specifications != null">specifications,</if>
  62. <if test="weight != null">weight,</if>
  63. <if test="receivingProcess != null">receiving_process,</if>
  64. <if test="approvalStatus != null">approval_status,</if>
  65. <if test="documentStatus != null">document_status,</if>
  66. <if test="submitter != null">submitter,</if>
  67. <if test="approvedBy != null">approved_by,</if>
  68. <if test="completedBy != null">completed_by,</if>
  69. <if test="remark != null">remark,</if>
  70. <if test="createById != null">create_by_id,</if>
  71. <if test="createBy != null">create_by,</if>
  72. <if test="createTime != null">create_time,</if>
  73. <if test="updateById != null">update_by_id,</if>
  74. <if test="updateBy != null">update_by,</if>
  75. <if test="updateTime != null">update_time,</if>
  76. <if test="delFlag != null">del_flag,</if>
  77. <if test="taskProcessKey != null">task_process_key,</if>
  78. <if test="taskNodeKey != null">task_node_key,</if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="goodsname != null">#{goodsname},</if>
  82. <if test="goodsnum != null">#{goodsnum},</if>
  83. <if test="specifications != null">#{specifications},</if>
  84. <if test="weight != null">#{weight},</if>
  85. <if test="receivingProcess != null">#{receivingProcess},</if>
  86. <if test="approvalStatus != null">#{approvalStatus},</if>
  87. <if test="documentStatus != null">#{documentStatus},</if>
  88. <if test="submitter != null">#{submitter},</if>
  89. <if test="approvedBy != null">#{approvedBy},</if>
  90. <if test="completedBy != null">#{completedBy},</if>
  91. <if test="remark != null">#{remark},</if>
  92. <if test="createById != null">#{createById},</if>
  93. <if test="createBy != null">#{createBy},</if>
  94. <if test="createTime != null">#{createTime},</if>
  95. <if test="updateById != null">#{updateById},</if>
  96. <if test="updateBy != null">#{updateBy},</if>
  97. <if test="updateTime != null">#{updateTime},</if>
  98. <if test="delFlag != null">#{delFlag},</if>
  99. <if test="taskProcessKey != null">#{taskProcessKey},</if>
  100. <if test="taskNodeKey != null">#{taskNodeKey},</if>
  101. </trim>
  102. </insert>
  103. <update id="updateMaterialCirculation" parameterType="com.zkqy.business.domain.MaterialCirculation">
  104. update material_circulation
  105. <trim prefix="SET" suffixOverrides=",">
  106. <if test="goodsname != null">goodsname = #{goodsname},</if>
  107. <if test="goodsnum != null">goodsnum = #{goodsnum},</if>
  108. <if test="specifications != null">specifications = #{specifications},</if>
  109. <if test="weight != null">weight = #{weight},</if>
  110. <if test="receivingProcess != null">receiving_process = #{receivingProcess},</if>
  111. <if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
  112. <if test="documentStatus != null">document_status = #{documentStatus},</if>
  113. <if test="submitter != null">submitter = #{submitter},</if>
  114. <if test="approvedBy != null">approved_by = #{approvedBy},</if>
  115. <if test="completedBy != null">completed_by = #{completedBy},</if>
  116. <if test="remark != null">remark = #{remark},</if>
  117. <if test="createById != null">create_by_id = #{createById},</if>
  118. <if test="createBy != null">create_by = #{createBy},</if>
  119. <if test="createTime != null">create_time = #{createTime},</if>
  120. <if test="updateById != null">update_by_id = #{updateById},</if>
  121. <if test="updateBy != null">update_by = #{updateBy},</if>
  122. <if test="updateTime != null">update_time = #{updateTime},</if>
  123. <if test="delFlag != null">del_flag = #{delFlag},</if>
  124. <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
  125. <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
  126. </trim>
  127. where id = #{id}
  128. </update>
  129. <delete id="deleteMaterialCirculationById" parameterType="Long">
  130. delete from material_circulation where id = #{id}
  131. </delete>
  132. <delete id="deleteMaterialCirculationByIds" parameterType="String">
  133. delete from material_circulation where id in
  134. <foreach item="id" collection="array" open="(" separator="," close=")">
  135. #{id}
  136. </foreach>
  137. </delete>
  138. <select id="selectHandheldMaterialCirculationList" resultType="com.zkqy.business.domain.MaterialCirculation">
  139. SELECT
  140. mc.id,
  141. m.materiel_name AS goodsname,
  142. mc.goodsnum,
  143. m.specification_model AS specifications,
  144. mc.weight,
  145. mc.receiving_process,
  146. mc.approval_status,
  147. mc.document_status,
  148. mc.submitter,
  149. mc.approved_by,
  150. mc.completed_by,
  151. mc.remark,
  152. mc.create_by_id,
  153. mc.create_by,
  154. mc.create_time,
  155. mc.update_by_id,
  156. mc.update_by,
  157. mc.update_time
  158. FROM
  159. {DBNAME}.material_circulation mc
  160. LEFT JOIN {DBNAME}.materiel m ON mc.goodsnum = m.materiel_code
  161. WHERE
  162. mc.del_flag = '0'
  163. AND mc.approval_status = '2'
  164. AND mc.document_status != '0'
  165. <if test="goodsnum != ''"> and mc.goodsnum = #{goodsnum}</if>
  166. order by mc.id desc
  167. </select>
  168. </mapper>