128 lines
4.5 KiB
XML
128 lines
4.5 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.nis.web.dao.basics.InnerProtectionDao" >
|
||
|
|
|
||
|
|
<resultMap id="ProtectionListInfoMap" type="com.nis.domain.basics.ProtectionListInfo" >
|
||
|
|
<id column="id" property="proId" jdbcType="INTEGER" />
|
||
|
|
<result column="keyword" property="keyword" jdbcType="VARCHAR" />
|
||
|
|
<result column="target_type" property="targetType" jdbcType="VARCHAR" />
|
||
|
|
<result column="description" property="description" jdbcType="VARCHAR" />
|
||
|
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||
|
|
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||
|
|
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||
|
|
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="ProtectionListInfoColumns">
|
||
|
|
r.id,r.keyword,r.target_type,r.description,r.create_time,r.edit_time,r.creator_id,r.editor_id
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<!-- 查出所有 有效数据-->
|
||
|
|
<select id="findProtectionInfoList" resultMap="ProtectionListInfoMap">
|
||
|
|
SELECT
|
||
|
|
<include refid="ProtectionListInfoColumns"/>
|
||
|
|
<trim prefix="," prefixOverrides=",">
|
||
|
|
,s.name as creator_name ,e.name as editor_name
|
||
|
|
</trim>
|
||
|
|
FROM inner_protection_list r
|
||
|
|
left join sys_user s on r.creator_id=s.id
|
||
|
|
left join sys_user e on r.editor_id=e.id
|
||
|
|
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||
|
|
<if test="page !=null and page.where != null and page.where != ''">
|
||
|
|
AND ${page.where}
|
||
|
|
</if>
|
||
|
|
<if test="keyword != null and keyword != ''">
|
||
|
|
AND r.keyword like CONCAT(CONCAT('%',#{keyword,jdbcType=VARCHAR}),'%')
|
||
|
|
</if>
|
||
|
|
<if test="targetType != null">
|
||
|
|
AND r.target_type like CONCAT(CONCAT('%',#{targetType,jdbcType=VARCHAR}),'%')
|
||
|
|
</if>
|
||
|
|
AND r.IS_VALID = 1
|
||
|
|
<if test="creatorName != null and creatorName != ''">
|
||
|
|
AND r.creator_name like CONCAT(CONCAT('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||
|
|
</if>
|
||
|
|
<if test="editorName != null and editorName != ''">
|
||
|
|
AND r.editor_name like CONCAT(CONCAT('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||
|
|
</if>
|
||
|
|
<!-- 数据范围过滤 -->
|
||
|
|
<!-- ${sqlMap.dsf} -->
|
||
|
|
</trim>
|
||
|
|
<choose>
|
||
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||
|
|
ORDER BY ${page.orderBy}
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
ORDER BY r.id DESC
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getById" resultMap="ProtectionListInfoMap">
|
||
|
|
SELECT
|
||
|
|
<include refid="ProtectionListInfoColumns"/>
|
||
|
|
FROM
|
||
|
|
inner_protection_list r
|
||
|
|
WHERE
|
||
|
|
r.ID = #{proId} AND r.IS_VALID = 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insert" parameterType="com.nis.domain.basics.ProtectionListInfo" >
|
||
|
|
INSERT INTO inner_protection_list(
|
||
|
|
KEYWORD,
|
||
|
|
TARGET_TYPE,
|
||
|
|
DESCRIPTION,
|
||
|
|
IS_VALID,
|
||
|
|
CREATOR_ID,
|
||
|
|
CREATE_TIME
|
||
|
|
)VALUES (
|
||
|
|
#{keyword,jdbcType=VARCHAR},
|
||
|
|
#{targetType,jdbcType=VARCHAR},
|
||
|
|
#{description,jdbcType=VARCHAR},
|
||
|
|
#{isValid,jdbcType=INTEGER},
|
||
|
|
#{creatorId,jdbcType=INTEGER},
|
||
|
|
#{createTime,jdbcType=TIMESTAMP}
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="update" parameterType="com.nis.domain.basics.ProtectionListInfo" >
|
||
|
|
update inner_protection_list
|
||
|
|
<set >
|
||
|
|
<trim suffixOverrides=",">
|
||
|
|
<if test="keyword != null and keyword != ''" >
|
||
|
|
keyword = #{keyword,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="targetType != null and targetType != ''" >
|
||
|
|
target_type = #{targetType,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="description != null and description != ''" >
|
||
|
|
description = #{description,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="isValid != null" >
|
||
|
|
is_valid = #{isValid,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="editorId != null" >
|
||
|
|
editor_id = #{editorId,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="editTime != null and editTime != ''" >
|
||
|
|
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
</set>
|
||
|
|
<where>
|
||
|
|
<if test="proId != null" >
|
||
|
|
AND id = #{proId,jdbcType=INTEGER}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="ajaxGetAllInfo" resultType="com.nis.domain.basics.ProtectionListInfo">
|
||
|
|
SELECT
|
||
|
|
<include refid="ProtectionListInfoColumns"/>
|
||
|
|
FROM
|
||
|
|
inner_protection_list r
|
||
|
|
WHERE
|
||
|
|
r.IS_VALID = 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|