parent
3156b6e344
commit
fc445a8f33
@ -0,0 +1,42 @@
|
|||||||
|
package com.example.config;
|
||||||
|
|
||||||
|
import com.example.module.admin.ent.Mapping;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.system.ApplicationHome;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import xyz.wbsite.wsqlite.ObjectClient;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class SqliteConfig {
|
||||||
|
@Value("${dbpath}")
|
||||||
|
public String dbpath;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectClient registry() {
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(dbpath)) {
|
||||||
|
ApplicationHome home = new ApplicationHome(getClass());
|
||||||
|
// 当前运行jar文件
|
||||||
|
File jarFile = home.getSource() != null ? home.getSource() : home.getDir();
|
||||||
|
//jar同目录
|
||||||
|
dbpath = jarFile.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Class> objects = new ArrayList<>();
|
||||||
|
objects.add(Mapping.class);
|
||||||
|
return new ObjectClient(new File(dbpath,"data.db"), objects);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<project>
|
|
||||||
<projectName>EXAMPLE-WEB</projectName>
|
|
||||||
<projectBasePackage>com.example</projectBasePackage>
|
|
||||||
<projectAuthor>author</projectAuthor>
|
|
||||||
<modules>
|
|
||||||
<module>
|
|
||||||
<moduleComment>用户</moduleComment>
|
|
||||||
<modulePrefix>SYS</modulePrefix>
|
|
||||||
<moduleName>usermodel</moduleName>
|
|
||||||
<hasSysFields>true</hasSysFields>
|
|
||||||
<tables>
|
|
||||||
<table create="true" delete="true" find="true" get="true" getAll="false" search="false" tableComment="映射" tableName="MAPPING" update="true">
|
|
||||||
<fields>
|
|
||||||
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="false" defaultValue="NULL" fieldComment="用户名" fieldLength="100" fieldName="USERNAME" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
|
|
||||||
<field IsSystem="false" defaultValue="NULL" fieldComment="用户密码" fieldLength="100" fieldName="PASSWORD" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="NULL" fieldComment="创建时间" fieldLength="0" fieldName="CREATE_TIME" fieldType="Date" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="" fieldComment="最后更新用户" fieldLength="0" fieldName="LAST_UPDATE_BY" fieldType="Long" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
<field IsSystem="true" defaultValue="" fieldComment="最后更新时间" fieldLength="0" fieldName="LAST_UPDATE_TIME" fieldType="Date" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
|
|
||||||
</fields>
|
|
||||||
</table>
|
|
||||||
</tables>
|
|
||||||
</module>
|
|
||||||
</modules>
|
|
||||||
</project>
|
|
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for MAPPING - 映射
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE `SYSMAPPING` (
|
|
||||||
`ID` BIGINT(20) NOT NULL COMMENT '主键',
|
|
||||||
`USERNAME` VARCHAR(100) COMMENT '用户名',
|
|
||||||
`PASSWORD` VARCHAR(100) COMMENT '用户密码',
|
|
||||||
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
|
|
||||||
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
|
|
||||||
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
|
|
||||||
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
|
|
||||||
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
|
|
||||||
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
|
|
||||||
PRIMARY KEY (`ID`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='映射';
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
Target : MYSQL
|
|
||||||
Author
|
|
||||||
Date: 2019-08-14
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for USER - 用户
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
CREATE TABLE `SYSUSER` (
|
|
||||||
`ID` BIGINT(20) NOT NULL COMMENT '主键',
|
|
||||||
`USERNAME` VARCHAR(100) COMMENT '用户名',
|
|
||||||
`PASSWORD` VARCHAR(100) COMMENT '用户密码',
|
|
||||||
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
|
|
||||||
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
|
|
||||||
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
|
|
||||||
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
|
|
||||||
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
|
|
||||||
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
|
|
||||||
PRIMARY KEY (`ID`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户';
|
|
Binary file not shown.
@ -1,217 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
||||||
<#--baseJs-->
|
|
||||||
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
|
|
||||||
<#--移动端ui-->
|
|
||||||
<script src="${Uri.getUrl('/static/dist/mint-ui.min.js')}" type="text/javascript"></script>
|
|
||||||
<link href="${Uri.getUrl('/static/dist/mint-ui.min.css')}" rel="stylesheet"/>
|
|
||||||
<#--ajax接口-->
|
|
||||||
<script src="${Uri.getUrl('/static/js/ajax.js')}" type="text/javascript"></script>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,body,#app{
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-enter-active, .left-in-right-out-leave-active {
|
|
||||||
transition: all 0.3s linear;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-enter {
|
|
||||||
transform: translateX(-100%);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-leave-to {
|
|
||||||
transform: translateX(100%);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-enter-active, .right-in-left-out-leave-active {
|
|
||||||
transition: all .3s linear;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-enter {
|
|
||||||
transform: translateX(100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-leave-to {
|
|
||||||
transform: translateX(-100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-enter-active, .left-in-right-out-leave-active {
|
|
||||||
transition: all 0.3s linear;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-enter {
|
|
||||||
transform: translateX(-100%);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-in-right-out-leave-to {
|
|
||||||
transform: translateX(100%);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-enter-active, .right-in-left-out-leave-active {
|
|
||||||
transition: all .3s linear;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-enter {
|
|
||||||
transform: translateX(100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-in-left-out-leave-to {
|
|
||||||
transform: translateX(-100%);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<#include Layout.setControl("mint-ui-extend")/>
|
|
||||||
<div id="app">
|
|
||||||
<transition :name="transitionName">
|
|
||||||
<router-view></router-view>
|
|
||||||
</transition>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template id="home">
|
|
||||||
<div class="view">
|
|
||||||
<mt-header title="Hello world">
|
|
||||||
<router-link to="/" slot="left">
|
|
||||||
<mt-button icon="back">返回</mt-button>
|
|
||||||
</router-link>
|
|
||||||
<mt-button icon="more" slot="right"></mt-button>
|
|
||||||
</mt-header>
|
|
||||||
<div class="content" style="text-align: center;padding-top: 200px">
|
|
||||||
Hello world <router-link to="demo">demo</router-link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template id="demo">
|
|
||||||
<div class="view">
|
|
||||||
<mt-header title="表单输入">
|
|
||||||
<mt-button icon="back" slot="left" @click="back">关闭</mt-button>
|
|
||||||
</mt-header>
|
|
||||||
<div class="content" style="text-align: center;">
|
|
||||||
<mt-header title="Mint-ui自带控件"></mt-header>
|
|
||||||
<mt-field label="普通文字" placeholder="请输入用户名" v-model="field1"></mt-field>
|
|
||||||
<mt-field label="邮箱地址" placeholder="请输入邮箱" type="email" v-model="field2"></mt-field>
|
|
||||||
<mt-field label="用户密码" placeholder="请输入密码" type="password" v-model="field3"></mt-field>
|
|
||||||
<mt-field label="手机号码" placeholder="请输入手机号" type="tel" v-model="field4"></mt-field>
|
|
||||||
<mt-field label="网站链接" placeholder="请输入网址" type="url" v-model="field5"></mt-field>
|
|
||||||
<mt-field label="数字输入" placeholder="请输入数字" type="number" v-model="field6"></mt-field>
|
|
||||||
<mt-field label="生日日期" placeholder="请输入生日" type="date" v-model="field7"></mt-field>
|
|
||||||
<mt-field label="多行文字" placeholder="多行文字" type="textarea" rows="2" v-model="field8"></mt-field>
|
|
||||||
|
|
||||||
<mt-header title="扩展控件"></mt-header>
|
|
||||||
<wb-field-select label="文字选择" placeholder="请选择" :items="['男','女']" v-model="field10"></wb-field-select>
|
|
||||||
<wb-field-dict label="字典选择" placeholder="请选择" :items="[{key:'1',value:'男'},{key:'2',value:'女'}]"
|
|
||||||
v-model="field11"></wb-field-dict>
|
|
||||||
<wb-field-date label="日期选择" placeholder="请选择" v-model="field12"></wb-field-date>
|
|
||||||
<wb-field-time label="时间选择" placeholder="请选择" v-model="field13"></wb-field-time>
|
|
||||||
<wb-field-datetime label="日期时间" placeholder="请选择" v-model="field14"></wb-field-datetime>
|
|
||||||
<wb-field-cphm label="车牌号码" placeholder="车牌号" v-model="field15"></wb-field-cphm>
|
|
||||||
|
|
||||||
<wb-field-pictures label="选择照片" v-model="field16" @handle-file="handleFile"></wb-field-pictures>
|
|
||||||
|
|
||||||
<div style="padding: 10px">
|
|
||||||
<mt-button type="primary" size="large" @click="doSearch()">打印类容</mt-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var router = new VueRouter({
|
|
||||||
routes: [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
name: 'home',
|
|
||||||
component: Vue.extend({template: '#home'})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/demo',
|
|
||||||
name: 'demo',
|
|
||||||
component: Vue.extend({
|
|
||||||
template: '#demo',
|
|
||||||
mounted: function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
data: function () {
|
|
||||||
return {
|
|
||||||
field1: '',
|
|
||||||
field2: '',
|
|
||||||
field3: '',
|
|
||||||
field4: '',
|
|
||||||
field5: '',
|
|
||||||
field6: '',
|
|
||||||
field7: '',
|
|
||||||
field8: '',
|
|
||||||
field9: '',
|
|
||||||
field10: '',
|
|
||||||
field11: '',
|
|
||||||
field12: '',
|
|
||||||
field13: '',
|
|
||||||
field14: '',
|
|
||||||
field15: '',
|
|
||||||
field16: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
doSearch: function () {
|
|
||||||
console.log(this.field10);
|
|
||||||
console.log(this.field11);
|
|
||||||
console.log(this.field12);
|
|
||||||
console.log(this.field13);
|
|
||||||
console.log(this.field14);
|
|
||||||
console.log(this.field15);
|
|
||||||
console.log(this.field16);
|
|
||||||
},
|
|
||||||
back: function () {
|
|
||||||
if (window.android) {
|
|
||||||
android.finish()
|
|
||||||
} else {
|
|
||||||
location.href = "${Uri.getUrl('/app/index.htm')}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleFile: function (file, call) {
|
|
||||||
//do upload
|
|
||||||
console.log("正在上传文件" + file.name);
|
|
||||||
if (true) {
|
|
||||||
call.finish();
|
|
||||||
} else {
|
|
||||||
call.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
var app = new Vue({
|
|
||||||
el: '#app',
|
|
||||||
data: {
|
|
||||||
transitionName: ''
|
|
||||||
},
|
|
||||||
router: router,
|
|
||||||
watch: {
|
|
||||||
'$route': function (to, from) {
|
|
||||||
this.transitionName = to.meta.index < from.meta.index ? 'left-in-right-out' : 'right-in-left-out'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.example.mapping;
|
||||||
|
|
||||||
|
import com.example.frame.base.Token;
|
||||||
|
import com.example.frame.utils.IDgenerator;
|
||||||
|
import com.example.frame.utils.LocalData;
|
||||||
|
import com.example.module.admin.mgr.MappingManager;
|
||||||
|
import com.example.module.admin.req.MappingCreateRequest;
|
||||||
|
import com.example.module.admin.rsp.MappingCreateResponse;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import static junit.framework.TestCase.assertTrue;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class MappingTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MappingManager mappingManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Token token;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createMapping() {
|
||||||
|
MappingCreateRequest createRequest = new MappingCreateRequest();
|
||||||
|
createRequest.setName("测试");
|
||||||
|
createRequest.setValue("test");
|
||||||
|
MappingCreateResponse mappingCreateResponse = mappingManager.create(createRequest, token);
|
||||||
|
|
||||||
|
|
||||||
|
assertTrue(!mappingCreateResponse.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
package xyz.wbsite.wsqlite.entity;
|
||||||
|
|
||||||
|
import xyz.wbsite.wsqlite.anonation.TableField;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
|
||||||
|
@TableField(40)
|
||||||
|
private String s;
|
||||||
|
@TableField
|
||||||
|
private boolean b;
|
||||||
|
@TableField
|
||||||
|
private byte[] bs;
|
||||||
|
@TableField
|
||||||
|
private byte b1;
|
||||||
|
@TableField
|
||||||
|
private short s1;
|
||||||
|
@TableField
|
||||||
|
private char c1;
|
||||||
|
@TableField
|
||||||
|
private int age;
|
||||||
|
@TableField
|
||||||
|
private long id;
|
||||||
|
@TableField
|
||||||
|
private float f1;
|
||||||
|
@TableField
|
||||||
|
private double d1;
|
||||||
|
|
||||||
|
public String getS() {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setS(String s) {
|
||||||
|
this.s = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isB() {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(boolean b) {
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getBs() {
|
||||||
|
return bs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBs(byte[] bs) {
|
||||||
|
this.bs = bs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getB1() {
|
||||||
|
return b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB1(byte b1) {
|
||||||
|
this.b1 = b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getS1() {
|
||||||
|
return s1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setS1(short s1) {
|
||||||
|
this.s1 = s1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getC1() {
|
||||||
|
return c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC1(char c1) {
|
||||||
|
this.c1 = c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getF1() {
|
||||||
|
return f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setF1(float f1) {
|
||||||
|
this.f1 = f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getD1() {
|
||||||
|
return d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD1(double d1) {
|
||||||
|
this.d1 = d1;
|
||||||
|
}
|
||||||
|
}
|
@ -1,37 +0,0 @@
|
|||||||
package xyz.wbsite.wsqlite.entity;
|
|
||||||
|
|
||||||
import xyz.wbsite.wsqlite.anonation.TableField;
|
|
||||||
|
|
||||||
public class User {
|
|
||||||
|
|
||||||
@TableField(40)
|
|
||||||
private String name;
|
|
||||||
@TableField(40)
|
|
||||||
private String password;
|
|
||||||
@TableField
|
|
||||||
private boolean valid;
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValid(boolean valid) {
|
|
||||||
this.valid = valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
import xyz.wbsite.wsqlite.ObjectClient;
|
|
||||||
import xyz.wbsite.wsqlite.entity.User;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SqliteTest {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
try {
|
|
||||||
List<Class> arrayList = new ArrayList();
|
|
||||||
arrayList.add(User.class);
|
|
||||||
ObjectClient h = new ObjectClient(new File("D:\\test.db"),arrayList);
|
|
||||||
|
|
||||||
System.out.println("测试 insert");
|
|
||||||
User user = new User();
|
|
||||||
user.setName("wangbing");
|
|
||||||
user.setPassword("test");
|
|
||||||
h.insert(User.class, user);
|
|
||||||
|
|
||||||
System.out.println("测试 select");
|
|
||||||
List<User> select = h.select(User.class,1,10);
|
|
||||||
System.out.println(select.size());
|
|
||||||
|
|
||||||
System.out.println("测试 update");
|
|
||||||
user.setName("==");
|
|
||||||
user.setPassword("==");
|
|
||||||
int update = h.update(User.class, user);
|
|
||||||
System.out.println(update);
|
|
||||||
|
|
||||||
System.out.println("测试 delete");
|
|
||||||
int delete = h.delete(User.class,"NAME = '=='");
|
|
||||||
System.out.println(delete);
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue