<?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.whyc.mapper.LicenseMapper" >
|
<insert id="add" parameterType="com.whyc.pojo.License">
|
REPLACE into web_site.tb_license(id,serialNumber,duration,timeInUse) values(1,#{license.serialNumber},#{license.duration},#{license.timeInUse})
|
</insert>
|
<update id="createTable">
|
CREATE TABLE `web_site`.`tb_license` (
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`serialNumber` varchar(255) NOT NULL DEFAULT '',
|
`duration` varchar(255) NOT NULL DEFAULT '',
|
`timeInUse` varchar(255) NOT NULL DEFAULT '',
|
PRIMARY KEY (`id`) USING BTREE
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ;
|
</update>
|
<update id="reCreateTable">
|
DROP TABLE IF EXISTS `web_site`.`tb_license`;
|
CREATE TABLE `web_site`.`tb_license` (
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`serialNumber` varchar(255) NOT NULL DEFAULT '',
|
`duration` varchar(255) NOT NULL DEFAULT '',
|
`timeInUse` varchar(255) NOT NULL DEFAULT '',
|
PRIMARY KEY (`id`) USING BTREE
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ;
|
</update>
|
<update id="updateTimeInUse">
|
update web_site.tb_license set timeInUse = #{timeInUse}
|
</update>
|
|
|
<select id="selectExist" resultType="java.lang.Integer">
|
select count(*) num from information_schema.TABLES t where t.TABLE_SCHEMA ='web_site' and t.TABLE_NAME ='tb_license'
|
</select>
|
<select id="existColumn" resultType="java.lang.Integer">
|
select count(*) num from information_schema.COLUMNS t where t.TABLE_SCHEMA ='web_site' and t.TABLE_NAME ='tb_license' and
|
t.column_name = 'duration' limit 1
|
</select>
|
<select id="selectOne" resultType="com.whyc.pojo.License">
|
select * from web_site.tb_license limit 1
|
</select>
|
</mapper>
|