All Downloads are FREE. Search and download functionalities are using the official Maven repository.

oftendb.test1mapper.IHelloDao.xml Maven / Gradle / Ivy

<?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="$[mapperDaoClass]">

    <!--****************引入子页面、变量设置***************-->
    <!--$json:{tableName:'hello'}-->
    <!--$path:./include/base.xml-->

    <update id="initTable">
        CREATE TABLE IF NOT EXISTS `hello` (  `id` char(21) NOT NULL,
          `name` varchar(35) NOT NULL,
          `createtime` datetime NOT NULL,
          PRIMARY KEY (`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    </update>

    <insert id="add" parameterType="Hello">
        INSERT INTO `$[tableName]` (`id`,`name`,`createtime`) VALUES(#{id},#{name},#{createtime});
    </insert>

    <delete id="clearAll">
        DELETE FROM `$[tableName]`;
    </delete>

    <select id="count" resultType="int">
        SELECT COUNT(*) FROM `$[tableName]` WHERE `name`=#{name};
    </select>

    <select id="listAll" resultType="$[entity]">
        SELECT * FROM `$[tableName]`;
    </select>

    <delete id="deleteByName">
        DELETE FROM `$[tableName]` WHERE `name`=#{name};
    </delete>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy