system-operator/src/main/resources/mybatis/mapper/content-sub/content-sub-mapper.xml
2024-08-05 15:24:21 +08:00

410 lines
13 KiB
XML

<?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="cn.com.tenlion.operator.dao.contentsub.IContentSubDao">
<resultMap id="contentSubDTO" type="cn.com.tenlion.operator.pojo.dtos.contentsub.ContentSubDTO">
<result column="content_id" property="contentId"/>
<result column="content_sub_id" property="contentSubId"/>
<result column="icon1" property="icon1"/>
<result column="title_fir" property="titleFir"/>
<result column="title_sec" property="titleSec"/>
<result column="photo" property="photo"/>
<result column="video" property="video"/>
<result column="content" property="content"/>
<result column="remake" property="remake"/>
<result column="order_order" property="orderOrder"/>
<result column="color" property="color"/>
<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>
<resultMap id="contentSubBO" type="cn.com.tenlion.operator.pojo.bos.contentsub.ContentSubBO">
<result column="content_id" property="contentId"/>
<result column="content_sub_id" property="contentSubId"/>
<result column="icon1" property="icon1"/>
<result column="icon2" property="icon2"/>
<result column="title_fir" property="titleFir"/>
<result column="title_sec" property="titleSec"/>
<result column="photo" property="photo"/>
<result column="video" property="video"/>
<result column="content" property="content"/>
<result column="remake" property="remake"/>
<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>
<resultMap id="contentSubPO" type="cn.com.tenlion.operator.pojo.pos.contentsub.ContentSubPO">
<result column="content_id" property="contentId"/>
<result column="content_sub_id" property="contentSubId"/>
<result column="icon1" property="icon1"/>
<result column="title_fir" property="titleFir"/>
<result column="title_sec" property="titleSec"/>
<result column="photo" property="photo"/>
<result column="video" property="video"/>
<result column="content" property="content"/>
<result column="remake" property="remake"/>
<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 data_content_sub(
content_id,
content_sub_id,
icon1,
icon2,
title_fir,
title_sec,
photo,
video,
content,
remake,
order_order,
color,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{contentId},
#{contentSubId},
#{icon1},
#{icon2},
#{titleFir},
#{titleSec},
#{photo},
#{video},
#{content},
#{remake},
#{orderOrder},
#{color},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除主体内容附属表 -->
<update id="remove" parameterType="map">
UPDATE
data_content_sub
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
content_sub_id IN
<foreach collection="contentSubIds" index="index" open="(" separator="," close=")">
#{contentSubIds[${index}]}
</foreach>
</update>
<!-- 删除主体内容附属表(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
data_content_sub
WHERE
content_sub_id IN
<foreach collection="contentSubIds" index="index" open="(" separator="," close=")">
#{contentSubIds[${index}]}
</foreach>
</update>
<!-- 修改主体内容附属表 -->
<update id="update" parameterType="map">
UPDATE
data_content_sub
SET
<if test="contentId != null and contentId != ''">
content_id = #{contentId},
</if>
<if test="icon1 != null and icon1 != ''">
icon1 = #{icon1},
</if>
<if test="icon2 != null and icon2 != ''">
icon2 = #{icon2},
</if>
<if test="icon1 == null or icon1 == ''">
icon1 = '',
</if>
<if test="icon2 == null or icon2 == ''">
icon2 = '',
</if>
<if test="titleFir != null and titleFir != ''">
title_fir = #{titleFir},
</if>
<if test="titleSec != null and titleSec != ''">
title_sec = #{titleSec},
</if>
<if test="photo != null and photo != ''">
photo = #{photo},
</if>
<if test="video != null and video != ''">
video = #{video},
</if>
<if test="photo == null or photo == ''">
photo = '',
</if>
<if test="video == null or video == ''">
video = '',
</if>
<if test="content != null and content != ''">
content = #{content},
</if>
<if test="remake != null and remake != ''">
remake = #{remake},
</if>
<if test="orderOrder != null">
order_order = #{orderOrder},
</if>
<if test="color != null and color != ''">
color = #{color},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
content_sub_id = content_sub_id
WHERE
content_sub_id = #{contentSubId}
</update>
<!-- 主体内容附属表详情 -->
<select id="get" parameterType="map" resultMap="contentSubDTO">
SELECT
t1.content_id,
t1.icon1,
t1.icon2,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.order_order,
t1.color,
t1.content_sub_id
FROM
data_content_sub t1
WHERE
t1.is_delete = 0
<if test="contentSubId != null and contentSubId != ''">
AND
t1.content_sub_id = #{contentSubId}
</if>
</select>
<!-- 主体内容附属表详情 -->
<select id="getBO" parameterType="map" resultMap="contentSubBO">
SELECT
t1.content_id,
t1.content_sub_id,
t1.icon1,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_content_sub t1
WHERE
t1.is_delete = 0
<if test="contentSubId != null and contentSubId != ''">
AND
t1.content_sub_id = #{contentSubId}
</if>
</select>
<!-- 主体内容附属表详情 -->
<select id="getPO" parameterType="map" resultMap="contentSubPO">
SELECT
t1.content_id,
t1.content_sub_id,
t1.icon1,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_content_sub t1
WHERE
t1.is_delete = 0
<if test="contentSubId != null and contentSubId != ''">
AND
t1.content_sub_id = #{contentSubId}
</if>
</select>
<!-- 主体内容附属表列表 -->
<select id="list" parameterType="map" resultMap="contentSubDTO">
SELECT
t1.content_id,
t1.content_sub_id,
t1.icon1,
t1.icon2,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.order_order,
t1.color,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
1
FROM
data_content_sub t1
WHERE
t1.is_delete = 0
<if test="contentId != null and contentId != ''">
AND t1.content_id = #{contentId}
</if>
<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="contentSubIds != null and contentSubIds.size > 0">
AND
t1.content_sub_id IN
<foreach collection="contentSubIds" index="index" open="(" separator="," close=")">
#{contentSubIds[${index}]}
</foreach>
</if>
ORDER BY t1.order_order ASC
</select>
<!-- 主体内容附属表列表 -->
<select id="listBO" parameterType="map" resultMap="contentSubBO">
SELECT
t1.content_id,
t1.content_sub_id,
t1.icon1,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_content_sub 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="contentSubIds != null and contentSubIds.size > 0">
AND
t1.content_sub_id IN
<foreach collection="contentSubIds" index="index" open="(" separator="," close=")">
#{contentSubIds[${index}]}
</foreach>
</if>
</select>
<!-- 主体内容附属表列表 -->
<select id="listPO" parameterType="map" resultMap="contentSubPO">
SELECT
t1.content_id,
t1.content_sub_id,
t1.icon1,
t1.title_fir,
t1.title_sec,
t1.photo,
t1.video,
t1.content,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_content_sub 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="contentSubIds != null and contentSubIds.size > 0">
AND
t1.content_sub_id IN
<foreach collection="contentSubIds" index="index" open="(" separator="," close=")">
#{contentSubIds[${index}]}
</foreach>
</if>
</select>
<!-- 主体内容附属表统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
data_content_sub t1
WHERE
t1.is_delete = 0
</select>
</mapper>