tenlion-module/module-material-store/src/main/resources/mybatis/mapper/materialaudio/material-audio-mapper.xml

357 lines
12 KiB
XML
Raw Normal View History

2021-05-28 15:34:00 +08:00
<?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">
2021-05-28 17:21:43 +08:00
<mapper namespace="cn.com.tenlion.materialstore.dao.materialaudio.IMaterialAudioDao">
2021-05-28 15:34:00 +08:00
2021-05-28 17:21:43 +08:00
<resultMap id="materialAudioDTO" type="cn.com.tenlion.materialstore.pojo.dtos.materialaudio.MaterialAudioDTO">
2021-05-31 15:39:31 +08:00
<result column="material_status" property="materialStatus"/>
<result column="creator_name" property="creatorName"/>
2021-05-28 15:34:00 +08:00
<result column="material_audio_id" property="materialAudioId"/>
<result column="material_audio_file_id" property="materialAudioFileId"/>
<result column="material_id" property="materialId"/>
<result column="material_order" property="materialOrder"/>
<result column="material_remark" property="materialRemark"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
2021-05-28 17:21:43 +08:00
<resultMap id="materialAudioBO" type="cn.com.tenlion.materialstore.pojo.bos.materialaudio.MaterialAudioBO">
2021-05-28 15:34:00 +08:00
<result column="material_audio_id" property="materialAudioId"/>
<result column="material_audio_file_id" property="materialAudioFileId"/>
<result column="material_id" property="materialId"/>
<result column="material_order" property="materialOrder"/>
<result column="material_remark" property="materialRemark"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
2021-05-28 17:21:43 +08:00
<resultMap id="materialAudioPO" type="cn.com.tenlion.materialstore.pojo.pos.materialaudio.MaterialAudioPO">
2021-05-28 15:34:00 +08:00
<result column="material_audio_id" property="materialAudioId"/>
<result column="material_audio_file_id" property="materialAudioFileId"/>
<result column="material_id" property="materialId"/>
<result column="material_order" property="materialOrder"/>
<result column="material_remark" property="materialRemark"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增音频素材 -->
<insert id="save" parameterType="map">
INSERT INTO m_material_audio(
2021-05-31 15:39:31 +08:00
material_status,
2021-05-28 15:34:00 +08:00
material_audio_id,
material_audio_file_id,
material_id,
material_order,
material_remark,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
2021-05-31 15:39:31 +08:00
1,
2021-05-28 15:34:00 +08:00
#{materialAudioId},
#{materialAudioFileId},
#{materialId},
#{materialOrder},
#{materialRemark},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
2021-05-28 16:28:29 +08:00
<!-- 删除音频素材(物理) -->
<update id="removeByMaterialId" parameterType="map">
DELETE FROM
m_material_audio
WHERE
material_id = #{materialId}
</update>
2021-05-28 15:34:00 +08:00
<!-- 删除音频素材 -->
<update id="remove" parameterType="map">
UPDATE
m_material_audio
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
material_audio_id IN
<foreach collection="materialAudioIds" index="index" open="(" separator="," close=")">
#{materialAudioIds[${index}]}
</foreach>
</update>
<!-- 删除音频素材(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
m_material_audio
WHERE
material_audio_id IN
<foreach collection="materialAudioIds" index="index" open="(" separator="," close=")">
#{materialAudioIds[${index}]}
</foreach>
</update>
2021-05-31 15:39:31 +08:00
<!-- 更改状态 -->
<update id="updateCheck" parameterType="map">
UPDATE
m_material_audio
SET
material_status = #{materialStatus}
WHERE
material_audio_id = #{materialAudioId}
</update>
2021-05-28 15:34:00 +08:00
<!-- 修改音频素材 -->
<update id="update" parameterType="map">
UPDATE
m_material_audio
SET
<if test="materialAudioFileId != null and materialAudioFileId != ''">
material_audio_file_id = #{materialAudioFileId},
</if>
<if test="materialId != null and materialId != ''">
material_id = #{materialId},
</if>
<if test="materialOrder != null">
material_order = #{materialOrder},
</if>
<if test="materialRemark != null and materialRemark != ''">
material_remark = #{materialRemark},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
material_audio_id = material_audio_id
WHERE
material_audio_id = #{materialAudioId}
</update>
<!-- 音频素材详情 -->
<select id="get" parameterType="map" resultMap="materialAudioDTO">
SELECT
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
2021-05-31 15:39:31 +08:00
t1.material_audio_id,
t1.material_status
2021-05-28 15:34:00 +08:00
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
<if test="materialAudioId != null and materialAudioId != ''">
AND
t1.material_audio_id = #{materialAudioId}
</if>
</select>
<!-- 音频素材详情 -->
<select id="getBO" parameterType="map" resultMap="materialAudioBO">
SELECT
t1.material_audio_id,
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
<if test="materialAudioId != null and materialAudioId != ''">
AND
t1.material_audio_id = #{materialAudioId}
</if>
</select>
<!-- 音频素材详情 -->
<select id="getPO" parameterType="map" resultMap="materialAudioPO">
SELECT
t1.material_audio_id,
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
<if test="materialAudioId != null and materialAudioId != ''">
AND
t1.material_audio_id = #{materialAudioId}
</if>
</select>
<!-- 音频素材列表 -->
<select id="list" parameterType="map" resultMap="materialAudioDTO">
SELECT
t1.material_audio_id,
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
2021-05-31 15:39:31 +08:00
t1.material_status,
t2.user_name AS creator_name
2021-05-28 15:34:00 +08:00
FROM
m_material_audio t1
2021-05-31 15:39:31 +08:00
LEFT JOIN
sys_user t2
ON
t1.creator = t2.user_id
2021-05-28 15:34:00 +08:00
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
2021-05-31 15:39:31 +08:00
t1.material_remark LIKE CONCAT('%', #{keywords}, '%')
OR
t2.user_name LIKE CONCAT('%', #{keywords}, '%')
2021-05-28 15:34:00 +08:00
)
</if>
2021-05-31 15:39:31 +08:00
<if test="materialStatus != null and materialStatus != ''">
AND
t1.material_status = #{materialStatus}
</if>
2021-05-28 15:34:00 +08:00
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="materialAudioIds != null and materialAudioIds.size > 0">
AND
t1.material_audio_id IN
<foreach collection="materialAudioIds" index="index" open="(" separator="," close=")">
#{materialAudioIds[${index}]}
</foreach>
</if>
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
2021-06-01 18:25:43 +08:00
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
2021-05-31 17:34:23 +08:00
ORDER BY t1.gmt_create DESC, t1.material_order
2021-05-28 15:34:00 +08:00
</select>
<!-- 音频素材列表 -->
<select id="listBO" parameterType="map" resultMap="materialAudioBO">
SELECT
t1.material_audio_id,
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="materialAudioIds != null and materialAudioIds.size > 0">
AND
t1.material_audio_id IN
<foreach collection="materialAudioIds" index="index" open="(" separator="," close=")">
#{materialAudioIds[${index}]}
</foreach>
</if>
</select>
<!-- 音频素材列表 -->
<select id="listPO" parameterType="map" resultMap="materialAudioPO">
SELECT
t1.material_audio_id,
t1.material_audio_file_id,
t1.material_id,
t1.material_order,
t1.material_remark,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="materialAudioIds != null and materialAudioIds.size > 0">
AND
t1.material_audio_id IN
<foreach collection="materialAudioIds" index="index" open="(" separator="," close=")">
#{materialAudioIds[${index}]}
</foreach>
</if>
</select>
<!-- 音频素材统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
m_material_audio t1
WHERE
t1.is_delete = 0
</select>
</mapper>