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

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

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="SqlDialectMappings"> <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" /> <file url="PROJECT" dialect="Oracle" />
</component> </component>
</project> </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; import java.util.List;
public interface IUserDao { 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; import java.util.Date;
public class User { public class User {
private Integer id; private Integer user_id;
private String name; private String user_name;
private String dept_name; private String user_account;
private Float salary; private String password;
private String sex;
private Integer age;
private String phonenumber;
private String role;
public Integer getId() { public Integer getUser_id() {
return id; return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
} }
public void setId(Integer id) { public String getUser_name() {
this.id = id; return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
} }
public String getUsername() { public String getUser_account() {
return name; return user_account;
}
public void setUser_account(String user_account) {
this.user_account = user_account;
} }
public void setUsername(String name) { public String getPassword() {
this.name = name; return password;
}
public void setPassword(String password) {
this.password = password;
} }
public String getDept_name() { public String getSex() {
return dept_name; return sex;
}
public void setSex(String sex) {
this.sex = sex;
} }
public void setDept_name(String dept_name) { public Integer getAge() {
this.dept_name = dept_name; return age;
}
public void setAge(Integer age) {
this.age = age;
} }
public Float getSalary() { public String getPhonenumber() {
return salary; return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
} }
public void setSalary(Float salary) { public String getRole() {
this.salary = salary; return role;
}
public void setRole(String role) {
this.role = role;
} }
@Override @Override
public String toString() { public String toString() {
return "User{" + return "User:{" +
"id=" + id + "ID=" + user_id +
", name='" + name + '\'' + ",name=" + user_name + '\'' +
", dept_name='" + dept_name + '\'' + ",account=" + user_account + '\'' +
", salary='" + salary + '\'' + ",password=" + password + '\'' +
'}'; ",sex=" + sex + '\'' +
",age=" + age + '\'' +
",phonenumber=" + phonenumber + '\'' +
",role=" + role + '\'' +
"}";
} }
} }

@ -16,6 +16,6 @@
</environments> </environments>
<mappers> <mappers>
<mapper resource="com/keafmd/dao/IUserDao.xml"/> <mapper resource="com/keafmd/dao/IDataDao.xml"/>
</mappers> </mappers>
</configuration> </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接口的代理对象 //4.使用SqlSession创建Dao接口的代理对象
IUserDao userDao = session.getMapper(IUserDao.class); IUserDao userDao = session.getMapper(IUserDao.class);
//5.使用代理对象执行方法 //5.使用代理对象执行方法
List<User> users = Collections.unmodifiableList(userDao.findAll()); List<User> users = Collections.unmodifiableList(userDao.find_User());
for (User user : users) { for (User user : users) {
System.out.println(user); System.out.println(user);
} }

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