<?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.javaweb.cms.mapper.FriendLinkMapper">
|
|
<resultMap type="FriendLink" id="FriendLinkResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="link" column="link" />
|
<result property="logo" column="logo" />
|
<result property="auditState" column="audit_state" />
|
</resultMap>
|
|
<sql id="selectFriendLinkVo">
|
select id, name, link,description, logo, audit_state from cms_friend_link
|
</sql>
|
|
<select id="selectFriendLinkList" parameterType="FriendLink"
|
resultMap="FriendLinkResult">
|
<include refid="selectFriendLinkVo" />
|
<where>
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="auditState != null "> and audit_state = #{auditState}</if>
|
</where>
|
</select>
|
|
<select id="selectFriendLinkById" parameterType="Long"
|
resultMap="FriendLinkResult">
|
<include refid="selectFriendLinkVo" />
|
where id = #{id}
|
</select>
|
|
<insert id="insertFriendLink" parameterType="FriendLink"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into cms_friend_link
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="name != null and name != ''">name,</if>
|
<if test="link != null and link != ''">link,</if>
|
<if test="description != null and description != ''">description,</if>
|
<if test="logo != null and logo != ''">logo,</if>
|
<if test="auditState != null ">audit_state,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="name != null and name != ''">#{name},</if>
|
<if test="link != null and link != ''">#{link},</if>
|
<if test="description != null and description != ''">#{description},</if>
|
<if test="logo != null and logo != ''">#{logo},</if>
|
<if test="auditState != null ">#{auditState},</if>
|
</trim>
|
</insert>
|
|
<update id="updateFriendLink" parameterType="FriendLink">
|
update cms_friend_link
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="name != null and name != ''">name = #{name},</if>
|
<if test="link != null and link != ''">link = #{link},</if>
|
<if test="description != null and description != ''">description = #{description},</if>
|
<if test="logo != null and logo != ''">logo = #{logo},</if>
|
<if test="auditState != null ">audit_state = #{auditState},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteFriendLinkById" parameterType="Long">
|
delete from cms_friend_link where id = #{id}
|
</delete>
|
|
<delete id="deleteFriendLinkByIds" parameterType="String">
|
delete from cms_friend_link where id in
|
<foreach item="id" collection="array" open="(" separator=","
|
close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|