|
@@ -1,9 +1,9 @@
|
|
|
<?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.caimei.modules.archive.dao.CmOrderArchiveDao">
|
|
|
-
|
|
|
- <sql id="cmOrderArchiveColumns">
|
|
|
- a.id AS "id",
|
|
|
+
|
|
|
+ <sql id="cmOrderArchiveColumns">
|
|
|
+ a.id AS "id",
|
|
|
a.archiveNo AS "archiveNo",
|
|
|
a.title AS "title",
|
|
|
a.shopOrderId AS "shopOrderId",
|
|
@@ -14,171 +14,207 @@
|
|
|
a.remark AS "remark",
|
|
|
a.addTime AS "addTime",
|
|
|
so.orderID AS "orderId"
|
|
|
- </sql>
|
|
|
-
|
|
|
- <sql id="cmOrderArchiveJoins">
|
|
|
- left join cm_shop_order so on a.shopOrderId = so.shopOrderID
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="get" resultType="CmOrderArchive">
|
|
|
- SELECT
|
|
|
- <include refid="cmOrderArchiveColumns"/>
|
|
|
- FROM cm_order_archive a
|
|
|
- <include refid="cmOrderArchiveJoins"/>
|
|
|
- WHERE a.id = #{id}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findList" resultType="CmOrderArchive">
|
|
|
- SELECT
|
|
|
- <include refid="cmOrderArchiveColumns"/>
|
|
|
- FROM cm_order_archive a
|
|
|
- <include refid="cmOrderArchiveJoins"/>
|
|
|
- <where>
|
|
|
-
|
|
|
- <if test="archiveNo != null and archiveNo != ''">
|
|
|
- AND a.archiveNo LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{archiveNo}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{archiveNo}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{archiveNo},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="title != null and title != ''">
|
|
|
- AND a.title LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="shopOrderId != null and shopOrderId != ''">
|
|
|
- AND a.shopOrderId = #{shopOrderId}
|
|
|
- </if>
|
|
|
- <if test="shopName != null and shopName != ''">
|
|
|
- AND a.shopName LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="clubName != null and clubName != ''">
|
|
|
- AND a.clubName LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{clubName}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{clubName}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{clubName},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="tag != null and tag != ''">
|
|
|
- AND a.tag LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{tag}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{tag}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{tag},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="rebateFlag != null">
|
|
|
- AND a.rebateFlag = #{rebateFlag}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- <choose>
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="cmOrderArchiveJoins">
|
|
|
+ left join cm_shop_order so on a.shopOrderId = so.shopOrderID
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="get" resultType="CmOrderArchive">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmOrderArchiveColumns"/>
|
|
|
+ FROM cm_order_archive a
|
|
|
+ <include refid="cmOrderArchiveJoins"/>
|
|
|
+ WHERE a.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findList" resultType="CmOrderArchive">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmOrderArchiveColumns"/>
|
|
|
+ FROM cm_order_archive a
|
|
|
+ <include refid="cmOrderArchiveJoins"/>
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="archiveNo != null and archiveNo != ''">
|
|
|
+ AND a.archiveNo LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{archiveNo}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{archiveNo}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{archiveNo},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">
|
|
|
+ AND a.title LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="shopOrderId != null and shopOrderId != ''">
|
|
|
+ AND a.shopOrderId = #{shopOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND a.shopName LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="clubName != null and clubName != ''">
|
|
|
+ AND a.clubName LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{clubName}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{clubName}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{clubName},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="tag != null and tag != ''">
|
|
|
+ AND a.tag LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{tag}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{tag}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{tag},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="rebateFlag != null">
|
|
|
+ AND a.rebateFlag = #{rebateFlag}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
order by a.id desc
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findAllList" resultType="CmOrderArchive">
|
|
|
- SELECT
|
|
|
- <include refid="cmOrderArchiveColumns"/>
|
|
|
- FROM cm_order_archive a
|
|
|
- <include refid="cmOrderArchiveJoins"/>
|
|
|
- <where>
|
|
|
-
|
|
|
- </where>
|
|
|
- <choose>
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </select>
|
|
|
- <select id="getArchiveFileList" resultType="com.caimei.modules.archive.entity.CmOrderArchiveFile">
|
|
|
- select id, fileName, ossName, ossUrl
|
|
|
- from cm_order_archive_file
|
|
|
- where orderArchiveId = #{archiveId}
|
|
|
- </select>
|
|
|
- <select id="getArchiveFileById" resultType="com.caimei.modules.archive.entity.CmOrderArchiveFile">
|
|
|
- select id, fileName, ossName
|
|
|
- from cm_order_archive_file
|
|
|
- where id = #{fileId}
|
|
|
- </select>
|
|
|
- <select id="getAllFileIds" resultType="java.lang.String">
|
|
|
- select GROUP_CONCAT(id) from cm_order_archive_file where orderArchiveId = #{orderArchiveId} group by orderArchiveId
|
|
|
- </select>
|
|
|
- <select id="checkFileName" resultType="java.lang.Integer">
|
|
|
- select id from cm_order_archive_file
|
|
|
- <where>
|
|
|
- fileName = #{fileName} and (
|
|
|
- <if test="orderArchiveId != null">
|
|
|
- orderArchiveId = #{orderArchiveId}
|
|
|
- </if>
|
|
|
- <if test="fileIds != null and fileIds != ''">
|
|
|
- or id in
|
|
|
- <foreach collection="fileIds.split(',')" item="fileId" index="index" open="(" separator="," close=")" >
|
|
|
- #{fileId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- )
|
|
|
- </where>
|
|
|
- </select>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findAllList" resultType="CmOrderArchive">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmOrderArchiveColumns"/>
|
|
|
+ FROM cm_order_archive a
|
|
|
+ <include refid="cmOrderArchiveJoins"/>
|
|
|
+ <where>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+ <select id="getArchiveFileList" resultType="com.caimei.modules.archive.entity.CmOrderArchiveFile">
|
|
|
+ select id, fileName, ossName, ossUrl
|
|
|
+ from cm_order_archive_file
|
|
|
+ where orderArchiveId = #{archiveId}
|
|
|
+ </select>
|
|
|
+ <select id="getArchiveFileById" resultType="com.caimei.modules.archive.entity.CmOrderArchiveFile">
|
|
|
+ select id, fileName, ossName
|
|
|
+ from cm_order_archive_file
|
|
|
+ where id = #{fileId}
|
|
|
+ </select>
|
|
|
+ <select id="getAllFileIds" resultType="java.lang.String">
|
|
|
+ select GROUP_CONCAT(id)
|
|
|
+ from cm_order_archive_file
|
|
|
+ where orderArchiveId = #{orderArchiveId}
|
|
|
+ group by orderArchiveId
|
|
|
+ </select>
|
|
|
+ <select id="checkFileName" resultType="java.lang.Integer">
|
|
|
+ select id from cm_order_archive_file
|
|
|
+ <where>
|
|
|
+ fileName = #{fileName}
|
|
|
+ <if test="orderArchiveId != null || (fileIds != null and fileIds != '')">
|
|
|
+ and(
|
|
|
+ <if test="orderArchiveId != null || (fileIds != null and fileIds != '')">
|
|
|
+ orderArchiveId = #{orderArchiveId}
|
|
|
+ </if>
|
|
|
+ <if test="fileIds != null and fileIds != ''">
|
|
|
+ or id in
|
|
|
+ <foreach collection="fileIds.split(',')" item="fileId" index="index" open="(" separator=","
|
|
|
+ close=")">
|
|
|
+ #{fileId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
<select id="checkShopOrderIdExist" resultType="java.lang.Integer">
|
|
|
- select so.shopOrderID from cm_shop_order so
|
|
|
+ select so.shopOrderID
|
|
|
+ from cm_shop_order so
|
|
|
where so.shopOrderID = #{shopOrderId}
|
|
|
</select>
|
|
|
|
|
|
<select id="checkShopOrderIdAble" resultType="java.lang.Integer">
|
|
|
- select so.shopOrderID from cm_shop_order so
|
|
|
+ select so.shopOrderID
|
|
|
+ from cm_shop_order so
|
|
|
where so.shopOrderID = #{shopOrderId}
|
|
|
- and so.shopOrderID not in
|
|
|
- (select a.shopOrderId from cm_order_archive a
|
|
|
- where a.shopOrderId is not null) limit 1
|
|
|
+ and so.shopOrderID not in
|
|
|
+ (select a.shopOrderId
|
|
|
+ from cm_order_archive a
|
|
|
+ where a.shopOrderId is not null)
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+ <select id="getShopNameByShopOrderId" resultType="java.lang.String">
|
|
|
+ select s.name
|
|
|
+ from cm_shop_order cso
|
|
|
+ left join shop s on cso.shopID = s.shopID
|
|
|
+ where cso.shopOrderID = #{shopOrderId}
|
|
|
+ </select>
|
|
|
+ <select id="getClubNameByShopOrderId" resultType="java.lang.String">
|
|
|
+ select c.name
|
|
|
+ from cm_shop_order cso
|
|
|
+ left join club c on cso.clubID = c.clubID
|
|
|
+ where cso.shopOrderID = #{shopOrderId}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insert" parameterType="CmOrderArchive" keyProperty="id" useGeneratedKeys="true">
|
|
|
- INSERT INTO cm_order_archive(
|
|
|
- archiveNo,
|
|
|
- addTime
|
|
|
- ) VALUES (
|
|
|
- #{archiveNo},
|
|
|
- #{addTime}
|
|
|
- )
|
|
|
- </insert>
|
|
|
- <insert id="insertArchiveFile" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
|
|
- insert into cm_order_archive_file(fileName, ossName, ossUrl, uploadTime)
|
|
|
- values (#{fileName}, #{ossName}, #{ossUrl}, #{uploadTime})
|
|
|
- </insert>
|
|
|
+ <insert id="insert" parameterType="CmOrderArchive" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ INSERT INTO cm_order_archive(archiveNo,
|
|
|
+ title,
|
|
|
+ shopOrderId,
|
|
|
+ shopName,
|
|
|
+ clubName,
|
|
|
+ tag,
|
|
|
+ rebateFlag,
|
|
|
+ remark,
|
|
|
+ addTime)
|
|
|
+ VALUES (#{archiveNo},
|
|
|
+ #{title},
|
|
|
+ #{shopOrderId},
|
|
|
+ #{shopName},
|
|
|
+ #{clubName},
|
|
|
+ #{tag},
|
|
|
+ #{rebateFlag},
|
|
|
+ #{remark},
|
|
|
+ #{addTime})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertArchiveFile" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into cm_order_archive_file(fileName, ossName, ossUrl, uploadTime)
|
|
|
+ values (#{fileName}, #{ossName}, #{ossUrl}, #{uploadTime})
|
|
|
+ </insert>
|
|
|
|
|
|
- <update id="update">
|
|
|
- UPDATE cm_order_archive SET
|
|
|
- title = #{title},
|
|
|
- shopOrderId = #{shopOrderId},
|
|
|
- shopName = #{shopName},
|
|
|
- clubName = #{clubName},
|
|
|
- tag = #{tag},
|
|
|
- rebateFlag = #{rebateFlag},
|
|
|
- remark = #{remark}
|
|
|
- WHERE id = #{id}
|
|
|
- </update>
|
|
|
- <update id="updateArchiveFile">
|
|
|
- update cm_order_archive_file
|
|
|
- set orderArchiveId = #{orderArchiveId}
|
|
|
- where id = #{fileId}
|
|
|
- </update>
|
|
|
+ <update id="update">
|
|
|
+ UPDATE cm_order_archive
|
|
|
+ SET archiveNo = #{archiveNo},
|
|
|
+ title = #{title},
|
|
|
+ shopOrderId = #{shopOrderId},
|
|
|
+ shopName = #{shopName},
|
|
|
+ clubName = #{clubName},
|
|
|
+ tag = #{tag},
|
|
|
+ rebateFlag = #{rebateFlag},
|
|
|
+ remark = #{remark}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="updateArchiveFile">
|
|
|
+ update cm_order_archive_file
|
|
|
+ set orderArchiveId = #{orderArchiveId}
|
|
|
+ where id = #{fileId}
|
|
|
+ </update>
|
|
|
|
|
|
- <delete id="delete">
|
|
|
- DELETE FROM cm_order_archive
|
|
|
- WHERE id = #{id}
|
|
|
- </delete>
|
|
|
- <delete id="deleteArchiveFile">
|
|
|
- delete
|
|
|
- from cm_order_archive_file
|
|
|
- where id = #{fileId}
|
|
|
- </delete>
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE
|
|
|
+ FROM cm_order_archive
|
|
|
+ WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteArchiveFile">
|
|
|
+ delete
|
|
|
+ from cm_order_archive_file
|
|
|
+ where id = #{fileId}
|
|
|
+ </delete>
|
|
|
|
|
|
</mapper>
|