<?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.yssh.mapper.DictRecordMapper">
|
|
<resultMap id="DictRecordResult" type="com.yssh.entity.DictRecord">
|
<id property="id" column="id" />
|
<result property="tableName" column="table_name" />
|
<result property="createTime" column="create_time" />
|
<result property="remarks" column="remarks" />
|
</resultMap>
|
|
<sql id="selectDictRecordVo">
|
SELECT id, table_name, create_time
|
FROM dict_record
|
</sql>
|
|
<select id="selectDictRecordList" parameterType="com.yssh.entity.DictRecord" resultMap="DictRecordResult">
|
<include refid="selectDictRecordVo"/>
|
<where>
|
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
</where>
|
ORDER BY create_time ASC
|
</select>
|
|
<select id="selectByCreateTime" parameterType="Long" resultMap="DictRecordResult">
|
SELECT id, table_name, create_time
|
FROM dict_record
|
WHERE create_time = #{createTime}
|
LIMIT 0, 1
|
</select>
|
|
<select id="selectByTime" resultMap="DictRecordResult">
|
SELECT id, table_name, create_time
|
FROM dict_record
|
where str_to_date(create_time, '%Y%m%d%H') between #{start} and #{end}
|
order by create_time;
|
</select>
|
|
<select id="selectByTimeDictRecordList" resultMap="DictRecordResult">
|
SELECT id, table_name, create_time
|
FROM dict_record
|
WHERE create_time > #{startTime}
|
AND create_time <= #{endTime}
|
ORDER BY create_time ASC
|
</select>
|
|
<insert id="insertDictRecord" parameterType="com.yssh.entity.DictRecord" useGeneratedKeys="true" keyProperty="id">
|
insert into dict_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="tableName != null and tableName != ''">table_name,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="remarks != null">remarks,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="tableName != null and tableName != ''">#{tableName},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="remarks != null">#{remarks},</if>
|
</trim>
|
</insert>
|
|
<delete id="deleteDictRecordById" parameterType="Long">
|
delete from dict_record where id = #{id}
|
</delete>
|
|
<delete id="deleteDictRecordByIds" parameterType="Long">
|
delete from dict_record where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<!--创建表的 SQL 语句-->
|
<update id="createDictRecoTable">
|
CREATE TABLE `dict_record` (
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
`table_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表名称',
|
`create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
|
`remarks` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
|
PRIMARY KEY (`id`) USING BTREE
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
</update>
|
</mapper>
|