<?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.wgcloud.mapper.InspectionTaskMapper">
|
<resultMap id="resultMap" type="com.wgcloud.entity.InspectionTask">
|
<id column="ID" property="id" jdbcType="CHAR" />
|
<result column="TITLE" property="title" jdbcType="CHAR" />
|
<result column="TYPE" property="type" jdbcType="CHAR" />
|
<result column="PERIOD" property="period" jdbcType="CHAR" />
|
<result column="SCOPE" property="scope" jdbcType="CHAR" />
|
<result column="START_DATE" property="startDate" jdbcType="CHAR" />
|
<result column="END_DATE" property="endDate" jdbcType="CHAR" />
|
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="IS_OK" property="isOk" jdbcType="CHAR" />
|
</resultMap>
|
|
<sql id="tableColumnList">
|
ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK
|
</sql>
|
|
<sql id="queryByParams">
|
<if test="title != null">
|
<![CDATA[ AND TITLE like '%'+#{title}+'%' ]]>
|
</if>
|
<if test="isOk != null">
|
<![CDATA[ AND IS_OK = #{isOk} ]]>
|
</if>
|
</sql>
|
|
<update id="updateById" parameterType="com.wgcloud.entity.InspectionTask">
|
UPDATE INSPECTION_TASK
|
<set>
|
<if test="title != null">
|
TITLE = #{title},
|
</if>
|
<if test="type != null">
|
TYPE = #{type},
|
</if>
|
<if test="period != null">
|
PERIOD = #{period},
|
</if>
|
<if test="scope != null">
|
SCOPE = #{scope},
|
</if>
|
<if test="startDate != null">
|
START_DATE = #{startDate},
|
</if>
|
<if test="endDate != null">
|
END_DATE = #{endDate},
|
</if>
|
<if test="createTime != null">
|
CREATE_TIME = #{createTime},
|
</if>
|
<if test="isOk != null">
|
IS_OK = #{isOk},
|
</if>
|
</set>
|
WHERE ID = #{id}
|
</update>
|
|
|
<select id="selectById" resultMap="resultMap" parameterType="java.lang.String">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM INSPECTION_TASK WHERE ID=#{id}
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
DELETE FROM INSPECTION_TASK WHERE ID = #{id}
|
</delete>
|
|
<delete id="deleteByAccountAndDate" parameterType="map">
|
DELETE FROM INSPECTION_TASK WHERE
|
<if test="_databaseId == 'mysql'">
|
<![CDATA[ CREATE_TIME <=#{endTime}]]>
|
</if>
|
<if test="_databaseId == 'postgresql'">
|
<![CDATA[ CREATE_TIME <= cast(#{endTime} as timestamp)]]>
|
</if>
|
</delete>
|
|
|
<delete id="deleteById" parameterType="java.lang.String">
|
DELETE FROM INSPECTION_TASK WHERE ID IN
|
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<insert id="insertList" parameterType="java.util.List" >
|
INSERT INTO INSPECTION_TASK (ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK) VALUES
|
<foreach collection="list" item="item" index="index" separator="," >
|
(#{item.id},#{item.title},#{item.type},#{item.period},#{item.scope},#{item.startDate},#{item.endDate},#{item.createTime},#{item.isOk})
|
</foreach>
|
</insert>
|
|
<insert id="save" parameterType="com.wgcloud.entity.IntrusionInfo">
|
INSERT INTO INSPECTION_TASK
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null" >ID,</if>
|
<if test="title != null" > TITLE,</if>
|
<if test="type != null">TYPE,</if>
|
<if test="period != null" >PERIOD,</if>
|
<if test="scope != null" >SCOPE,</if>
|
<if test="startDate != null" >START_DATE,</if>
|
<if test="endDate != null" >END_DATE,</if>
|
<if test="createTime != null" >CREATE_TIME</if>
|
<if test="isOk != null" >IS_OK</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null" >#{id},</if>
|
<if test="title != null" >#{title},</if>
|
<if test="type != null" >#{type},</if>
|
<if test="period != null" >#{period},</if>
|
<if test="scope != null" >#{scope},</if>
|
<if test="startDate != null" >#{startDate},</if>
|
<if test="endDate != null" >#{endDate},</if>
|
<if test="createTime != null" >#{createTime}</if>
|
<if test="isOk != null" >#{isOk}</if>
|
</trim>
|
</insert>
|
|
<select id="selectByAccountId" resultMap="resultMap" parameterType="java.lang.String">
|
SELECT
|
ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK
|
FROM INSPECTION_TASK
|
</select>
|
|
<select id="selectAllByParams" parameterType="map" resultMap="resultMap">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM INSPECTION_TASK t
|
<where>
|
<include refid="queryByParams" />
|
</where>
|
ORDER BY CREATE_TIME DESC
|
</select>
|
|
<select id="selectByParams" parameterType="map" resultMap="resultMap">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM INSPECTION_TASK
|
<where>
|
<include refid="queryByParams" />
|
</where>
|
ORDER BY CREATE_TIME DESC
|
</select>
|
|
<select id="selectByDate" parameterType="map" resultType="com.wgcloud.entity.InspectionTask">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM INSPECTION_TASK
|
<where>
|
1=1
|
<if test="startDate != null">
|
AND START_DATE > #{startDate}+' 00:00:00',
|
</if>
|
<if test="endDate != null">
|
<![CDATA[ and END_DATE < #{endDate}+' 23:59:59' ]]>
|
</if>
|
</where>
|
ORDER BY CREATE_TIME DESC
|
</select>
|
|
</mapper>
|