190 lines
6.4 KiB
XML
190 lines
6.4 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="com.cm.common.dao.templateconfig.ITemplateConfigDao">
|
|
|
|
<resultMap id="templateConfigDTO" type="com.cm.common.pojo.dtos.templateconfig.TemplateConfigDTO">
|
|
<id column="template_config_id" property="templateConfigId"/>
|
|
<result column="template_code" property="templateCode"/>
|
|
<result column="template_url" property="templateUrl"/>
|
|
<result column="template_name" property="templateName"/>
|
|
<result column="template_content" property="templateContent"/>
|
|
<result column="template_root_path" property="templateRootPath"/>
|
|
<result column="template_order" property="templateOrder"/>
|
|
<result column="template_file" property="templateFile"/>
|
|
<result column="template_all_generate" property="templateAllGenerate"/>
|
|
</resultMap>
|
|
|
|
<insert id="saveTemplateConfig" parameterType="map">
|
|
INSERT INTO template_config(
|
|
template_config_id,
|
|
template_code,
|
|
template_url,
|
|
template_name,
|
|
template_content,
|
|
template_root_path,
|
|
template_order,
|
|
template_file,
|
|
template_all_generate,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{templateConfigId},
|
|
#{templateCode},
|
|
#{templateUrl},
|
|
#{templateName},
|
|
#{templateContent},
|
|
#{templateRootPath},
|
|
#{templateOrder},
|
|
#{templateFile},
|
|
#{templateAllGenerate},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<update id="removeTemplateConfig" parameterType="map">
|
|
UPDATE
|
|
template_config
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
template_config_id IN
|
|
<foreach collection="templateConfigIds" index="index" open="(" separator="," close=")">
|
|
#{templateConfigIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="updateTemplateConfigContent" parameterType="map">
|
|
UPDATE
|
|
template_config
|
|
SET
|
|
<if test="templateContent != null and templateContent != ''">
|
|
template_content = #{templateContent},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
template_config_id = #{templateConfigId}
|
|
</update>
|
|
|
|
<update id="updateTemplateConfig" parameterType="map">
|
|
UPDATE
|
|
template_config
|
|
SET
|
|
<if test="templateCode != null and templateCode != ''">
|
|
template_code = #{templateCode},
|
|
</if>
|
|
<if test="templateUrl != null and templateUrl != ''">
|
|
template_url = #{templateUrl},
|
|
</if>
|
|
<if test="templateName != null and templateName != ''">
|
|
template_name = #{templateName},
|
|
</if>
|
|
<if test="templateContent != null and templateContent != ''">
|
|
template_content = #{templateContent},
|
|
</if>
|
|
<if test="templateRootPath != null and templateRootPath != ''">
|
|
template_root_path = #{templateRootPath},
|
|
</if>
|
|
<if test="templateOrder != null">
|
|
template_order = #{templateOrder},
|
|
</if>
|
|
<if test="templateFile != null and templateFile != ''">
|
|
template_file = #{templateFile},
|
|
</if>
|
|
<if test="templateAllGenerate != null and templateAllGenerate != ''">
|
|
template_all_generate = #{templateAllGenerate},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
template_config_id = #{templateConfigId}
|
|
</update>
|
|
|
|
<select id="getTemplateConfigByCode" parameterType="map" resultMap="templateConfigDTO">
|
|
SELECT
|
|
t1.template_code,
|
|
t1.template_url,
|
|
t1.template_name,
|
|
t1.template_content,
|
|
t1.template_root_path,
|
|
t1.template_order,
|
|
t1.template_config_id,
|
|
t1.template_file,
|
|
t1.template_all_generate
|
|
FROM
|
|
template_config t1
|
|
WHERE
|
|
t1.is_delete = 0 AND t1.template_code = #{templateCode}
|
|
</select>
|
|
|
|
<select id="getTemplateConfig" parameterType="map" resultMap="templateConfigDTO">
|
|
SELECT
|
|
t1.template_code,
|
|
t1.template_url,
|
|
t1.template_name,
|
|
t1.template_content,
|
|
t1.template_root_path,
|
|
t1.template_order,
|
|
t1.template_config_id,
|
|
t1.template_file,
|
|
t1.template_all_generate
|
|
FROM
|
|
template_config t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="templateConfigId != null and templateConfigId != ''">
|
|
AND
|
|
t1.template_config_id = #{templateConfigId}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="listTemplateConfig" parameterType="map" resultMap="templateConfigDTO">
|
|
SELECT
|
|
t1.template_code,
|
|
t1.template_url,
|
|
t1.template_name,
|
|
t1.template_content,
|
|
t1.template_root_path,
|
|
t1.template_order,
|
|
t1.template_config_id,
|
|
t1.template_file,
|
|
t1.template_all_generate
|
|
FROM
|
|
template_config t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND
|
|
(
|
|
t1.template_name 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="templateConfigIds != null and templateConfigIds.size > 0">
|
|
AND
|
|
t1.template_config_id IN
|
|
<foreach collection="templateConfigIds" index="index" open="(" separator="," close=")">
|
|
#{templateConfigIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY
|
|
t1.template_order
|
|
</select>
|
|
|
|
</mapper> |