src/com/javapandeng/mapper/NewsMapper.xml

(开头部分) 7KB

这里只显示每个文件的开头 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.javapandeng.mapper.NewsMapper">
    <!--实体类与数据库映射字段部分-->
    <resultMap id="ResultMapNews" type="com.javapandeng.po.News">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="content" column="content" jdbcType="VARCHAR"/>
        <result property="addTime" column="addTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <!-- 声明数据库字段 -->
    <sql id="News_field">
        id,name,content,addTime
    </sql>

    <!-- 实体类属性-->
    <sql id="News_insert">
        #{id},#{name},#{content},#{addTime}
    </sql>

    <!-- 更新结果  -->
    <sql id="News_update">
        <if test="name != null">
            name = #{name},
        </if>
        <if test="content != null">
            content = #{content},
        </if>
        <if test="addTime != null">
            addTime = #{addTime}
        </if>
    </sql>

    <!-- 查询时条件   -->
    <sql id="News_where">
        <if test="id != null">
            and id = #{id}
        </if>
        <if test="name != null">
            and name = #{name}
        </if>
        <if test="content != null">
            and content = #{content}
        </if>
        <if test="addTime != null">
            and addTime = #{addTime}
        </if>
    </sql>

    <!--    新增        -->
    <!--    参数:实体类-->
    <!--    返回:主键 -->
    <insert id="insert" parameterType="com.javapandeng.po.News" useGeneratedKeys="true" keyProperty="id">
        insert into news(
        <include refid="News_field"/>
        ) values(
        <include refid="News_insert"/>
        )
    </insert>
后面还有 165 行代码,购买后查看完整代码

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

AI 解读 AI

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

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