New file |
| | |
| | | <?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.FailureLoggingMapper"> |
| | | <resultMap id="resultMap" type="com.wgcloud.entity.FailureLogging"> |
| | | <id column="ID" property="id" jdbcType="CHAR" /> |
| | | <result column="OLD_DEVICE_NAME" property="oldDeviceName" jdbcType="CHAR" /> |
| | | <result column="OLD_DEVICE_IP" property="oldDeviceIp" jdbcType="CHAR" /> |
| | | <result column="OLD_DEVICE_MODEL" property="oldDeviceModel" jdbcType="CHAR" /> |
| | | <result column="NEW_DEVICE_NAME" property="newDeviceName" jdbcType="CHAR" /> |
| | | <result column="NEW_DEVICE_IP" property="newDeviceIp" jdbcType="CHAR" /> |
| | | <result column="NEW_DEVICE_MODEL" property="newDeviceModel" jdbcType="CHAR" /> |
| | | <result column="PERSON_NAME" property="personName" jdbcType="CHAR" /> |
| | | <result column="PERSON_DATE" property="personDate" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | |
| | | <sql id="tableColumnList"> |
| | | ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE |
| | | </sql> |
| | | |
| | | <select id="selectById" resultMap="resultMap" parameterType="java.lang.String"> |
| | | SELECT |
| | | <include refid="tableColumnList" /> |
| | | FROM FAILURE_LOGGING |
| | | WHERE ID=#{id} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> |
| | | DELETE FROM FAILURE_LOGGING |
| | | WHERE ID = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.String"> |
| | | DELETE FROM |
| | | FAILURE_LOGGING |
| | | WHERE ID IN |
| | | <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <insert id="save" parameterType="com.wgcloud.entity.WorkLogging"> |
| | | INSERT INTO FAILURE_LOGGING |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" >ID,</if> |
| | | <if test="oldDeviceName != null" >OLD_DEVICE_NAME,</if> |
| | | <if test="oldDeviceIp != null" >OLD_DEVICE_IP,</if> |
| | | <if test="oldDeviceModel != null" >OLD_DEVICE_MODEL,</if> |
| | | <if test="newDeviceName != null" >NEW_DEVICE_NAME,</if> |
| | | <if test="newDeviceIp != null" >NEW_DEVICE_IP,</if> |
| | | <if test="newDeviceModel != null" >NEW_DEVICE_MODEL,</if> |
| | | <if test="personName != null" >PERSON_NAME,</if> |
| | | <if test="personDate != null" >PERSON_DATE</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" >#{id},</if> |
| | | <if test="oldDeviceName != null" >#{oldDeviceName},</if> |
| | | <if test="oldDeviceIp != null" >#{oldDeviceIp},</if> |
| | | <if test="oldDeviceModel != null" >#{oldDeviceModel},</if> |
| | | <if test="newDeviceName != null" >#{newDeviceName},</if> |
| | | <if test="newDeviceIp != null" >#{newDeviceIp},</if> |
| | | <if test="newDeviceModel != null" >#{newDeviceModel},</if> |
| | | <if test="personName != null" >#{personName},</if> |
| | | <if test="personDate != null" >#{personDate}</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <insert id="insertList" parameterType="java.util.List" > |
| | | <choose> |
| | | <when test="_databaseId == 'oracle'"> |
| | | begin |
| | | <foreach collection="list" item="item" index="index"> |
| | | INSERT INTO FAILURE_LOGGING (ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE) VALUES |
| | | (#{item.id},#{item.oldDeviceName},#{item.oldDeviceIp},#{item.oldDeviceModel},#{item.newDeviceName},#{item.newDeviceIp},#{item.newDeviceModel},#{item.personName},#{item.personDate}); |
| | | </foreach> |
| | | end; |
| | | </when> |
| | | <otherwise> |
| | | INSERT INTO FAILURE_LOGGING (ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE) VALUES |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | (#{item.id},#{item.oldDeviceName},#{item.oldDeviceIp},#{item.oldDeviceModel},#{item.newDeviceName},#{item.newDeviceIp},#{item.newDeviceModel},#{item.personName},#{item.personDate}); |
| | | </foreach> |
| | | </otherwise> |
| | | </choose> |
| | | </insert> |
| | | |
| | | |
| | | <select id="countByParams" parameterType="map" resultType="java.lang.Integer"> |
| | | SELECT count(*) FROM FAILURE_LOGGING t |
| | | <where> |
| | | <include refid="queryByParams" /> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectAllByParams" parameterType="map" resultMap="resultMap"> |
| | | SELECT |
| | | <include refid="tableColumnList" /> |
| | | FROM FAILURE_LOGGING t |
| | | <where> |
| | | <include refid="queryByParams" /> |
| | | </where> |
| | | ORDER BY ID DESC |
| | | </select> |
| | | |
| | | <select id="selectByParams" parameterType="map" resultMap="resultMap"> |
| | | SELECT |
| | | <include refid="tableColumnList" /> |
| | | FROM FAILURE_LOGGING |
| | | <where> |
| | | <include refid="queryByParams" /> |
| | | </where> |
| | | <choose> |
| | | <when test="orderBy !=null and orderBy != ''"> |
| | | <![CDATA[ ORDER BY ${orderBy} ${orderType}]]> |
| | | </when> |
| | | <otherwise> |
| | | ORDER BY ID DESC |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </select> |
| | | |
| | | |
| | | </mapper> |