开始导入数据,制作各功能模块及其接口

药品系统ER图以及关系模式图修改版
F_X_Zhe 6 months ago
parent d35fffea20
commit 225b01b1e7

@ -35,6 +35,8 @@ create table T_User(
sex char(1),
age numeric(2,0),
phonenumber varchar(11),
account varchar(20) not null,
password varchar(20) not null,
role varchar(10) not null,
primary key (ID));

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/src/main/resources/com/keafmd/dao/IUserDao.xml" dialect="GenericSQL" />
<file url="file://$PROJECT_DIR$/src/main/resources/com/keafmd/dao/IDataDao.xml" dialect="GenericSQL" />
<file url="PROJECT" dialect="Oracle" />
</component>
</project>

@ -0,0 +1,8 @@
package com.keafmd.dao;
import com.keafmd.domain.Drugs;
import java.util.List;
public interface IDrugDao {
List<Drugs> find_drugs();
}

@ -4,5 +4,5 @@ import com.keafmd.domain.User;
import java.util.List;
public interface IUserDao {
List<User> findAll();
List<User> find_User();
}

@ -0,0 +1,4 @@
package com.keafmd.domain;
public class Drugs {
}

@ -3,50 +3,82 @@ package com.keafmd.domain;
import java.util.Date;
public class User {
private Integer id;
private String name;
private String dept_name;
private Float salary;
private Integer user_id;
private String user_name;
private String user_account;
private String password;
private String sex;
private Integer age;
private String phonenumber;
private String role;
public Integer getId() {
return id;
public Integer getUser_id() {
return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
}
public void setId(Integer id) {
this.id = id;
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUsername() {
return name;
public String getUser_account() {
return user_account;
}
public void setUser_account(String user_account) {
this.user_account = user_account;
}
public void setUsername(String name) {
this.name = name;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDept_name() {
return dept_name;
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public void setDept_name(String dept_name) {
this.dept_name = dept_name;
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Float getSalary() {
return salary;
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public void setSalary(Float salary) {
this.salary = salary;
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", dept_name='" + dept_name + '\'' +
", salary='" + salary + '\'' +
'}';
return "User:{" +
"ID=" + user_id +
",name=" + user_name + '\'' +
",account=" + user_account + '\'' +
",password=" + password + '\'' +
",sex=" + sex + '\'' +
",age=" + age + '\'' +
",phonenumber=" + phonenumber + '\'' +
",role=" + role + '\'' +
"}";
}
}

@ -16,6 +16,6 @@
</environments>
<mappers>
<mapper resource="com/keafmd/dao/IUserDao.xml"/>
<mapper resource="com/keafmd/dao/IDataDao.xml"/>
</mappers>
</configuration>

@ -0,0 +1,16 @@
<?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.keafmd.dao.IUserDao">
<select id="find_User" resultType="com.keafmd.domain.User">
select * from T_User
<if test = "ID != null">
AND ID like #{ID}
</if>
<if test = "name != null">
AND name like #{name}
</if>
</select>
</mapper>

@ -24,7 +24,7 @@ public class MybatisTest {
//4.使用SqlSession创建Dao接口的代理对象
IUserDao userDao = session.getMapper(IUserDao.class);
//5.使用代理对象执行方法
List<User> users = Collections.unmodifiableList(userDao.findAll());
List<User> users = Collections.unmodifiableList(userDao.find_User());
for (User user : users) {
System.out.println(user);
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save