zoukankan      html  css  js  c++  java
  • 配置文件一mapper.xml

    <?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="dao.AreaDao">
    
        <select id="queryArea" resultType="entity.Area">
            SELECT area_id,
                   area_name,
                   area_desc,
                   priority,
                   create_time,
                   last_edit_time
            FROM tb_area
            ORDER BY priority DESC
        </select>
    
        <insert id="insertArea" useGeneratedKeys="true" keyProperty="areaId" keyColumn="area_id">
            INSERT INTO tb_area(area_name, area_desc, priority,
                                create_time, last_edit_time)
            VALUES (#{areaName}, #{areaDesc}, #{priority},
                    #{createTime}, #{lastEditTime})
        </insert>
    
        <update id="updateArea" parameterType="entity.Area">
            update tb_area
            <set>
                <if test="areaName != null">area_name=#{areaName},</if>
                <if test="areaDesc != null">area_desc=#{areaDesc},</if>
                <if test="priority != null">priority=#{priority},</if>
                <if test="lastEditTime != null">last_edit_time=#{lastEditTime}</if>
            </set>
            where area_id=#{areaId}
        </update>
    
        <delete id="deleteArea">
            DELETE
            FROM tb_area
            WHERE area_id =
                  #{areaId}
        </delete>
    
        <delete id="batchDeleteArea" parameterType="long">
            DELETE FROM
            tb_area
            WHERE area_id IN
            <foreach collection="list" item="areaId" open="(" separator=","
                     close=")">
                #{areaId}
            </foreach>
        </delete>
    
    </mapper>
    
  • 相关阅读:
    SQL Server 存储过程
    SQL数据类型介绍
    XML文件操作指南
    C# 程序集 与 反射
    详解C#中System.IO.File类和System.IO.FileInfo类的用法
    C# 之泛型详解
    C#中HashTable的用法示例2
    C#中HashTable的用法示例1
    DEDECMS5.7 首页和栏目页调用文章按权重排序
    linux创建用户,指定组
  • 原文地址:https://www.cnblogs.com/loveer/p/11335308.html
Copyright © 2011-2022 走看看