yt_branch
yutao 2 years ago
parent e839cf47c4
commit 4c4305eb11

@ -0,0 +1,27 @@
package com.example.hosdata.controller;
import com.example.hosdata.pojo.Information;
import com.example.hosdata.pojo.RegisterRecord;
import com.example.hosdata.pojo.Zhuce;
import com.example.hosdata.service.DocyzService;
import com.example.hosdata.service.InService;
import com.example.hosdata.service.RegisterService;
import com.example.hosdata.service.ZhuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.HtmlUtils;
import java.util.List;
@RestController
public class ZhuController {
@Autowired
ZhuService zhuService;
@CrossOrigin
@PostMapping("/api/zhu")
public Zhuce add(@RequestBody Zhuce zhuce) throws Exception {
zhuService.add(zhuce);
return zhuce;
}
}

@ -0,0 +1,12 @@
package com.example.hosdata.dao;
import com.example.hosdata.pojo.Information;
import com.example.hosdata.pojo.RegisterRecord;
import com.example.hosdata.pojo.User;
import com.example.hosdata.pojo.Zhuce;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ZhuDAO extends JpaRepository<Zhuce,Integer>{
}

@ -0,0 +1,23 @@
package com.example.hosdata.service;
import com.example.hosdata.dao.InDAO;
import com.example.hosdata.dao.RegisterDAO;
import com.example.hosdata.dao.ZhuDAO;
import com.example.hosdata.pojo.Information;
import com.example.hosdata.pojo.RegisterRecord;
import com.example.hosdata.pojo.Zhuce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ZhuService {
@Autowired
ZhuDAO zhuDAO;
public void add(Zhuce zhuce) {
zhuDAO.save(zhuce);
}
}

@ -0,0 +1,52 @@
package com.example.hosdata.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
@Entity
@Table(name = "user")
@JsonIgnoreProperties({"handler","hibernateLazyInitializer"})
public class Zhuce {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
String id;
String username;
String password;
String realname;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
}

@ -0,0 +1,83 @@
<template>
<el-form class="zhuce" label-position="left"
label-width="0px">
<h3 class="login_title">注册新用户</h3>
<el-form-item>
<el-select v-model="ZhuForm.id" placeholder="请选择登录身份">
<el-option label="普通用户" value="普通用户"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input type="text" v-model="ZhuForm.realname"
auto-complete="off" placeholder="输入姓名"></el-input>
</el-form-item>
<el-form-item>
<el-input type="text" v-model="ZhuForm.username"
auto-complete="off" placeholder="输入账号"></el-input>
</el-form-item>
<el-form-item>
<el-input type="password" v-model="ZhuForm.password"
auto-complete="off" placeholder="输入密码"></el-input>
</el-form-item>
<el-form-item style="width: 100%">
<el-button type="primary" style="width: 100%;background: #505458;border: none" v-on:click="ok">确定</el-button>
</el-form-item>
</el-form>
</template>
<script>
export default {
name: 'ZhuceIndex',
data () {
return {
ZhuForm: {
id: '',
username: '',
password: '',
realname: ''
},
responseResult: []
}
},
methods: {
ok () {
this.$axios
.post('/zhu', {
id: this.ZhuForm.id,
username: this.ZhuForm.username,
realname: this.ZhuForm.realname,
password: this.ZhuForm.password
}).then(resp => {
if (resp && resp.status === 200) {
this.$emit('ok')
}
})
this.$message({
message: '注册成功',
type: 'success'
})
this.$router.replace({path: '/login'})
}
}
}
</script>
<style>
.zhuce {
border-radius: 15px;
background-clip: padding-box;
margin: 90px auto;
width: 350px;
padding: 35px 35px 15px 35px;
background: #fff;
border: 1px solid #eaeaea;
box-shadow: 0 0 25px #cac6c6;
}
.login_title {
margin: 0px auto 40px auto;
text-align: center;
color: #505458;
}
</style>
Loading…
Cancel
Save