376 lines
12 KiB
XML
376 lines
12 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.dao.templateperson.ITemplatePersonDao">
|
|
|
|
<resultMap id="templatePersonDTO" type="cn.com.tenlion.pojo.dtos.templateperson.TemplatePersonDTO">
|
|
<result column="card_person_id" property="cardPersonId"/>
|
|
<result column="background_id" property="backgroundId"/>
|
|
<result column="card_name" property="cardName"/>
|
|
<result column="template_id" property="templateId"/>
|
|
<result column="content" property="content"/>
|
|
<result column="source" property="source"/>
|
|
<result column="card_order" property="cardOrder"/>
|
|
<result column="thumbnail" property="thumbnail"/>
|
|
<result column="is_main" property="isMain"/>
|
|
<result column="card_width" property="cardWidth"/>
|
|
<result column="card_height" property="cardHeight"/>
|
|
<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="templatePersonBO" type="cn.com.tenlion.pojo.bos.templateperson.TemplatePersonBO">
|
|
<result column="card_person_id" property="cardPersonId"/>
|
|
<result column="background_id" property="backgroundId"/>
|
|
<result column="card_name" property="cardName"/>
|
|
<result column="template_id" property="templateId"/>
|
|
<result column="content" property="content"/>
|
|
<result column="source" property="source"/>
|
|
<result column="card_order" property="cardOrder"/>
|
|
<result column="thumbnail" property="thumbnail"/>
|
|
<result column="is_main" property="isMain"/>
|
|
<result column="card_width" property="cardWidth"/>
|
|
<result column="card_height" property="cardHeight"/>
|
|
<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="templatePersonPO" type="cn.com.tenlion.pojo.pos.templateperson.TemplatePersonPO">
|
|
<result column="card_person_id" property="cardPersonId"/>
|
|
<result column="background_id" property="backgroundId"/>
|
|
<result column="card_name" property="cardName"/>
|
|
<result column="template_id" property="templateId"/>
|
|
<result column="content" property="content"/>
|
|
<result column="source" property="source"/>
|
|
<result column="card_order" property="cardOrder"/>
|
|
<result column="thumbnail" property="thumbnail"/>
|
|
<result column="is_main" property="isMain"/>
|
|
<result column="card_width" property="cardWidth"/>
|
|
<result column="card_height" property="cardHeight"/>
|
|
<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 card_template_person(
|
|
card_person_id,
|
|
background_id,
|
|
card_name,
|
|
template_id,
|
|
content,
|
|
source,
|
|
card_order,
|
|
thumbnail,
|
|
is_main,
|
|
card_width,
|
|
card_height,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{cardPersonId},
|
|
#{backgroundId},
|
|
#{cardName},
|
|
#{templateId},
|
|
#{content},
|
|
#{source},
|
|
#{cardOrder},
|
|
#{thumbnail},
|
|
#{isMain},
|
|
#{cardWidth},
|
|
#{cardHeight},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除 -->
|
|
<update id="remove" parameterType="map">
|
|
UPDATE
|
|
card_template_person
|
|
SET
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
is_delete = 1
|
|
WHERE
|
|
card_person_id IN
|
|
<foreach collection="templatePersonIds" index="index" open="(" separator="," close=")">
|
|
#{templatePersonIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除(物理) -->
|
|
<update id="delete" parameterType="map">
|
|
DELETE FROM
|
|
card_template_person
|
|
WHERE
|
|
card_person_id = #{cardPersonId}
|
|
</update>
|
|
|
|
<!-- 修改 -->
|
|
<update id="update" parameterType="map">
|
|
UPDATE
|
|
card_template_person
|
|
SET
|
|
<if test="cardPersonId != null and cardPersonId != ''">
|
|
card_person_id = #{cardPersonId},
|
|
</if>
|
|
<if test="backgroundId != null and backgroundId != ''">
|
|
background_id = #{backgroundId},
|
|
</if>
|
|
<if test="cardName != null and cardName != ''">
|
|
card_name = #{cardName},
|
|
</if>
|
|
<if test="templateId != null and templateId != ''">
|
|
template_id = #{templateId},
|
|
</if>
|
|
<if test="content != null and content != ''">
|
|
content = #{content},
|
|
</if>
|
|
<if test="source != null and source != ''">
|
|
source = #{source},
|
|
</if>
|
|
<if test="cardOrder != null and cardOrder != ''">
|
|
card_order = #{cardOrder},
|
|
</if>
|
|
<if test="thumbnail != null and thumbnail != ''">
|
|
thumbnail = #{thumbnail},
|
|
</if>
|
|
<if test="isMain != null and isMain != ''">
|
|
is_main = #{isMain},
|
|
</if>
|
|
<if test="cardWidth != null and cardWidth != ''">
|
|
card_width = #{cardWidth},
|
|
</if>
|
|
<if test="cardHeight != null and cardHeight != ''">
|
|
card_height = #{cardHeight},
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
creator = #{creator},
|
|
</if>
|
|
<if test="gmtCreate != null and gmtCreate != ''">
|
|
gmt_create = #{gmtCreate},
|
|
</if>
|
|
<if test="modifier != null and modifier != ''">
|
|
modifier = #{modifier},
|
|
</if>
|
|
<if test="isDelete != null">
|
|
is_delete = #{isDelete},
|
|
</if>
|
|
<if test="gmtModified != null and gmtModified != ''">
|
|
gmt_modified = #{gmtModified}
|
|
</if>
|
|
WHERE
|
|
card_person_id = #{cardPersonId}
|
|
</update>
|
|
|
|
<!-- 详情 -->
|
|
<select id="get" parameterType="map" resultMap="templatePersonDTO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.source,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
1
|
|
FROM
|
|
card_template_person t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
AND card_person_id = #{cardPersonId}
|
|
</select>
|
|
|
|
<!-- 详情 -->
|
|
<select id="getBO" parameterType="map" resultMap="templatePersonBO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
t1.source
|
|
FROM
|
|
card_template_person t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
AND card_person_id = #{cardPersonId}
|
|
</select>
|
|
|
|
<!-- 详情 -->
|
|
<select id="getPO" parameterType="map" resultMap="templatePersonPO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
t1.source
|
|
FROM
|
|
card_template_person t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
AND card_person_id = #{cardPersonId}
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<select id="list" parameterType="map" resultMap="templatePersonDTO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.source,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
1
|
|
FROM
|
|
card_template_person t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="creator != null and creator != ''">
|
|
AND
|
|
t1.creator = #{creator}
|
|
</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>
|
|
ORDER BY t1.card_order
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<select id="listBO" parameterType="map" resultMap="templatePersonBO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
t1.source
|
|
FROM
|
|
card_template_person 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>
|
|
ORDER BY t1.card_order
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<select id="listPO" parameterType="map" resultMap="templatePersonPO">
|
|
SELECT
|
|
t1.card_person_id,
|
|
t1.background_id,
|
|
t1.card_name,
|
|
t1.template_id,
|
|
t1.content,
|
|
t1.card_order,
|
|
t1.thumbnail,
|
|
t1.is_main,
|
|
t1.card_width,
|
|
t1.card_height,
|
|
t1.source
|
|
FROM
|
|
card_template_person 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>
|
|
ORDER BY t1.card_order
|
|
</select>
|
|
|
|
<!-- 统计 -->
|
|
<select id="count" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
card_template_person t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
</select>
|
|
|
|
<update id="updateAllIsMain" parameterType="map">
|
|
UPDATE
|
|
card_template_person
|
|
SET
|
|
is_main = 0
|
|
WHERE
|
|
is_delete = 0
|
|
AND creator = #{modifier}
|
|
OR modifier = #{modifier}
|
|
</update>
|
|
|
|
</mapper> |