src/main/resources/mybatis/mapper/NoticeMapper.xml

(完整代码) 1KB

<?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.huawei.mapper.NoticeMapper">

    <resultMap id="noticeMap" type="com.huawei.vo.Notice">
        <id property="tid" column="tid"></id>
        <result property="title" column="title"></result>
        <result property="date" column="date"></result>

        <association property="manager" column="mid" javaType="com.huawei.vo.Manager">
            <id property="did" column="did"></id>
            <result property="name" column="mname"></result>
        </association>
    </resultMap>

    <select id="findAllNotices" resultMap="noticeMap">
        SELECT a.tid, a.title,m.mname,a.date
        FROM announcement a, manager m
        WHERE a.mid = m.mid
    </select>

    <select id="findNoticeById" parameterType="Integer" resultType="com.huawei.vo.Notice">
        SELECT *
        FROM announcement
        WHERE tid = #{tid}
    </select>

    <update id="updateNotice" parameterType="com.huawei.vo.Notice">
        UPDATE announcement
        SET tid = #{tid},title = #{title},mid = #{mid},content=#{content},date = #{date}
        WHERE tid = #{tid}
    </update>

    <delete id="delNoticeById" parameterType="Integer">
        DELETE
        FROM announcement
        WHERE tid = #{tid}
    </delete>

    <insert id="addNotice" parameterType="com.huawei.vo.Notice">
        INSERT INTO
        announcement(tid,title,mid,content,date)
        VALUES
        (#{tid},#{title},#{mid},#{content},#{date})
    </insert>

</mapper>

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。