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.
 
 
 
 
 
 

383 lines
16 KiB

<?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
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 ASC
</select>
<!--查询标签定义的相关信息按照标签的编码-->
<select id="getLabelSettingByLabelNo" parameterType="java.lang.String" resultType="LabelSettingData">
SELECT ReportID labelNo, ReportFamily labelType, Reportfile labelName, ReportType labelClass, Remark remark
FROM ReportFileList
<where>
AND ReportID = #{labelNo}
</where>
</select>
<!--插入标签自定义的数据-->
<insert id="insertLabelSetting" parameterType="LabelSettingData">
INSERT INTO ReportFileList(ReportID, ReportFamily, Reportfile, ReportType, Remark)
VALUES (#{labelNo}, #{labelType}, #{labelName}, #{labelClass}, #{remark})
</insert>
<!--修改标签自定义的信息-->
<update id="updateLabelSetting" parameterType="LabelSettingData">
UPDATE ReportFileList SET ReportFamily = #{labelType}, Reportfile = #{labelName}, ReportType = #{labelClass},
Remark = #{remark}
<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="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='"admin".equalsIgnoreCase(username)'>
</if>
<if test='!"admin".equalsIgnoreCase(username)'>
and rfp.UserID = #{username}
</if>
<if test="userId != null and userId != ''">
and rfp.UserID LIKE #{userId}
</if>
<if test="labelNo != null and labelNo != ''">
and rfp.ReportID LIKE #{labelNo}
</if>
<if test="labelName != null and labelName != ''">
and rfl.Reportfile LIKE #{labelName}
</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>
<!--修改标签的打印参数-->
<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
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>
<!--复制其他标签的标签内容定义-->
<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="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>
</mapper>