-- 创建数据表
create table if not exists user (
id int not null auto_increment comment 'ID',
username varchar(255) not null comment '姓名',
age int not null comment '密码',
primary key (id)
) engine=InnoDB default CHARSET=utf8;
-- 初始化数据
insert into user values ('1','张三',17);
insert into user values ('2','李四',18);
insert into user values ('3','王五',19);
package com.cloud.domain;
public class User {
private Long id;
private String username;
private Integer age;
public long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}
(5)创建Dao
package com.cloud.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.cloud.domain.User;
@Mapper
public interface UserDao {
@Select("select id,username,age from user")
List findAll();
}
(6)创建Service
package com.cloud.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cloud.dao.UserDao;
import com.cloud.domain.User;
@Service
public class UserService {
@Autowired
private UserDao userDao;
@Override
public List findAll() {
return userDao.findAll();
}
}
(7)创建Controller
package com.cloud.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cloud.domain.User;
import com.cloud.service.UserService;
@RestController
@RequestMapping(value = "/user")
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/list")
public List findByUserAge() {
return userService.findAll();
}
}
2.基于axios完成Vue项目与后端的数据交互
(1)安装axios
npm install axios -S
(2)在main.js文件中引入axios
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
/* 设置全局的axios */
Vue.prototype.$axios = axios
/* 设置基本路径 */
axios.defaults.baseURL = '/api'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: ''
})
(3)在config/index.js中配置跨域
由于Vue是8080端口,而后台接口是8081端口,直接访问将产生跨域问题,因此在请求接口之前,需要配置代理请求路径。Vue实现跨域的原理和Nginx类似,浏览器是禁止跨域的,但是由服务端请求服务端是没有跨域问题的,当我们在本地运行 npm run dev 命令时,实际上是用Node运行了一个服务器,Vue实际上是将请求发给了自己的服务器,再由服务器转发给后台服务器,由此解决了跨域问题。
最近受我的朋友委托用js+HTML做一个像手册一样的程序,里面要有可展开的大纲,模糊查找等功能。我这个人说实在的懒,本来是不愿意的,但想起了父亲以前教我要给朋友搞好关系,再加上这也可以巩固自己的js技术,于是就开始开发这个程序,没想到却出了点小问题,我做的查找只能绝对查找。具体的js代码如下:
function search(){
var arr=new Array("my
实例:
CREATE OR REPLACE PROCEDURE test_Exception
(
ParameterA IN varchar2,
ParameterB IN varchar2,
ErrorCode OUT varchar2 --返回值,错误编码
)
AS
/*以下是一些变量的定义*/
V1 NUMBER;
V2 nvarc
Spark Streaming简介
NetworkWordCount代码
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
代码示例:
# include <stdio.h>
//冒泡排序
void sort(int * a, int len)
{
int i, j, t;
for (i=0; i<len-1; i++)
{
for (j=0; j<len-1-i; j++)
{
if (a[j] > a[j+1]) // >表示升序
nginx日志分割 for linux 默认情况下,nginx是不分割访问日志的,久而久之,网站的日志文件将会越来越大,占用空间不说,如果有问题要查看网站的日志的话,庞大的文件也将很难打开,于是便有了下面的脚本 使用方法,先将以下脚本保存为 cutlog.sh,放在/root 目录下,然后给予此脚本执行的权限
复制代码代码如下:
chmo
http://bukhantsov.org/2011/08/how-to-determine-businessobjects-service-pack-and-fix-pack/
The table below is helpful. Reference
BOE XI 3.x
12.0.0.
y BOE XI 3.0 12.0.
x.
y BO
大家都知道吧,这很坑,尤其是用惯了mysql里的自增字段设置,结果oracle里面没有的。oh,no 我用的是12c版本的,它有一个新特性,可以这样设置自增序列,在创建表是,把id设置为自增序列
create table t
(
id number generated by default as identity (start with 1 increment b