目录
Java期末项目需要写一个信息管理系统,本人又比较喜欢打游戏,所以写了一个武器信息管理系统
创建项目所需要的依赖项
创建目录
主要实现功能:
@Data
@Entity
@Table(name = "weapon")
public class Weapon {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "name")
private String name;
@Column(name = "types")
private String types;
@Column(name = "price")
private String price;
@Column(name = "weapon_skin")
private String weapon_skin;
@Column(name = "weapon_skin_price")
private String weapon_skin_price;
添加武器信息:
添加功能:我们根据主要功能添加,可以添加主要功能里的所有信息,并将这些内容进行保存,同时也要存进数据表里(mysql),在设置一个按钮进行保存设置,保存完毕后网页跳转到武器信息管理系统的首页
<div class="container">
<h1>武器信息系统</h1>
<hr>
<h2>添加武器</h2>
<form action="#" th:action="@{/saveWeapon}" th:object="${weapon}" method="POST">
<input type="text" th:field="*{name}" placeholder="name" class="form-control mb-4 col-4">
<input type="text" th:field="*{types}" placeholder="types" class="form-control mb-4 col-4">
<input type="text" th:field="*{price}" placeholder="price" class="form-control mb-4 col-4">
<input type="text" th:field="*{weapon_skin}" placeholder="weapon_skin" class="form-control mb-4 col-4">
<input type="text" th:field="*{weapon_skin_price}" placeholder="weapon_skin_price" class="form-control mb-4 col-4">
<button type="submit" class="btn btn-info col-2"> 添加武器</button>
<!-- <button type="button" class="btn btn-info" style="text-shadow: black 5px 3px 3px;">-->
<!-- 增加玩家-->
<!-- </button>-->
</form>
<hr>
<a th:href="@{/}"> 返回武器信息列表</a>