70 lines
3.1 KiB
XML
70 lines
3.1 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.bonus.system.mapper.SysWarningMapper">
|
||
|
|
|
||
|
|
<resultMap id="SysWarningResult" type="com.bonus.system.warning.SysWarning">
|
||
|
|
<id property="warningId" column="warning_id" />
|
||
|
|
<result property="warningEvent" column="warning_event" />
|
||
|
|
<result property="warningContent" column="warning_content" />
|
||
|
|
<result property="warningIp" column="warning_ip" />
|
||
|
|
<result property="warningGrade" column="warning_grade" />
|
||
|
|
<result property="operaUserName" column="opera_user_name" />
|
||
|
|
<result property="warningTime" column="warning_time" />
|
||
|
|
<result property="warningStatus" column="warning_status" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 使用 resultMap 的查询操作 -->
|
||
|
|
<select id="selectWarningList" parameterType="com.bonus.system.warning.SysWarning" resultMap="SysWarningResult">
|
||
|
|
SELECT
|
||
|
|
warning_id,
|
||
|
|
warning_event,
|
||
|
|
warning_content,
|
||
|
|
warning_ip,
|
||
|
|
warning_grade,
|
||
|
|
opera_user_name,
|
||
|
|
warning_time,
|
||
|
|
warning_status
|
||
|
|
FROM sys_warning
|
||
|
|
where
|
||
|
|
<if test="warning_status != null and warning_status != 0">
|
||
|
|
AND u.warning_status = #{warningStatus}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectWarningById" parameterType="Long" resultMap="SysWarningResult">
|
||
|
|
where u.warning_id = #{warningId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertWarning" parameterType="com.bonus.system.warning.SysWarning" useGeneratedKeys="true" keyProperty="warningId">
|
||
|
|
insert into sys_warning(
|
||
|
|
<if test=" warningId!= null and warningId != 0">warning_id,</if>
|
||
|
|
<if test="warningEvent != null and warningEvent != ''">warning_event,</if>
|
||
|
|
<if test="warningContent != null and warningContent != ''">warning_content,</if>
|
||
|
|
<if test="warningIp != null and warningIp != ''">warning_ip,</if>
|
||
|
|
<if test="warningGrade != null and warningGrade != ''">warning_grade,</if>
|
||
|
|
<if test="operaUserName != null and operaUserName != ''">opera_user_name,</if>
|
||
|
|
warning_time,
|
||
|
|
<if test="warningStatus != null and warningStatus != ''">warning_status,</if>
|
||
|
|
)values(
|
||
|
|
<if test=" warningId!= null and warningId != ''">#{warningId},</if>
|
||
|
|
<if test="warningEvent != null and warningEvent != ''">#{warningEvent},</if>
|
||
|
|
<if test="warningContent != null and warningContent != ''">#{warningContent},</if>
|
||
|
|
<if test="warningIp != null and warningIp != ''">#{warningIp},</if>
|
||
|
|
<if test="warningGrade != null and warningGrade != ''">#{warningGrade},</if>
|
||
|
|
<if test="operaUserName != null and operaUserName != ''">#{operaUserName},</if>
|
||
|
|
sysdate,
|
||
|
|
<if test="warningStatus != null and warningStatus != ''">#{warningStatus},</if>
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateWarningStatus" parameterType="com.bonus.system.warning.SysWarning">
|
||
|
|
update sys_warning
|
||
|
|
set warning_status = #{warningStatus}
|
||
|
|
where warning_id = #{warningId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
|
||
|
|
</mapper>
|