twoduty/src/main/resources/mybatis/mapper/indexTemplate/indexTemplate-mapper.xml
2021-04-15 17:10:32 +08:00

309 lines
11 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.tenlion.twoduty.dao.indextemplate.IIndexTemplateDao">
<resultMap id="indexTemplateDTO" type="com.tenlion.twoduty.pojo.dtos.indextemplate.IndexTemplateDTO">
<result column="index_template_id" property="indexTemplateId"/>
<result column="index_template_name" property="indexTemplateName"/>
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
</resultMap>
<resultMap id="indexTemplateBO" type="com.tenlion.twoduty.pojo.bos.indextemplate.IndexTemplateBO">
<result column="index_template_id" property="indexTemplateId"/>
<result column="index_template_name" property="indexTemplateName"/>
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="indexTemplatePO" type="com.tenlion.twoduty.pojo.pos.indextemplate.IndexTemplatePO">
<result column="index_template_id" property="indexTemplateId"/>
<result column="index_template_name" property="indexTemplateName"/>
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO duty_index_template(
index_template_id,
index_template_name,
index_template_save_path,
index_template_upload_path,
index_template_list_path,
index_template_table_name,
index_template_remark,
index_template_state,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{indexTemplateId},
#{indexTemplateName},
#{indexTemplateSavePath},
#{indexTemplateUploadPath},
#{indexTemplateListPath},
#{indexTemplateTableName}
#{indexTemplateRemark},
#{indexTemplateState},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
duty_index_template
WHERE
index_template_id IN
<foreach collection="indexTemplateIds" index="index" open="(" separator="," close=")">
#{indexTemplateIds[${index}]}
</foreach>
</update>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
duty_index_template
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
index_template_id IN
<foreach collection="indexTemplateIds" index="index" open="(" separator="," close=")">
#{indexTemplateIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
duty_index_template
SET
<if test="indexTemplateState != null and indexTemplateState != ''">
index_template_state = #{indexTemplateState},
</if>
index_template_name = #{indexTemplateName},
index_template_save_path = #{indexTemplateSavePath},
index_template_upload_path = #{indexTemplateUploadPath},
index_template_list_path = #{indexTemplateListPath},
index_template_table_name = #{indexTemplateTableName},
index_template_remark = #{indexTemplateRemark},
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
index_template_id = #{indexTemplateId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="indexTemplateDTO">
SELECT
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.index_template_id
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="indexTemplateId != null and indexTemplateId != ''">
AND
t1.index_template_id = #{indexTemplateId}
</if>
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="indexTemplateBO">
SELECT
t1.index_template_id,
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="indexTemplateId != null and indexTemplateId != ''">
AND
t1.index_template_id = #{indexTemplateId}
</if>
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="indexTemplatePO">
SELECT
t1.index_template_id,
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="indexTemplateId != null and indexTemplateId != ''">
AND
t1.index_template_id = #{indexTemplateId}
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="indexTemplateDTO">
SELECT
t1.index_template_id,
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.index_template_name LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="indexTemplateIds != null and indexTemplateIds.size > 0">
AND
t1.index_template_id IN
<foreach collection="indexTemplateIds" index="index" open="(" separator="," close=")">
#{indexTemplateIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="indexTemplateBO">
SELECT
t1.index_template_id,
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.index_template_name LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="indexTemplateIds != null and indexTemplateIds.size > 0">
AND
t1.index_template_id IN
<foreach collection="indexTemplateIds" index="index" open="(" separator="," close=")">
#{indexTemplateIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="indexTemplatePO">
SELECT
t1.index_template_id,
t1.index_template_name,
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.index_template_name LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="indexTemplateIds != null and indexTemplateIds.size > 0">
AND
t1.index_template_id IN
<foreach collection="indexTemplateIds" index="index" open="(" separator="," close=")">
#{indexTemplateIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
duty_index_template t1
WHERE
t1.is_delete = 0
</select>
</mapper>