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.

557 lines
24 KiB

7 months ago
6 months ago
5 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
5 months ago
5 months ago
7 months ago
5 months ago
5 months ago
7 months ago
7 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
7 months ago
5 months ago
7 months ago
6 months ago
7 months ago
5 months ago
7 months ago
7 months ago
5 months ago
5 months ago
4 months ago
7 months ago
  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.gaotao.modules.base.dao.BaseMapper">
  4. <!--查询标签定义的相关信息-->
  5. <select id="getLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData">
  6. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark,
  7. PrintDirection printDirection, ZplCode zplCode, PaperSize paperSize, paper_id paperId, PaperOrientation paperOrientation,
  8. Dpi dpi, CanvasWidth canvasWidth, CanvasHeight canvasHeight,rfidFlag,
  9. PhysicalWidthMm physicalWidthMm, PhysicalHeightMm physicalHeightMm
  10. FROM ReportFileList
  11. <where>
  12. <if test="labelNo != null and labelNo != ''">
  13. and ReportID LIKE #{labelNo}
  14. </if>
  15. <if test="labelType != null and labelType != ''">
  16. and ReportFamily LIKE #{labelType}
  17. </if>
  18. <if test="labelName != null and labelName != ''">
  19. and Reportfile LIKE #{labelName}
  20. </if>
  21. </where>
  22. ORDER BY ReportID desc
  23. </select>
  24. <!--查询标签定义的相关信息按照标签的编码-->
  25. <select id="getLabelSettingByLabelNo" parameterType="java.lang.String" resultType="LabelSettingData">
  26. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark,
  27. PrintDirection printDirection, ZplCode zplCode, PaperSize paperSize, paper_id paperId, PaperOrientation paperOrientation,
  28. Dpi dpi, CanvasWidth canvasWidth, CanvasHeight canvasHeight,rfidFlag,
  29. PhysicalWidthMm physicalWidthMm, PhysicalHeightMm physicalHeightMm
  30. FROM ReportFileList
  31. <where>
  32. AND ReportID = #{labelNo}
  33. </where>
  34. </select>
  35. <!--插入标签自定义的数据-->
  36. <insert id="insertLabelSetting" parameterType="LabelSettingData">
  37. INSERT INTO ReportFileList(ReportID, ReportFamily, Reportfile, ReportType, Remark, PrintDirection, ZplCode,rfidFlag,
  38. PaperSize, PaperOrientation, Dpi, CanvasWidth, CanvasHeight,
  39. PhysicalWidthMm, PhysicalHeightMm, UpdatedTime,paper_id)
  40. VALUES (#{labelNo}, #{labelType}, #{labelName}, #{labelClass}, #{remark}, #{printDirection}, #{zplCode},#{rfidFlag},
  41. #{paperSize}, #{paperOrientation}, #{dpi}, #{canvasWidth}, #{canvasHeight},
  42. #{physicalWidthMm}, #{physicalHeightMm}, GETDATE(),#{paperSize})
  43. </insert>
  44. <!--修改标签自定义的信息-->
  45. <update id="updateLabelSetting" parameterType="LabelSettingData">
  46. UPDATE ReportFileList SET
  47. ReportFamily = #{labelType},
  48. Reportfile = #{labelName},
  49. ReportType = #{labelClass},
  50. Remark = #{remark},
  51. PrintDirection = #{printDirection},
  52. ZplCode = #{zplCode},
  53. rfidFlag= #{rfidFlag},
  54. PaperSize = #{paperSize},
  55. paper_id = #{paperSize},
  56. PaperOrientation = #{paperOrientation},
  57. Dpi = #{dpi},
  58. CanvasWidth = #{canvasWidth},
  59. CanvasHeight = #{canvasHeight},
  60. PhysicalWidthMm = #{physicalWidthMm},
  61. PhysicalHeightMm = #{physicalHeightMm},
  62. UpdatedTime = GETDATE()
  63. <where>
  64. AND ReportID = #{labelNo}
  65. </where>
  66. </update>
  67. <!--删除标签定义的主表信息-->
  68. <delete id="deleteLabelSettingByLabelNo" parameterType="java.lang.String">
  69. DELETE FROM ReportFileList
  70. <where>
  71. AND ReportID = #{labelNo}
  72. </where>
  73. </delete>
  74. <!--查询标签的默认配置信息-->
  75. <select id="getDefaultLabelSettingList" parameterType="DefaultLabelSettingData"
  76. resultType="DefaultLabelSettingData">
  77. SELECT rfd.ReportFamily labelType, rfd.ReportID labelNo, rfl.ReportType labelClass, rfl.Reportfile labelName,
  78. rfd.Remark remark,
  79. rfd.SubReportFlag subLabelFlag, rfd.ParentReportID parentLabelNo FROM ReportFileDefDefault rfd
  80. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ReportID
  81. <where>
  82. AND rfl.ReportID = rfd.ReportID
  83. <if test="labelNo != null and labelNo != ''">
  84. and rfd.ReportID LIKE #{labelNo}
  85. </if>
  86. <if test="labelType != null and labelType != ''">
  87. and rfd.ReportFamily LIKE #{labelType}
  88. </if>
  89. <if test="labelName != null and labelName != ''">
  90. and rfl.Reportfile LIKE #{labelName}
  91. </if>
  92. </where>
  93. ORDER BY rfd.ReportFamily ASC
  94. </select>
  95. <!--插入默认标签配置信息-->
  96. <insert id="insertDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  97. INSERT INTO ReportFileDefDefault(FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID)
  98. VALUES ('*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo})
  99. </insert>
  100. <!--修改默认标签配置信息-->
  101. <update id="updateDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  102. UPDATE ReportFileDefDefault SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark =
  103. #{remark}
  104. <where>
  105. AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*'
  106. </where>
  107. </update>
  108. <!--删除默认标签配置信息-->
  109. <delete id="deleteDefaultLabelSetting" parameterType="DefaultLabelSettingData">
  110. DELETE FROM ReportFileDefDefault
  111. <where>
  112. AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*'
  113. </where>
  114. </delete>
  115. <!--查询父标签信息-->
  116. <select id="getParentLabelInfo" parameterType="java.lang.String" resultType="java.util.Map">
  117. SELECT
  118. rfd.ParentReportID as parentLabelNo,
  119. rfl.Reportfile as parentLabelName,
  120. rfl.ReportFamily as parentLabelType
  121. FROM ReportFileDefDefault rfd
  122. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ParentReportID
  123. <where>
  124. AND rfd.ReportID = #{labelNo}
  125. AND rfd.FamilyID = '*'
  126. AND rfd.ParentReportID IS NOT NULL
  127. AND rfd.ParentReportID != ''
  128. </where>
  129. </select>
  130. <select id="getParentSerialElements" parameterType="java.lang.String" resultType="java.util.Map">
  131. SELECT * FROM report_label_list rfd
  132. <where>
  133. AND rfd.report_id = #{labelNo}
  134. AND rfd.type = 'serialNumber'
  135. </where>
  136. </select>
  137. <!--查询标签的客制化配置信息-->
  138. <select id="getCustomerLabelSettingList" parameterType="CustomerLabelSettingData"
  139. resultType="CustomerLabelSettingData">
  140. SELECT rfc.ReportFamily labelType, rfc.CustomerID customerId, dbo.Get_CustomerDesc(rfc.Site, rfc.CustomerID)
  141. customerDesc, rfc.ReportID labelNo,
  142. rfl.Reportfile labelName, rfl.ReportType labelClass, rfc.Site site, rfc.Remark remark, rfc.SubReportFlag
  143. subLabelFlag, rfc.ParentReportID parentLabelNo
  144. FROM ReportFileDefCustomer rfc
  145. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfc.ReportID AND rfl.ReportFamily = rfc.ReportFamily
  146. <where>
  147. AND rfl.ReportID = rfc.ReportID
  148. <if test="customerId != null and customerId != ''">
  149. and rfc.CustomerID LIKE #{customerId}
  150. </if>
  151. <if test="labelNo != null and labelNo != ''">
  152. and rfc.ReportID LIKE #{labelNo}
  153. </if>
  154. <if test="labelType != null and labelType != ''">
  155. and rfc.ReportFamily LIKE #{labelType}
  156. </if>
  157. <if test="labelName != null and labelName != ''">
  158. and rfl.Reportfile LIKE #{labelName}
  159. </if>
  160. </where>
  161. ORDER BY rfc.CustomerID ASC
  162. </select>
  163. <!--插入客制化标签配置信息-->
  164. <insert id="insertCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  165. INSERT INTO ReportFileDefCustomer(Site, CustomerID, FamilyID, ReportFamily, ReportID, Remark, SubReportFlag,
  166. ParentReportID)
  167. VALUES (#{site}, #{customerId}, '*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo})
  168. </insert>
  169. <!--修改客制化标签配置信息-->
  170. <update id="updateCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  171. UPDATE ReportFileDefCustomer SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark =
  172. #{remark}
  173. <where>
  174. AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*'
  175. </where>
  176. </update>
  177. <!--删除客制化标签配置信息-->
  178. <delete id="deleteCustomerLabelSetting" parameterType="CustomerLabelSettingData">
  179. DELETE FROM ReportFileDefCustomer
  180. <where>
  181. AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*'
  182. </where>
  183. </delete>
  184. <!--查询标签的客制化配置信息-->
  185. <select id="getUserLabelPrinters" parameterType="UserLabelPrinterData" resultType="UserLabelPrinterData">
  186. SELECT rfp.UserID userId, ssu.user_display userDisplay, rfp.ReportID labelNo, rfl.Reportfile labelName,
  187. rfl.ReportType labelClass,
  188. rfp.NewPrinterName printerName, rfp.IPAddress ipAddress
  189. FROM ReportFileList_UserPrinter rfp
  190. LEFT JOIN sys_user ssu ON ssu.username = rfp.UserID
  191. LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfp.ReportID
  192. <where>
  193. AND rfl.ReportID = rfp.ReportID
  194. <if test="userId != null and userId != ''">
  195. and rfp.UserID LIKE CONCAT('%', #{userId}, '%')
  196. </if>
  197. <if test="labelNo != null and labelNo != ''">
  198. and rfp.ReportID LIKE CONCAT('%', #{labelNo}, '%')
  199. </if>
  200. <if test="labelName != null and labelName != ''">
  201. and rfp.IPAddress LIKE CONCAT('%', #{labelName}, '%')
  202. </if>
  203. <if test="printerName != null and printerName != ''">
  204. and rfp.NewPrinterName LIKE #{printerName}
  205. </if>
  206. </where>
  207. ORDER BY rfp.ReportID ASC
  208. </select>
  209. <!--按照userId 查询用户的信息-->
  210. <select id="getSysUserDataByUserId" parameterType="UserLabelPrinterData" resultType="SysUserData">
  211. SELECT user_id, username, password, salt, email, mobile, status, create_user_id,
  212. create_time, language_default, site, user_display FROM sys_user
  213. <where>
  214. AND username = #{userId}
  215. </where>
  216. </select>
  217. <!--插入用户的标签打印机参数-->
  218. <insert id="insertUserLabelPrinter" parameterType="UserLabelPrinterData">
  219. INSERT INTO ReportFileList_UserPrinter(ReportID, UserID, PrinterName, IPAddress, NewPrinterName)
  220. VALUES (#{labelNo}, #{userId}, '', #{ipAddress}, #{printerName})
  221. </insert>
  222. <!--修改用户的标签打印机参数-->
  223. <update id="updateUserLabelPrinter" parameterType="UserLabelPrinterData">
  224. UPDATE ReportFileList_UserPrinter SET IPAddress = #{ipAddress}, NewPrinterName = #{printerName}
  225. <where>
  226. AND ReportID = #{labelNo} AND UserID = #{userId}
  227. </where>
  228. </update>
  229. <!--删除用户标签的打印机的信息-->
  230. <delete id="deleteUserLabelPrinter" parameterType="UserLabelPrinterData">
  231. DELETE FROM ReportFileList_UserPrinter
  232. <where>
  233. AND ReportID = #{labelNo} AND UserID = #{userId}
  234. </where>
  235. </delete>
  236. <!--获取标签打印参数配置信息-->
  237. <select id="getLabelParameterList" parameterType="LabelParameterData" resultType="LabelParameterData">
  238. SELECT ReportID labelNo, ItemNo itemNo, ShowSeqNo showSeqNo, ParameterDesc parameterDesc, ParameterName
  239. parameterName,
  240. ValueType_DB valueTypeDb, ValueType valueType, OptionValue optionValue, DefaultValue defaultValue
  241. FROM ReportParameters
  242. <where>
  243. AND ReportID = #{labelNo}
  244. </where>
  245. ORDER BY ItemNo
  246. </select>
  247. <!--插入标签的打印参数-->
  248. <insert id="insertLabelPrintParameter" parameterType="LabelParameterData">
  249. INSERT INTO ReportParameters(ReportID, ItemNo, ShowSeqNo, ParameterDesc, ParameterName, ValueType_DB,
  250. ValueType, OptionValue, DefaultValue)
  251. VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{parameterDesc}, #{parameterName}, #{valueTypeDb},
  252. #{valueType}, #{optionValue}, #{defaultValue})
  253. </insert>
  254. <!--修改标签打印参数的信息-->
  255. <update id="updateLabelPrintParameter" parameterType="LabelParameterData">
  256. UPDATE ReportParameters SET OptionValue = #{optionValue}, DefaultValue = #{defaultValue}, ShowSeqNo =
  257. #{showSeqNo}
  258. <where>
  259. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  260. </where>
  261. </update>
  262. <!--删除标签打印参数的信息-->
  263. <delete id="deleteLabelPrintParameter" parameterType="LabelParameterData">
  264. DELETE FROM ReportParameters
  265. <where>
  266. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  267. </where>
  268. </delete>
  269. <!--查询标签内容定义列表-->
  270. <select id="getLabelContentList" parameterType="LabelContentData" resultType="LabelContentData">
  271. SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup,
  272. DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue,
  273. ReportID labelNo
  274. FROM ReportContentItem
  275. <where>
  276. AND ReportID = #{labelNo}
  277. </where>
  278. ORDER BY ItemNo
  279. </select>
  280. <!--插入标签内容定义-->
  281. <insert id="insertLabelContent" parameterType="LabelContentData">
  282. INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup,
  283. DBFieldName, SequenceNoflag, SequenceBits, [Interval])
  284. VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{itemDesc}, #{objectName}, #{objectGroup},
  285. #{dbFieldName}, #{sequenceNoFlag}, #{sequenceBits}, #{intervalValue})
  286. </insert>
  287. <!--插入标签内容定义规则-->
  288. <insert id="insertLabelContentRule" parameterType="LabelContentData">
  289. INSERT INTO ReportContentItem_SeqRule(ReportID, ItemNo, SeqNo, ObjectName)
  290. VALUES (#{labelNo}, #{itemNo}, #{seqNo}, #{objectName})
  291. </insert>
  292. <!--修改标签的打印参数-->
  293. <update id="updateLabelContent" parameterType="LabelContentData">
  294. UPDATE ReportContentItem SET ShowSeqNo = #{showSeqNo}, ObjectName = #{objectName}, ObjectGroup = #{objectGroup},
  295. DBFieldName = #{dbFieldName}, SequenceNoflag = #{sequenceNoFlag}, SequenceBits = #{sequenceBits},
  296. [Interval] = #{intervalValue}, ItemDesc = #{itemDesc}
  297. <where>
  298. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  299. </where>
  300. </update>
  301. <!--删除标签打印参数的信息-->
  302. <delete id="deleteLabelContent" parameterType="LabelContentData">
  303. DELETE FROM ReportContentItem
  304. <where>
  305. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  306. </where>
  307. </delete>
  308. <!--查询可以复制的标签内容定义-->
  309. <select id="getCopyLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData">
  310. SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark,
  311. PrintDirection printDirection,ZplCode zplCode
  312. FROM ReportFileList
  313. <where>
  314. AND ReportID != #{labelNo} AND ReportFamily = #{labelType} AND ReportType = #{labelClass}
  315. </where>
  316. ORDER BY ReportID ASC
  317. </select>
  318. <!--首先删除原标签内容定义-->
  319. <delete id="deleteLabelAllContentsByLabelNo" parameterType="LabelSettingData">
  320. DELETE FROM ReportContentItem
  321. <where>
  322. AND ReportID = #{labelNo}
  323. </where>
  324. </delete>
  325. <delete id="deleteLabelAllContentRulesByLabelNo" parameterType="LabelSettingData">
  326. DELETE FROM ReportContentItem_SeqRule
  327. <where>
  328. AND ReportID = #{labelNo}
  329. </where>
  330. </delete>
  331. <!--复制其他标签的标签内容定义-->
  332. <insert id="copyLabelAllContentsWithOther" parameterType="LabelSettingData">
  333. INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup,
  334. DBFieldName, SequenceNoflag, SequenceBits, [Interval])
  335. SELECT #{labelNo},
  336. ItemNo,
  337. ShowSeqNo,
  338. ItemDesc,
  339. ObjectName,
  340. ObjectGroup,
  341. DBFieldName,
  342. SequenceNoflag,
  343. SequenceBits,
  344. [Interval]
  345. FROM ReportContentItem
  346. WHERE ReportID = #{newLabelNo}
  347. </insert>
  348. <!--获取要用的标签内容-->
  349. <select id="getUsedLabelContent" parameterType="LabelContentData" resultType="LabelContentData">
  350. SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup,
  351. DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue,
  352. ReportID labelNo
  353. FROM ReportContentItem
  354. <where>
  355. AND ReportID = #{labelNo} AND ItemNo != #{itemNo}
  356. </where>
  357. ORDER BY ItemNo
  358. </select>
  359. <!--获取要用的标签内容-->
  360. <select id="getLabelContent" parameterType="LabelContentData" resultType="LabelContentData">
  361. SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup,
  362. DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue,
  363. ReportID labelNo
  364. FROM ReportContentItem
  365. <where>
  366. AND ReportID = #{labelNo} AND ItemNo = #{itemNo}
  367. </where>
  368. ORDER BY ItemNo
  369. </select>
  370. <!--获取标签内容的流水号规则-->
  371. <select id="getLabelContentSerialRule" parameterType="LabelContentData" resultType="LabelContentSerialRuleData">
  372. SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.SeqNo seqNo, rcs.ObjectName objectName
  373. FROM ReportContentItem_SeqRule rcs
  374. <where>
  375. AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo}
  376. </where>
  377. ORDER BY rcs.SeqNo
  378. </select>
  379. <!--删除标签内容的流水号规则-->
  380. <delete id="deleteLabelContentSerialRule" parameterType="LabelContentSerialRuleData">
  381. DELETE FROM ReportContentItem_SeqRule
  382. <where>
  383. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND SeqNo = #{seqNo}
  384. </where>
  385. </delete>
  386. <!--获取标签内容的流水号信息-->
  387. <select id="getLabelSerialInfos" parameterType="LabelContentData" resultType="LabelContentSerialInfoData">
  388. SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.KeyInfo keyInfo, rcs.LastSeqNo lastSeqNo
  389. FROM ReportFile_SeqInfo rcs
  390. <where>
  391. AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo}
  392. </where>
  393. </select>
  394. <!--插入标签流水号信息-->
  395. <insert id="insertLabelSerialInfo" parameterType="LabelContentSerialInfoData">
  396. INSERT INTO ReportFile_SeqInfo(ReportID, ItemNo, KeyInfo, LastSeqNo)
  397. VALUES (#{labelNo}, #{itemNo}, #{keyInfo}, #{lastSeqNo})
  398. </insert>
  399. <!--修改标签流水号信息-->
  400. <update id="updateLabelSerialInfo" parameterType="LabelContentSerialInfoData">
  401. UPDATE ReportFile_SeqInfo SET KeyInfo = #{keyInfo}, LastSeqNo = #{lastSeqNo}
  402. <where>
  403. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{oriKeyInfo}
  404. </where>
  405. </update>
  406. <!--删除标签流水号信息-->
  407. <delete id="deleteLabelSerialInfo" parameterType="LabelContentSerialRuleData">
  408. DELETE FROM ReportFile_SeqInfo
  409. <where>
  410. AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{keyInfo}
  411. </where>
  412. </delete>
  413. <!-- 获取标签类型列表 -->
  414. <select id="getLabelTypeList" resultType="java.util.Map">
  415. SELECT name as label, name as value, view_sql as viewSql, ifs_view_sql as ifsViewSql
  416. FROM report_family_list
  417. <where>
  418. <if test="labelType != null and labelType != ''">
  419. name = #{labelType}
  420. </if>
  421. </where>
  422. </select>
  423. <!-- 根据ReportId获取ReportFamily信息 -->
  424. <select id="getReportFileByReportId" parameterType="java.lang.String" resultType="ReportFileList">
  425. SELECT ReportID as reportId, ReportFamily as reportFamily
  426. FROM ReportFileList
  427. WHERE ReportID = #{reportId}
  428. </select>
  429. <!-- 根据ReportFamily获取视图SQL名称 -->
  430. <select id="getReportFamilyByName" resultType="ReportFamilyList">
  431. SELECT name, view_sql as viewSql, ifs_view_sql as ifsViewSql
  432. FROM report_family_list
  433. WHERE name = #{name}
  434. </select>
  435. <!-- 执行视图查询获取数据 -->
  436. <select id="getViewData" resultType="java.util.Map">
  437. SELECT * FROM ${viewSql}
  438. <where>
  439. <if test="params != null">
  440. <!-- 动态生成查询条件 -->
  441. <if test="params.site != null and params.site != ''">
  442. AND site = #{params.site}
  443. </if>
  444. <if test="params.receiptNo != null and params.receiptNo != ''">
  445. AND receipt_no = #{params.receiptNo}
  446. </if>
  447. <if test="params.warehouseId != null and params.warehouseId != ''">
  448. AND warehouse_id = #{params.warehouseId}
  449. </if>
  450. <if test="params.partNo != null and params.partNo != ''">
  451. AND part_no = #{params.partNo}
  452. </if>
  453. <if test="params.batchNo != null and params.batchNo != ''">
  454. AND batch_no = #{params.batchNo}
  455. </if>
  456. <if test="params.locationId != null and params.locationId != ''">
  457. AND location_id = #{params.locationId}
  458. </if>
  459. <if test="params.wdr != null and params.wdr != ''">
  460. AND wdr = #{params.wdr}
  461. </if>
  462. <if test="params.unitIds != null and params.unitIds.size > 0">
  463. AND unit_id IN
  464. <foreach collection="params.unitIds" item="unitId" open="(" separator="," close=")">
  465. #{unitId}
  466. </foreach>
  467. </if>
  468. <!-- 可以根据需要添加更多参数 -->
  469. </if>
  470. </where>
  471. </select>
  472. <update id="saveFullSerialNumber" parameterType="ReportLabelList">
  473. UPDATE report_label_list SET full_serial_number = #{fullSerialNumber}
  474. <where>
  475. AND report_id = #{reportId} AND label_no = #{labelNo} AND type = 'serialNumber'
  476. </where>
  477. </update>
  478. <!-- 保存WMS标签记录 -->
  479. <insert id="saveWmsLabel" parameterType="WmsLabel">
  480. INSERT INTO wms_label (
  481. site, serial_no, part_no, qty, in_stock_flag,
  482. label_type, batch_no, warehouse_id, location_id, remark, tid, epc
  483. ) VALUES (
  484. #{site}, #{serialNo}, #{partNo}, #{qty}, #{inStockFlag},
  485. #{labelType}, #{batchNo}, #{warehouseId}, #{locationId}, #{remark}, #{tid}, #{epc}
  486. )
  487. </insert>
  488. <select id="getReportLabelListByLabelNo" parameterType="java.lang.String" resultType="ReportLabelList">
  489. SELECT * FROM report_label_list
  490. <where>
  491. AND label_no = #{labelNo}
  492. </where>
  493. </select>
  494. <select id="getReportLabelListByReportId" parameterType="java.lang.String" resultType="ReportLabelList">
  495. SELECT * FROM report_label_list
  496. <where>
  497. AND report_id = #{labelNo}
  498. </where>
  499. </select>
  500. <select id="getSysParamValue" resultType="java.lang.String">
  501. select value from sys_param
  502. where site =#{site} and group_code=#{groupCode} and code=#{code}
  503. </select>
  504. </mapper>