|
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.gaotao.modules.base.dao.BaseMapper">
<!--查询标签定义的相关信息--> <select id="getLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark, PrintDirection printDirection, ZplCode zplCode, PaperSize paperSize, paper_id paperId, PaperOrientation paperOrientation, Dpi dpi, CanvasWidth canvasWidth, CanvasHeight canvasHeight,rfidFlag, PhysicalWidthMm physicalWidthMm, PhysicalHeightMm physicalHeightMm FROM ReportFileList <where> <if test="labelNo != null and labelNo != ''"> and ReportID LIKE #{labelNo} </if>
<if test="labelType != null and labelType != ''"> and ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and Reportfile LIKE #{labelName} </if> </where> ORDER BY ReportID desc </select>
<!--查询标签定义的相关信息按照标签的编码--> <select id="getLabelSettingByLabelNo" parameterType="java.lang.String" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark, PrintDirection printDirection, ZplCode zplCode, PaperSize paperSize, paper_id paperId, PaperOrientation paperOrientation, Dpi dpi, CanvasWidth canvasWidth, CanvasHeight canvasHeight,rfidFlag, PhysicalWidthMm physicalWidthMm, PhysicalHeightMm physicalHeightMm FROM ReportFileList <where> AND ReportID = #{labelNo} </where> </select>
<!--插入标签自定义的数据--> <insert id="insertLabelSetting" parameterType="LabelSettingData"> INSERT INTO ReportFileList(ReportID, ReportFamily, Reportfile, ReportType, Remark, PrintDirection, ZplCode,rfidFlag, PaperSize, PaperOrientation, Dpi, CanvasWidth, CanvasHeight, PhysicalWidthMm, PhysicalHeightMm, UpdatedTime,paper_id) VALUES (#{labelNo}, #{labelType}, #{labelName}, #{labelClass}, #{remark}, #{printDirection}, #{zplCode},#{rfidFlag}, #{paperSize}, #{paperOrientation}, #{dpi}, #{canvasWidth}, #{canvasHeight}, #{physicalWidthMm}, #{physicalHeightMm}, GETDATE(),#{paperSize}) </insert>
<!--修改标签自定义的信息--> <update id="updateLabelSetting" parameterType="LabelSettingData"> UPDATE ReportFileList SET ReportFamily = #{labelType}, Reportfile = #{labelName}, ReportType = #{labelClass}, Remark = #{remark}, PrintDirection = #{printDirection}, ZplCode = #{zplCode}, rfidFlag= #{rfidFlag}, PaperSize = #{paperSize}, paper_id = #{paperSize}, PaperOrientation = #{paperOrientation}, Dpi = #{dpi}, CanvasWidth = #{canvasWidth}, CanvasHeight = #{canvasHeight}, PhysicalWidthMm = #{physicalWidthMm}, PhysicalHeightMm = #{physicalHeightMm}, UpdatedTime = GETDATE() <where> AND ReportID = #{labelNo} </where> </update>
<!--删除标签定义的主表信息--> <delete id="deleteLabelSettingByLabelNo" parameterType="java.lang.String"> DELETE FROM ReportFileList <where> AND ReportID = #{labelNo} </where> </delete>
<!--查询标签的默认配置信息--> <select id="getDefaultLabelSettingList" parameterType="DefaultLabelSettingData" resultType="DefaultLabelSettingData"> SELECT rfd.ReportFamily labelType, rfd.ReportID labelNo, rfl.ReportType labelClass, rfl.Reportfile labelName, rfd.Remark remark, rfd.SubReportFlag subLabelFlag, rfd.ParentReportID parentLabelNo FROM ReportFileDefDefault rfd LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ReportID <where> AND rfl.ReportID = rfd.ReportID <if test="labelNo != null and labelNo != ''"> and rfd.ReportID LIKE #{labelNo} </if> <if test="labelType != null and labelType != ''"> and rfd.ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and rfl.Reportfile LIKE #{labelName} </if> </where> ORDER BY rfd.ReportFamily ASC </select>
<!--插入默认标签配置信息--> <insert id="insertDefaultLabelSetting" parameterType="DefaultLabelSettingData"> INSERT INTO ReportFileDefDefault(FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID) VALUES ('*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo}) </insert>
<!--修改默认标签配置信息--> <update id="updateDefaultLabelSetting" parameterType="DefaultLabelSettingData"> UPDATE ReportFileDefDefault SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark = #{remark} <where> AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*' </where> </update>
<!--删除默认标签配置信息--> <delete id="deleteDefaultLabelSetting" parameterType="DefaultLabelSettingData"> DELETE FROM ReportFileDefDefault <where> AND ReportID = #{labelNo} AND ReportFamily = #{labelType} AND FamilyID = '*' </where> </delete>
<!--查询父标签信息--> <select id="getParentLabelInfo" parameterType="java.lang.String" resultType="java.util.Map"> SELECT rfd.ParentReportID as parentLabelNo, rfl.Reportfile as parentLabelName, rfl.ReportFamily as parentLabelType FROM ReportFileDefDefault rfd LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfd.ParentReportID <where> AND rfd.ReportID = #{labelNo} AND rfd.FamilyID = '*' AND rfd.ParentReportID IS NOT NULL AND rfd.ParentReportID != '' </where> </select>
<select id="getParentSerialElements" parameterType="java.lang.String" resultType="java.util.Map"> SELECT * FROM report_label_list rfd <where> AND rfd.report_id = #{labelNo} AND rfd.type = 'serialNumber' </where> </select>
<!--查询标签的客制化配置信息--> <select id="getCustomerLabelSettingList" parameterType="CustomerLabelSettingData" resultType="CustomerLabelSettingData"> SELECT rfc.ReportFamily labelType, rfc.CustomerID customerId, dbo.Get_CustomerDesc(rfc.Site, rfc.CustomerID) customerDesc, rfc.ReportID labelNo, rfl.Reportfile labelName, rfl.ReportType labelClass, rfc.Site site, rfc.Remark remark, rfc.SubReportFlag subLabelFlag, rfc.ParentReportID parentLabelNo FROM ReportFileDefCustomer rfc LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfc.ReportID AND rfl.ReportFamily = rfc.ReportFamily <where> AND rfl.ReportID = rfc.ReportID <if test="customerId != null and customerId != ''"> and rfc.CustomerID LIKE #{customerId} </if> <if test="labelNo != null and labelNo != ''"> and rfc.ReportID LIKE #{labelNo} </if> <if test="labelType != null and labelType != ''"> and rfc.ReportFamily LIKE #{labelType} </if> <if test="labelName != null and labelName != ''"> and rfl.Reportfile LIKE #{labelName} </if> </where> ORDER BY rfc.CustomerID ASC </select>
<!--插入客制化标签配置信息--> <insert id="insertCustomerLabelSetting" parameterType="CustomerLabelSettingData"> INSERT INTO ReportFileDefCustomer(Site, CustomerID, FamilyID, ReportFamily, ReportID, Remark, SubReportFlag, ParentReportID) VALUES (#{site}, #{customerId}, '*', #{labelType}, #{labelNo}, #{remark}, #{subLabelFlag}, #{parentLabelNo}) </insert>
<!--修改客制化标签配置信息--> <update id="updateCustomerLabelSetting" parameterType="CustomerLabelSettingData"> UPDATE ReportFileDefCustomer SET SubReportFlag = #{subLabelFlag}, ParentReportID = #{parentLabelNo}, Remark = #{remark} <where> AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*' </where> </update>
<!--删除客制化标签配置信息--> <delete id="deleteCustomerLabelSetting" parameterType="CustomerLabelSettingData"> DELETE FROM ReportFileDefCustomer <where> AND ReportID = #{labelNo} AND CustomerID = #{customerId} AND FamilyID = '*' </where> </delete>
<!--查询标签的客制化配置信息--> <select id="getUserLabelPrinters" parameterType="UserLabelPrinterData" resultType="UserLabelPrinterData"> SELECT rfp.UserID userId, ssu.user_display userDisplay, rfp.ReportID labelNo, rfl.Reportfile labelName, rfl.ReportType labelClass, rfp.NewPrinterName printerName, rfp.IPAddress ipAddress FROM ReportFileList_UserPrinter rfp LEFT JOIN sys_user ssu ON ssu.username = rfp.UserID LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfp.ReportID <where> AND rfl.ReportID = rfp.ReportID <if test="userId != null and userId != ''"> and rfp.UserID LIKE CONCAT('%', #{userId}, '%') </if> <if test="labelNo != null and labelNo != ''"> and rfp.ReportID LIKE CONCAT('%', #{labelNo}, '%') </if> <if test="labelName != null and labelName != ''"> and rfp.IPAddress LIKE CONCAT('%', #{labelName}, '%') </if> <if test="printerName != null and printerName != ''"> and rfp.NewPrinterName LIKE #{printerName} </if> </where> ORDER BY rfp.ReportID ASC </select>
<!--按照userId 查询用户的信息--> <select id="getSysUserDataByUserId" parameterType="UserLabelPrinterData" resultType="SysUserData"> SELECT user_id, username, password, salt, email, mobile, status, create_user_id, create_time, language_default, site, user_display FROM sys_user <where> AND username = #{userId} </where> </select>
<!--插入用户的标签打印机参数--> <insert id="insertUserLabelPrinter" parameterType="UserLabelPrinterData"> INSERT INTO ReportFileList_UserPrinter(ReportID, UserID, PrinterName, IPAddress, NewPrinterName) VALUES (#{labelNo}, #{userId}, '', #{ipAddress}, #{printerName}) </insert>
<!--修改用户的标签打印机参数--> <update id="updateUserLabelPrinter" parameterType="UserLabelPrinterData"> UPDATE ReportFileList_UserPrinter SET IPAddress = #{ipAddress}, NewPrinterName = #{printerName} <where> AND ReportID = #{labelNo} AND UserID = #{userId} </where> </update>
<!--删除用户标签的打印机的信息--> <delete id="deleteUserLabelPrinter" parameterType="UserLabelPrinterData"> DELETE FROM ReportFileList_UserPrinter <where> AND ReportID = #{labelNo} AND UserID = #{userId} </where> </delete>
<!--获取标签打印参数配置信息--> <select id="getLabelParameterList" parameterType="LabelParameterData" resultType="LabelParameterData"> SELECT ReportID labelNo, ItemNo itemNo, ShowSeqNo showSeqNo, ParameterDesc parameterDesc, ParameterName parameterName, ValueType_DB valueTypeDb, ValueType valueType, OptionValue optionValue, DefaultValue defaultValue FROM ReportParameters <where> AND ReportID = #{labelNo} </where> ORDER BY ItemNo </select>
<!--插入标签的打印参数--> <insert id="insertLabelPrintParameter" parameterType="LabelParameterData"> INSERT INTO ReportParameters(ReportID, ItemNo, ShowSeqNo, ParameterDesc, ParameterName, ValueType_DB, ValueType, OptionValue, DefaultValue) VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{parameterDesc}, #{parameterName}, #{valueTypeDb}, #{valueType}, #{optionValue}, #{defaultValue}) </insert>
<!--修改标签打印参数的信息--> <update id="updateLabelPrintParameter" parameterType="LabelParameterData"> UPDATE ReportParameters SET OptionValue = #{optionValue}, DefaultValue = #{defaultValue}, ShowSeqNo = #{showSeqNo} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </update>
<!--删除标签打印参数的信息--> <delete id="deleteLabelPrintParameter" parameterType="LabelParameterData"> DELETE FROM ReportParameters <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </delete>
<!--查询标签内容定义列表--> <select id="getLabelContentList" parameterType="LabelContentData" resultType="LabelContentData"> SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup, DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue, ReportID labelNo FROM ReportContentItem <where> AND ReportID = #{labelNo} </where> ORDER BY ItemNo </select>
<!--插入标签内容定义--> <insert id="insertLabelContent" parameterType="LabelContentData"> INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval]) VALUES (#{labelNo}, #{itemNo}, #{showSeqNo}, #{itemDesc}, #{objectName}, #{objectGroup}, #{dbFieldName}, #{sequenceNoFlag}, #{sequenceBits}, #{intervalValue}) </insert>
<!--插入标签内容定义规则--> <insert id="insertLabelContentRule" parameterType="LabelContentData"> INSERT INTO ReportContentItem_SeqRule(ReportID, ItemNo, SeqNo, ObjectName) VALUES (#{labelNo}, #{itemNo}, #{seqNo}, #{objectName}) </insert>
<!--修改标签的打印参数--> <update id="updateLabelContent" parameterType="LabelContentData"> UPDATE ReportContentItem SET ShowSeqNo = #{showSeqNo}, ObjectName = #{objectName}, ObjectGroup = #{objectGroup}, DBFieldName = #{dbFieldName}, SequenceNoflag = #{sequenceNoFlag}, SequenceBits = #{sequenceBits}, [Interval] = #{intervalValue}, ItemDesc = #{itemDesc} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </update>
<!--删除标签打印参数的信息--> <delete id="deleteLabelContent" parameterType="LabelContentData"> DELETE FROM ReportContentItem <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> </delete>
<!--查询可以复制的标签内容定义--> <select id="getCopyLabelSettingList" parameterType="LabelSettingData" resultType="LabelSettingData"> SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark, PrintDirection printDirection,ZplCode zplCode FROM ReportFileList <where> AND ReportID != #{labelNo} AND ReportFamily = #{labelType} AND ReportType = #{labelClass} </where> ORDER BY ReportID ASC </select>
<!--首先删除原标签内容定义--> <delete id="deleteLabelAllContentsByLabelNo" parameterType="LabelSettingData"> DELETE FROM ReportContentItem <where> AND ReportID = #{labelNo} </where> </delete>
<delete id="deleteLabelAllContentRulesByLabelNo" parameterType="LabelSettingData"> DELETE FROM ReportContentItem_SeqRule <where> AND ReportID = #{labelNo} </where> </delete>
<!--复制其他标签的标签内容定义--> <insert id="copyLabelAllContentsWithOther" parameterType="LabelSettingData"> INSERT INTO ReportContentItem(ReportID, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval]) SELECT #{labelNo}, ItemNo, ShowSeqNo, ItemDesc, ObjectName, ObjectGroup, DBFieldName, SequenceNoflag, SequenceBits, [Interval] FROM ReportContentItem WHERE ReportID = #{newLabelNo} </insert>
<!--获取要用的标签内容--> <select id="getUsedLabelContent" parameterType="LabelContentData" resultType="LabelContentData"> SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup, DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue, ReportID labelNo FROM ReportContentItem <where> AND ReportID = #{labelNo} AND ItemNo != #{itemNo} </where> ORDER BY ItemNo </select>
<!--获取要用的标签内容--> <select id="getLabelContent" parameterType="LabelContentData" resultType="LabelContentData"> SELECT ItemNo itemNo, ShowSeqNo showSeqNo, ItemDesc itemDesc, ObjectName objectName, ObjectGroup objectGroup, DBFieldName dbFieldName, SequenceNoflag sequenceNoFlag, SequenceBits sequenceBits, [Interval] intervalValue, ReportID labelNo FROM ReportContentItem <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} </where> ORDER BY ItemNo </select>
<!--获取标签内容的流水号规则--> <select id="getLabelContentSerialRule" parameterType="LabelContentData" resultType="LabelContentSerialRuleData"> SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.SeqNo seqNo, rcs.ObjectName objectName FROM ReportContentItem_SeqRule rcs <where> AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo} </where> ORDER BY rcs.SeqNo </select>
<!--删除标签内容的流水号规则--> <delete id="deleteLabelContentSerialRule" parameterType="LabelContentSerialRuleData"> DELETE FROM ReportContentItem_SeqRule <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND SeqNo = #{seqNo} </where> </delete>
<!--获取标签内容的流水号信息--> <select id="getLabelSerialInfos" parameterType="LabelContentData" resultType="LabelContentSerialInfoData"> SELECT rcs.ReportID labelNo, rcs.ItemNo itemNo, rcs.KeyInfo keyInfo, rcs.LastSeqNo lastSeqNo FROM ReportFile_SeqInfo rcs <where> AND rcs.ReportID = #{labelNo} AND rcs.ItemNo = #{itemNo} </where> </select>
<!--插入标签流水号信息--> <insert id="insertLabelSerialInfo" parameterType="LabelContentSerialInfoData"> INSERT INTO ReportFile_SeqInfo(ReportID, ItemNo, KeyInfo, LastSeqNo) VALUES (#{labelNo}, #{itemNo}, #{keyInfo}, #{lastSeqNo}) </insert>
<!--修改标签流水号信息--> <update id="updateLabelSerialInfo" parameterType="LabelContentSerialInfoData"> UPDATE ReportFile_SeqInfo SET KeyInfo = #{keyInfo}, LastSeqNo = #{lastSeqNo} <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{oriKeyInfo} </where> </update>
<!--删除标签流水号信息--> <delete id="deleteLabelSerialInfo" parameterType="LabelContentSerialRuleData"> DELETE FROM ReportFile_SeqInfo <where> AND ReportID = #{labelNo} AND ItemNo = #{itemNo} AND KeyInfo = #{keyInfo} </where> </delete>
<!-- 获取标签类型列表 --> <select id="getLabelTypeList" resultType="java.util.Map"> SELECT name as label, name as value, view_sql as viewSql, ifs_view_sql as ifsViewSql FROM report_family_list <where> <if test="labelType != null and labelType != ''"> name = #{labelType} </if> </where> </select>
<!-- 根据ReportId获取ReportFamily信息 --> <select id="getReportFileByReportId" parameterType="java.lang.String" resultType="ReportFileList"> SELECT ReportID as reportId, ReportFamily as reportFamily FROM ReportFileList WHERE ReportID = #{reportId} </select>
<!-- 根据ReportFamily获取视图SQL名称 --> <select id="getReportFamilyByName" resultType="ReportFamilyList"> SELECT name, view_sql as viewSql, ifs_view_sql as ifsViewSql FROM report_family_list WHERE name = #{name} </select>
<!-- 执行视图查询获取数据 --> <select id="getViewData" resultType="java.util.Map"> SELECT * FROM ${viewSql} <where> <if test="params != null"> <!-- 动态生成查询条件 --> <if test="params.site != null and params.site != ''"> AND site = #{params.site} </if> <if test="params.receiptNo != null and params.receiptNo != ''"> AND receipt_no = #{params.receiptNo} </if> <if test="params.warehouseId != null and params.warehouseId != ''"> AND warehouse_id = #{params.warehouseId} </if> <if test="params.partNo != null and params.partNo != ''"> AND part_no = #{params.partNo} </if> <if test="params.batchNo != null and params.batchNo != ''"> AND batch_no = #{params.batchNo} </if> <if test="params.locationId != null and params.locationId != ''"> AND location_id = #{params.locationId} </if> <if test="params.wdr != null and params.wdr != ''"> AND wdr = #{params.wdr} </if> <if test="params.unitIds != null and params.unitIds.size > 0"> AND unit_id IN <foreach collection="params.unitIds" item="unitId" open="(" separator="," close=")"> #{unitId} </foreach> </if> <!-- 可以根据需要添加更多参数 --> </if> </where> </select>
<update id="saveFullSerialNumber" parameterType="ReportLabelList"> UPDATE report_label_list SET full_serial_number = #{fullSerialNumber} <where> AND report_id = #{reportId} AND label_no = #{labelNo} AND type = 'serialNumber' </where> </update>
<!-- 保存WMS标签记录 --> <insert id="saveWmsLabel" parameterType="WmsLabel"> INSERT INTO wms_label ( site, serial_no, part_no, qty, in_stock_flag, label_type, batch_no, warehouse_id, location_id, remark, tid, epc ) VALUES ( #{site}, #{serialNo}, #{partNo}, #{qty}, #{inStockFlag}, #{labelType}, #{batchNo}, #{warehouseId}, #{locationId}, #{remark}, #{tid}, #{epc} ) </insert>
<select id="getReportLabelListByLabelNo" parameterType="java.lang.String" resultType="ReportLabelList"> SELECT * FROM report_label_list <where> AND label_no = #{labelNo} </where> </select>
<select id="getReportLabelListByReportId" parameterType="java.lang.String" resultType="ReportLabelList"> SELECT * FROM report_label_list <where> AND report_id = #{labelNo} </where> </select>
<select id="getSysParamValue" resultType="java.lang.String"> select value from sys_param where site =#{site} and group_code=#{groupCode} and code=#{code} </select>
</mapper>
|