123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.CmProductArchiveContentDao">
-
- <sql id="cmProductArchiveContentColumns">
- a.id AS "id",
- a.productArchiveId AS "productArchiveId",
- a.title AS "title",
- a.type AS "type",
- a.addTime AS "addTime"
- </sql>
-
- <sql id="cmProductArchiveContentJoins">
- </sql>
-
- <select id="get" resultType="CmProductArchiveContent">
- SELECT
- <include refid="cmProductArchiveContentColumns"/>
- FROM cm_product_archive_content a
- <include refid="cmProductArchiveContentJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="CmProductArchiveContent">
- SELECT
- <include refid="cmProductArchiveContentColumns"/>
- FROM cm_product_archive_content a
- <include refid="cmProductArchiveContentJoins"/>
- <where>
-
- <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="type != null">
- and a.type = #{type}
- </if>
- <if test="productArchiveId != null">
- and a.productArchiveId = #{productArchiveId}
- </if>
- </where>
- order by a.addTime desc
- </select>
-
- <select id="findAllList" resultType="CmProductArchiveContent">
- SELECT
- <include refid="cmProductArchiveContentColumns"/>
- FROM cm_product_archive_content a
- <include refid="cmProductArchiveContentJoins"/>
- <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="getImageList" resultType="com.caimei.modules.archive.entity.CmProductArchiveFile">
- select * from cm_product_archive_file where archiveContentId = #{id}
- </select>
- <select id="getDbFileId" resultType="java.lang.Integer">
- select id from cm_product_archive_file where archiveContentId = #{id} limit 1
- </select>
- <insert id="insert" parameterType="CmProductArchiveContent" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_product_archive_content(
- productArchiveId,
- title,
- type,
- addTime
- ) VALUES (
- #{productArchiveId},
- #{title},
- #{type},
- now()
- )
- </insert>
- <insert id="insertFile" parameterType="CmProductArchiveFile" keyProperty="id" useGeneratedKeys="true">
- insert into cm_product_archive_file(archiveContentId, fileName, ossName, ossUrl, uploadTime)
- values (#{archiveContentId}, #{fileName}, #{ossName}, #{ossUrl}, now());
- </insert>
- <update id="update">
- UPDATE cm_product_archive_content SET
- title = #{title}
- WHERE id = #{id}
- </update>
- <update id="updateFile">
- update cm_product_archive_file
- set archiveContentId = #{archiveContentId}
- where id = #{fileId}
- </update>
- <delete id="delete">
- DELETE FROM cm_product_archive_content
- WHERE id = #{id}
- </delete>
- <delete id="deleteFile">
- delete from cm_product_archive_file where archiveContentId = #{archiveContentId}
- </delete>
- </mapper>
|