THiddenLibraryMapper.xml 2.67 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
<?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.zehong.system.mapper.THiddenLibraryMapper">
    
    <resultMap type="THiddenLibrary" id="THiddenLibraryResult">
        <result property="libraryId"    column="library_id"    />
        <result property="libraryName"    column="library_name"    />
        <result property="libraryContent"    column="library_content"    />
    </resultMap>

    <sql id="selectTHiddenLibraryVo">
        select library_id, library_name, library_content from t_hidden_library
    </sql>

    <select id="selectTHiddenLibraryList" parameterType="THiddenLibrary" resultMap="THiddenLibraryResult">
        <include refid="selectTHiddenLibraryVo"/>
        <where>  
            <if test="libraryName != null  and libraryName != ''"> and library_name like concat('%', #{libraryName}, '%')</if>
        </where>
    </select>
    
    <select id="selectTHiddenLibraryById" parameterType="Long" resultMap="THiddenLibraryResult">
        <include refid="selectTHiddenLibraryVo"/>
        where library_id = #{libraryId}
    </select>
        
    <insert id="insertTHiddenLibrary" parameterType="THiddenLibrary" useGeneratedKeys="true" keyProperty="libraryId">
        insert into t_hidden_library
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="libraryName != null and libraryName != ''">library_name,</if>
            <if test="libraryContent != null and libraryContent != ''">library_content,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="libraryName != null and libraryName != ''">#{libraryName},</if>
            <if test="libraryContent != null and libraryContent != ''">#{libraryContent},</if>
         </trim>
    </insert>

    <update id="updateTHiddenLibrary" parameterType="THiddenLibrary">
        update t_hidden_library
        <trim prefix="SET" suffixOverrides=",">
            <if test="libraryName != null and libraryName != ''">library_name = #{libraryName},</if>
            <if test="libraryContent != null and libraryContent != ''">library_content = #{libraryContent},</if>
        </trim>
        where library_id = #{libraryId}
    </update>

    <delete id="deleteTHiddenLibraryById" parameterType="Long">
        delete from t_hidden_library where library_id = #{libraryId}
    </delete>

    <delete id="deleteTHiddenLibraryByIds" parameterType="String">
        delete from t_hidden_library where library_id in 
        <foreach item="libraryId" collection="array" open="(" separator="," close=")">
            #{libraryId}
        </foreach>
    </delete>
</mapper>