123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?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.mapper.cmMapper.FileMapper">
- <insert id="insertFile" keyColumn="id" keyProperty="id" parameterType="com.caimei.model.po.FilePo" useGeneratedKeys="true">
- insert into cm_brand_file(authUserId, fileType, title, name, previewUrl, downloadUrl, auditStatus, status,
- createTime, auditBy, auditTime, checkFlag)
- values (#{authUserId}, #{fileType}, #{title}, #{name}, #{previewUrl}, #{downloadUrl}, #{auditStatus}, #{status},
- #{createTime}, #{auditBy}, #{auditTime}, #{checkFlag})
- </insert>
- <insert id="insertCourseFile">
- insert into cm_brand_course_file (title, name, ossName, type, module, createTime)
- values (#{title}, #{name}, #{ossName}, #{fileType}, #{fileModule}, NOW());
- </insert>
- <update id="updateFileByFileId">
- update cm_brand_file
- set title = #{title},
- status = #{status},
- auditStatus = #{auditStatus}
- where id = #{id}
- </update>
- <update id="updateFileStatusByFileId">
- update cm_brand_file
- set status = #{status}
- where id = #{fileId}
- </update>
- <update id="updateFileAuditStatus">
- update cm_brand_file
- set status = #{status},
- auditStatus = #{auditStatus},
- invalidReason = #{invalidReason},
- auditBy = #{auditBy},
- auditTime = #{auditTime}
- where id = #{fileId}
- </update>
- <update id="updateFileSelective">
- update cm_brand_file
- <set>
- <if test="title != null and title != ''">
- title = #{title},
- </if>
- <if test="previewUrl != null and previewUrl != ''">
- previewUrl = #{previewUrl},
- </if>
- <if test="downloadUrl != null and downloadUrl != ''">
- downloadUrl = #{downloadUrl},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- <if test="auditStatus != null">
- auditStatus = #{auditStatus},
- </if>
- <if test="checkFlag != null">
- checkFlag = #{checkFlag},
- </if>
- </set>
- where id = #{id}
- </update>
- <update id="updateCourseFile">
- update cm_brand_course_file
- set title = #{title},
- name = #{name},
- ossName = #{ossName},
- type = #{fileType},
- module = #{fileModule}
- where id = #{id}
- </update>
- <update id="checkFile">
- update cm_brand_file
- set checkFlag = 1
- where id = #{fileId}
- </update>
- <delete id="deleteFileByFileId">
- delete from cm_brand_file where id = #{fileId}
- </delete>
- <delete id="deleteCourseFileByFileId">
- delete from cm_brand_course_file where id = #{fileId}
- </delete>
- <select id="getFileList" resultType="com.caimei.model.vo.FileListVo">
- select a.id as fileId,a.title as fileTitle,a.name as fileName,a.previewUrl as filePreviewUrl,
- a.downloadUrl as fileDownloadUrl, a.auditStatus,a.invalidReason,a.status,a.createTime,
- au.name as auditBy,a.auditTime,a.checkFlag
- from cm_brand_file a
- left join cm_brand_auth_user au on a.auditBy = au.authUserId
- where a.authUserId = #{authUserId} and fileType = #{fileType}
- <if test="fileTitle != null and fileTitle != ''">
- and a.title like concat('%',#{fileTitle},'%')
- </if>
- <if test="auditStatus != null">
- and a.auditStatus = #{auditStatus}
- </if>
- <if test="status != null">
- and a.status = #{status}
- </if>
- <choose>
- <when test="listType == 2">
- order by a.auditStatus desc, a.createTime desc
- </when>
- <otherwise>
- order by a.createTime desc
- </otherwise>
- </choose>
- </select>
- <select id="getWxFileList" resultType="com.caimei.model.vo.WxFileListVo">
- select id as fileId, title as fileTitle,name as fileName, previewUrl as filePreviewUrl, downloadUrl as
- fileDownloadUrl, date_format(createTime, '%Y-%m-%d') as createTime
- from cm_brand_file a
- where authUserId = #{authUserId}
- and status = 1
- and fileType = #{fileType}
- <if test="fileTitle != null and fileTitle != ''">
- and title like concat('%',#{fileTitle},'%')
- </if>
- order by a.createTime desc
- </select>
- <select id="getCourseFileList" resultType="com.caimei.model.vo.CourseFileListVo">
- select id as fileId, title as fileTitle, name as fileName, ossName, module as fileModule, createTime
- from cm_brand_course_file
- where type = #{fileType}
- <if test="fileTitle != null and fileTitle != ''">
- and title like concat('%',#{fileTitle},'%')
- </if>
- <if test="fileModule != null and fileModule != ''">
- and module = #{fileModule}
- </if>
- order by createTime desc
- </select>
- <select id="getAuthImageData" resultType="com.caimei.model.po.ProductImagePo">
- SELECT certificateImage as authImage, a.authParty, p.snCode
- FROM cm_brand_auth_product p
- left join cm_brand_product_relation r on p.id = r.productId
- left join cm_brand_auth a on r.authId = a.id
- left join cm_brand_auth_user u on a.authUserId = u.authUserId
- where u.authUserId = 4;
- </select>
- <select id="getProductImageList" resultType="com.caimei.model.po.ProductImagePo">
- SELECT p.id as productId, certificateImage, a.authParty, p.snCode,
- if(p.productTypeId is null,p.name,t.name) as productName
- FROM cm_brand_auth_product p
- left join cm_brand_product_relation r on p.id = r.productId
- left join cm_brand_auth a on r.authId = a.id
- left join cm_brand_auth_user u on a.authUserId = u.authUserId
- left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
- where a.delFlag = 0
- <if test="authId != null">
- and a.id = #{authId}
- </if>
- </select>
- <select id="getAuthImageList" resultType="com.caimei.model.vo.AuthVo">
- select a.id as authId, a.authUserId, a.authImage, a.authParty
- from cm_brand_auth a
- left join cm_brand_auth_user u on a.authUserId = u.authUserId
- where a.delFlag = 0
- and find_in_set(a.id, #{authIds})
- </select>
- <select id="getFileForm" resultType="com.caimei.model.po.FilePo">
- select id,auditStatus from cm_brand_file where id = #{fileId}
- </select>
- </mapper>
|