ftmsorderbillsplansMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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.orderPlan.mapper.FtmsorderbillsplansMapper">
  6. <resultMap type="ftmsorderbillsplans" id="ftmsorderbillsplansResult">
  7. <result property="id" column="id"/>
  8. <result property="pId" column="p_id"/>
  9. <result property="orgId" column="org_id"/>
  10. <result property="cntrId" column="cntr_id"/>
  11. <result property="cntrQty" column="cntr_qty"/>
  12. <result property="carQty" column="car_qty"/>
  13. <result property="planCntrQty" column="plan_cntr_qty"/>
  14. <result property="carcorPid" column="carcor_pid"/>
  15. <result property="pricecrType" column="pricecr_type"/>
  16. <result property="pricecr" column="pricecr"/>
  17. <result property="ifNeedInvCr" column="if_need_inv_cr"/>
  18. <result property="carnolist" column="carnolist"/>
  19. <result property="planDate" column="plan_date"/>
  20. <result property="planreMarks" column="planre_marks"/>
  21. <result property="acceptDate" column="accept_date"/>
  22. <result property="acceptRemarks" column="accept_remarks"/>
  23. <result property="billStatus" column="bill_status"/>
  24. <result property="delFlag" column="del_flag"/>
  25. <result property="createBy" column="create_by"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="remarks" column="remarks"/>
  30. </resultMap>
  31. <sql id="selectftmsorderbillsplansVo">
  32. select id, p_id, org_id, cntr_id, cntr_qty, car_qty, plan_cntr_qty, carcor_pid, pricecr_type, pricecr, if_need_inv_cr, carnolist, plan_date, planre_marks, accept_date, accept_remarks, bill_status, del_flag, create_by, create_time, update_by, update_time, remarks from F_TMSORDERBILLSPLANS
  33. </sql>
  34. <select id="selectftmsorderbillsplansList" parameterType="ftmsorderbillsplans"
  35. resultMap="ftmsorderbillsplansResult">
  36. <include refid="selectftmsorderbillsplansVo"/>
  37. <where>
  38. <if test="pId != null ">and p_id = #{pId}</if>
  39. <if test="orgId != null ">and org_id = #{orgId}</if>
  40. <if test="cntrId != null ">and cntr_id = #{cntrId}</if>
  41. <if test="cntrQty != null ">and cntr_qty = #{cntrQty}</if>
  42. <if test="carQty != null ">and car_qty = #{carQty}</if>
  43. <if test="carQty != null ">and plan_cntr_qty = #{planCntrQty}</if>
  44. <if test="carcorPid != null ">and carcor_pid = #{carcorPid}</if>
  45. <if test="pricecrType != null and pricecrType != ''">and pricecr_type = #{pricecrType}</if>
  46. <if test="pricecr != null ">and pricecr = #{pricecr}</if>
  47. <if test="ifNeedInvCr != null and ifNeedInvCr != ''">and if_need_inv_cr = #{ifNeedInvCr}</if>
  48. <if test="carnolist != null and carnolist != ''">and carnolist = #{carnolist}</if>
  49. <if test="planDate != null ">and plan_date = #{planDate}</if>
  50. <if test="planreMarks != null and planreMarks != ''">and planre_marks = #{planreMarks}</if>
  51. <if test="acceptDate != null ">and accept_date = #{acceptDate}</if>
  52. <if test="acceptRemarks != null and acceptRemarks != ''">and accept_remarks = #{acceptRemarks}</if>
  53. <if test="billStatus != null ">and bill_status = #{billStatus}</if>
  54. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  55. </where>
  56. </select>
  57. <select id="selectftmsorderbillsplansMapList" parameterType="ftmsorderbills" resultType="Map">
  58. SELECT
  59. plan.id,
  60. plan.carnolist,
  61. plan.car_qty AS carQty,
  62. plan.cntr_qty AS cntrQty,
  63. f.bill_no AS billNo,
  64. f.act_id AS actId,
  65. c.f_name AS corpId,
  66. sysCntr.dict_label AS cntrName,
  67. p.nick_name AS planUserId,
  68. a.nick_name AS transUserId,
  69. type.dict_label AS billType,
  70. trans.dict_label AS transType,
  71. prop.dict_label AS transProp,
  72. f.if_contracted AS ifContracted,
  73. f.contract_no AS contractNo,
  74. f.accstl_type AS accstlType,
  75. f.accdays,
  76. m.f_name AS carcorPid,
  77. f.load_addr AS loadAddr,
  78. f.md_load_addr AS mdLoadAddr,
  79. f.un_load_addr AS unLoadAddr,
  80. g.f_name AS goodsId,
  81. f.goods_price AS goodsPrice,
  82. f.mblno,
  83. f.load_date AS loadDate,
  84. f.qty_plan AS qtyPlan,
  85. f.qty_dis_patch AS qtyDisPatch,
  86. f.weight_plan AS weightPlan,
  87. plan.bill_status AS billStatus,
  88. f.create_time AS createTime
  89. FROM
  90. F_TMSORDERBILLSPLANS plan
  91. LEFT JOIN F_TMSORDERBILLS f ON f.id = plan.org_id
  92. LEFT JOIN sys_dict_data sysCntr ON sysCntr.dict_type = 'data_cntrId'
  93. AND sysCntr.dict_value = plan.cntr_id
  94. LEFT JOIN sys_dict_data type ON type.dict_type = 'data_billType'
  95. AND type.dict_value = f.bill_type
  96. LEFT JOIN sys_dict_data trans ON trans.dict_type = 'data_transType'
  97. AND trans.dict_value = f.trans_type
  98. LEFT JOIN sys_dict_data prop ON prop.dict_type = 'data_transProp'
  99. AND prop.dict_value = f.trans_prop
  100. LEFT JOIN t_corps m ON m.f_id = plan.carcor_pid
  101. AND m.f_typeid = '["4"]'
  102. LEFT JOIN t_corps c ON c.f_id = f.corp_id
  103. LEFT JOIN sys_user p ON p.user_id = f.plan_user_id
  104. LEFT JOIN sys_user a ON a.user_id = f.trans_user_id
  105. LEFT JOIN t_goods g ON g.f_id = f.goods_id
  106. WHERE
  107. plan.bill_status >= 6
  108. <if test="corpId != null and corpId != ''">
  109. AND f.corp_id = #{corpId}
  110. </if>
  111. <if test="actId != null and actId != 0">
  112. AND f.act_id = #{actId}
  113. </if>
  114. <if test="billType != null and billType != ''">
  115. AND f.bill_type = #{billType}
  116. </if>
  117. <if test="transType != null and transType != ''">
  118. AND f.trans_type = #{transType}
  119. </if>
  120. <if test="transProp != null and transProp != ''">
  121. AND f.trans_prop = #{transProp}
  122. </if>
  123. <if test="goodsId != null and goodsId != 0">
  124. AND f.goods_id = #{goodsId}
  125. </if>
  126. <if test="mblno != null and mblno != ''">
  127. AND f.mblno LIKE "%${mblno}%"
  128. </if>
  129. <if test="loadAddr != null and loadAddr != ''">
  130. AND f.load_addr LIKE "%${loadAddr}%"
  131. </if>
  132. <if test="mdLoadAddr != null and mdLoadAddr != ''">
  133. AND f.md_load_addr LIKE "%${mdLoadAddr}%"
  134. </if>
  135. <if test="unLoadAddr != null and unLoadAddr != ''">
  136. AND f.un_load_addr LIKE "%${unLoadAddr}%"
  137. </if>
  138. <if test="billStatus != null and billStatus != ''">
  139. AND f.bill_status LIKE "%${billStatus}%"
  140. </if>
  141. ORDER BY plan.id desc
  142. </select>
  143. <select id="selectftmsorderbillsplansCountList" parameterType="ftmsorderbillsplans" resultType="int">
  144. select count(id) from F_TMSORDERBILLSPLANS
  145. <where>
  146. <if test="pId != null ">and p_id = #{pId}</if>
  147. <if test="orgId != null ">and org_id = #{orgId}</if>
  148. <if test="cntrId != null ">and cntr_id = #{cntrId}</if>
  149. <if test="cntrQty != null ">and cntr_qty = #{cntrQty}</if>
  150. <if test="carQty != null ">and car_qty = #{carQty}</if>
  151. <if test="carQty != null ">and plan_cntr_qty = #{planCntrQty}</if>
  152. <if test="carcorPid != null ">and carcor_pid = #{carcorPid}</if>
  153. <if test="pricecrType != null and pricecrType != ''">and pricecr_type = #{pricecrType}</if>
  154. <if test="pricecr != null ">and pricecr = #{pricecr}</if>
  155. <if test="ifNeedInvCr != null and ifNeedInvCr != ''">and if_need_inv_cr = #{ifNeedInvCr}</if>
  156. <if test="carnolist != null and carnolist != ''">and carnolist = #{carnolist}</if>
  157. <if test="planDate != null ">and plan_date = #{planDate}</if>
  158. <if test="planreMarks != null and planreMarks != ''">and planre_marks = #{planreMarks}</if>
  159. <if test="acceptDate != null ">and accept_date = #{acceptDate}</if>
  160. <if test="acceptRemarks != null and acceptRemarks != ''">and accept_remarks = #{acceptRemarks}</if>
  161. <if test="billStatus != null ">and bill_status = #{billStatus}</if>
  162. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  163. </where>
  164. </select>
  165. <select id="selectftmsorderbillsplansById" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  166. <include refid="selectftmsorderbillsplansVo"/>
  167. where id = #{id}
  168. </select>
  169. <select id="selectftmsorderbillsplansByPId" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  170. <include refid="selectftmsorderbillsplansVo"/>
  171. where p_id = #{id}
  172. </select>
  173. <select id="selectftmsorderbillsplansByOrgId" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  174. <include refid="selectftmsorderbillsplansVo"/>
  175. where org_id = #{orgId}
  176. </select>
  177. <insert id="insertftmsorderbillsplans" parameterType="ftmsorderbillsplans" useGeneratedKeys="true" keyProperty="id">
  178. insert into F_TMSORDERBILLSPLANS
  179. <trim prefix="(" suffix=")" suffixOverrides=",">
  180. <if test="id != null">id,</if>
  181. <if test="pId != null">p_id,</if>
  182. <if test="orgId != null">org_id,</if>
  183. <if test="cntrId != null">cntr_id,</if>
  184. <if test="cntrQty != null">cntr_qty,</if>
  185. <if test="carQty != null">car_qty,</if>
  186. <if test="planCntrQty != null">plan_cntr_qty,</if>
  187. <if test="carcorPid != null">carcor_pid,</if>
  188. <if test="pricecrType != null">pricecr_type,</if>
  189. <if test="pricecr != null">pricecr,</if>
  190. <if test="ifNeedInvCr != null">if_need_inv_cr,</if>
  191. <if test="carnolist != null">carnolist,</if>
  192. <if test="planDate != null">plan_date,</if>
  193. <if test="planreMarks != null">planre_marks,</if>
  194. <if test="acceptDate != null">accept_date,</if>
  195. <if test="acceptRemarks != null">accept_remarks,</if>
  196. <if test="billStatus != null">bill_status,</if>
  197. <if test="delFlag != null">del_flag,</if>
  198. <if test="createBy != null">create_by,</if>
  199. <if test="createTime != null">create_time,</if>
  200. <if test="updateBy != null">update_by,</if>
  201. <if test="updateTime != null">update_time,</if>
  202. <if test="remarks != null">remarks,</if>
  203. </trim>
  204. <trim prefix="values (" suffix=")" suffixOverrides=",">
  205. <if test="id != null">#{id},</if>
  206. <if test="pId != null">#{pId},</if>
  207. <if test="orgId != null">#{orgId},</if>
  208. <if test="cntrId != null">#{cntrId},</if>
  209. <if test="cntrQty != null">#{cntrQty},</if>
  210. <if test="carQty != null">#{carQty},</if>
  211. <if test="planCntrQty != null">#{planCntrQty},</if>
  212. <if test="carcorPid != null">#{carcorPid},</if>
  213. <if test="pricecrType != null">#{pricecrType},</if>
  214. <if test="pricecr != null">#{pricecr},</if>
  215. <if test="ifNeedInvCr != null">#{ifNeedInvCr},</if>
  216. <if test="carnolist != null">#{carnolist},</if>
  217. <if test="planDate != null">#{planDate},</if>
  218. <if test="planreMarks != null">#{planreMarks},</if>
  219. <if test="acceptDate != null">#{acceptDate},</if>
  220. <if test="acceptRemarks != null">#{acceptRemarks},</if>
  221. <if test="billStatus != null">#{billStatus},</if>
  222. <if test="delFlag != null">#{delFlag},</if>
  223. <if test="createBy != null">#{createBy},</if>
  224. <if test="createTime != null">#{createTime},</if>
  225. <if test="updateBy != null">#{updateBy},</if>
  226. <if test="updateTime != null">#{updateTime},</if>
  227. <if test="remarks != null">#{remarks},</if>
  228. </trim>
  229. </insert>
  230. <update id="updateftmsorderbillsplans" parameterType="ftmsorderbillsplans">
  231. update F_TMSORDERBILLSPLANS
  232. <trim prefix="SET" suffixOverrides=",">
  233. <if test="pId != null">p_id = #{pId},</if>
  234. <if test="orgId != null">org_id = #{orgId},</if>
  235. <if test="cntrId != null">cntr_id = #{cntrId},</if>
  236. <if test="cntrQty != null">cntr_qty = #{cntrQty},</if>
  237. <if test="carQty != null">car_qty = #{carQty},</if>
  238. <if test="planCntrQty != null">plan_cntr_qty = #{planCntrQty},</if>
  239. <if test="carcorPid != null">carcor_pid = #{carcorPid},</if>
  240. <if test="pricecrType != null">pricecr_type = #{pricecrType},</if>
  241. <if test="pricecr != null">pricecr = #{pricecr},</if>
  242. <if test="ifNeedInvCr != null">if_need_inv_cr = #{ifNeedInvCr},</if>
  243. <if test="carnolist != null">carnolist = #{carnolist},</if>
  244. <if test="planDate != null">plan_date = #{planDate},</if>
  245. <if test="planreMarks != null">planre_marks = #{planreMarks},</if>
  246. <if test="acceptDate != null">accept_date = #{acceptDate},</if>
  247. <if test="acceptRemarks != null">accept_remarks = #{acceptRemarks},</if>
  248. <if test="billStatus != null">bill_status = #{billStatus},</if>
  249. <if test="delFlag != null">del_flag = #{delFlag},</if>
  250. <if test="createBy != null">create_by = #{createBy},</if>
  251. <if test="createTime != null">create_time = #{createTime},</if>
  252. <if test="updateBy != null">update_by = #{updateBy},</if>
  253. <if test="updateTime != null">update_time = #{updateTime},</if>
  254. <if test="remarks != null">remarks = #{remarks},</if>
  255. </trim>
  256. where id = #{id}
  257. </update>
  258. <update id="updateTmsorderSplanStatusByOrgId" parameterType="ftmsorderbillsplans">
  259. update F_TMSORDERBILLSPLANS
  260. set bill_status = #{billStatus}
  261. where org_id = #{orgId}
  262. </update>
  263. <delete id="deleteftmsorderbillsplansById" parameterType="Long">
  264. delete from F_TMSORDERBILLSPLANS where id = #{id}
  265. </delete>
  266. <delete id="deleteftmsorderbillsplansByPId" parameterType="Long">
  267. delete from F_TMSORDERBILLSPLANS where p_id = #{pId}
  268. </delete>
  269. <delete id="deleteftmsorderbillsplansByOrgId" parameterType="Long">
  270. delete from F_TMSORDERBILLSPLANS where org_id = #{orgId}
  271. </delete>
  272. <delete id="deleteftmsorderbillsplansByIds" parameterType="String">
  273. delete from F_TMSORDERBILLSPLANS where id in
  274. <foreach item="id" collection="array" open="(" separator="," close=")">
  275. #{id}
  276. </foreach>
  277. </delete>
  278. </mapper>