zoukankan      html  css  js  c++  java
  • 基于javaEE的简单教务系统实现(八)

    <?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.system.mapper.SelectedcourseMapper" >
      <resultMap id="BaseResultMap" type="com.system.po.Selectedcourse" >
        <result column="courseID" property="courseid" jdbcType="INTEGER" />
        <result column="studentID" property="studentid" jdbcType="INTEGER" />
        <result column="mark" property="mark" jdbcType="INTEGER" />
      </resultMap>
      <sql id="Example_Where_Clause" >
        <where >
          <foreach collection="oredCriteria" item="criteria" separator="or" >
            <if test="criteria.valid" >
              <trim prefix="(" suffix=")" prefixOverrides="and" >
                <foreach collection="criteria.criteria" item="criterion" >
                  <choose >
                    <when test="criterion.noValue" >
                      and ${criterion.condition}
                    </when>
                    <when test="criterion.singleValue" >
                      and ${criterion.condition} #{criterion.value}
                    </when>
                    <when test="criterion.betweenValue" >
                      and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                    </when>
                    <when test="criterion.listValue" >
                      and ${criterion.condition}
                      <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                        #{listItem}
                      </foreach>
                    </when>
                  </choose>
                </foreach>
              </trim>
            </if>
          </foreach>
        </where>
      </sql>
      <sql id="Update_By_Example_Where_Clause" >
        <where >
          <foreach collection="example.oredCriteria" item="criteria" separator="or" >
            <if test="criteria.valid" >
              <trim prefix="(" suffix=")" prefixOverrides="and" >
                <foreach collection="criteria.criteria" item="criterion" >
                  <choose >
                    <when test="criterion.noValue" >
                      and ${criterion.condition}
                    </when>
                    <when test="criterion.singleValue" >
                      and ${criterion.condition} #{criterion.value}
                    </when>
                    <when test="criterion.betweenValue" >
                      and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                    </when>
                    <when test="criterion.listValue" >
                      and ${criterion.condition}
                      <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                        #{listItem}
                      </foreach>
                    </when>
                  </choose>
                </foreach>
              </trim>
            </if>
          </foreach>
        </where>
      </sql>
      <sql id="Base_Column_List" >
        courseID, studentID, mark
      </sql>
      <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.system.po.SelectedcourseExample" >
        select
        <if test="distinct" >
          distinct
        </if>
        <include refid="Base_Column_List" />
        from selectedcourse
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
        <if test="orderByClause != null" >
          order by ${orderByClause}
        </if>
      </select>
      <delete id="deleteByExample" parameterType="com.system.po.SelectedcourseExample" >
        delete from selectedcourse
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
      </delete>
      <insert id="insert" parameterType="com.system.po.Selectedcourse" >
        insert into selectedcourse (courseID, studentID, mark
          )
        values (#{courseid,jdbcType=INTEGER}, #{studentid,jdbcType=INTEGER}, #{mark,jdbcType=INTEGER}
          )
      </insert>
      <insert id="insertSelective" parameterType="com.system.po.Selectedcourse" >
        insert into selectedcourse
        <trim prefix="(" suffix=")" suffixOverrides="," >
          <if test="courseid != null" >
            courseID,
          </if>
          <if test="studentid != null" >
            studentID,
          </if>
          <if test="mark != null" >
            mark,
          </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
          <if test="courseid != null" >
            #{courseid,jdbcType=INTEGER},
          </if>
          <if test="studentid != null" >
            #{studentid,jdbcType=INTEGER},
          </if>
          <if test="mark != null" >
            #{mark,jdbcType=INTEGER},
          </if>
        </trim>
      </insert>
      <select id="countByExample" parameterType="com.system.po.SelectedcourseExample" resultType="java.lang.Integer" >
        select count(*) from selectedcourse
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
      </select>
      <update id="updateByExampleSelective" parameterType="map" >
        update selectedcourse
        <set >
          <if test="record.courseid != null" >
            courseID = #{record.courseid,jdbcType=INTEGER},
          </if>
          <if test="record.studentid != null" >
            studentID = #{record.studentid,jdbcType=INTEGER},
          </if>
          <if test="record.mark != null" >
            mark = #{record.mark,jdbcType=INTEGER},
          </if>
        </set>
        <if test="_parameter != null" >
          <include refid="Update_By_Example_Where_Clause" />
        </if>
      </update>
      <update id="updateByExample" parameterType="map" >
        update selectedcourse
        set courseID = #{record.courseid,jdbcType=INTEGER},
          studentID = #{record.studentid,jdbcType=INTEGER},
          mark = #{record.mark,jdbcType=INTEGER}
        <if test="_parameter != null" >
          <include refid="Update_By_Example_Where_Clause" />
        </if>
      </update>
    </mapper>
  • 相关阅读:
    哈希表
    矩阵加速(数列)
    线段树
    python
    vue 中防抖
    Windows版本与Internet Explorer版本对照
    一个怂女婿的成长笔记【二十三】
    一个怂女婿的成长笔记【二十一】
    vue xml数据格式化展示,展示在textarea里可编辑,和高亮处理方法
    substring 截取 第三个字符(/)后的字符串
  • 原文地址:https://www.cnblogs.com/520520520zl/p/14894320.html
Copyright © 2011-2022 走看看