diff --git a/code/database/ddl.sql b/code/database/ddl.sql new file mode 100644 index 0000000..90d5a36 --- /dev/null +++ b/code/database/ddl.sql @@ -0,0 +1,96 @@ +create table T_Drugs( + ID varchar(5), + name varchar(20), + num numeric(3,0), + unit_price numeric(5,2), + + primary key (ID)); + +create table T_Norms( + ID varchar(5), + feather varchar(10), + + primary key (ID)); + +create table T_Vendor( + ID varchar(5), + name varchar(20), + address varchar(64), + phonenumber varchar(11), + monitor varchar(5), + zipcode varchar(6), + + primary key (ID)); + +create table T_Request( + ID varchar(5), + num numeric(4,0), + req_date date, + + primary key (ID)); + +create table T_User( + ID varchar(5), + name varchar(10), + sex char(1), + age numeric(2,0), + phonenumber varchar(11), + role varchar(10) not null, + + primary key (ID)); + +create table T_Department( + ID varchar(5), + name varchar(10), + member numeric(3,0), + floor varchar(2), + + primary key (ID)); + +create table T_Type( + d_id varchar(5), + n_id varchar(5), + + primary key (d_id), + foreign key (d_id) references T_Drugs(ID), + foreign key (n_id) references T_Norms(ID)); + +create table T_Produce( + d_id varchar(5), + v_id varchar(5), + + primary key (d_id,v_id), + foreign key (d_id) references T_Drugs(ID), + foreign key (v_id) references T_Vendor(ID)); + +create table T_Require( + d_id varchar(5), + r_id varchar(5), + + primary key (d_id,r_id), + foreign key (d_id) references T_Drugs(ID), + foreign key (r_id) references T_Request(ID)); + +create table T_Commit( + r_id varchar(5), + u_id varchar(5), + + primary key (r_id), + foreign key (r_id) references T_Request(ID), + foreign key (u_id) references T_User(ID)); + +create table T_Belong( + u_id varchar(5), + d_id varchar(5), + + primary key (u_id), + foreign key (u_id) references T_User(ID), + foreign key (d_id) references T_Department(ID)); + +create table T_Sum_Commit( + r_id varchar(5), + d_id varchar(5), + + primary key (r_id), + foreign key (r_id) references T_Request(ID), + foreign key (d_id) references T_Department(ID)); \ No newline at end of file diff --git a/code/server/.gitignore b/code/server/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/code/server/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/code/server/.idea/.gitignore b/code/server/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/code/server/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/code/server/.idea/dataSources.xml b/code/server/.idea/dataSources.xml new file mode 100644 index 0000000..7bd13a3 --- /dev/null +++ b/code/server/.idea/dataSources.xml @@ -0,0 +1,18 @@ + + + + + oracle.19 + true + false + oracle.jdbc.OracleDriver + jdbc:oracle:thin:@localhost:1521:orcl + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/code/server/.idea/encodings.xml b/code/server/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/code/server/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/code/server/.idea/misc.xml b/code/server/.idea/misc.xml new file mode 100644 index 0000000..e5b61dc --- /dev/null +++ b/code/server/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/code/server/.idea/sqldialects.xml b/code/server/.idea/sqldialects.xml new file mode 100644 index 0000000..691b6ca --- /dev/null +++ b/code/server/.idea/sqldialects.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/code/server/.idea/uiDesigner.xml b/code/server/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/code/server/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/server/.idea/vcs.xml b/code/server/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/code/server/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/code/server/pom.xml b/code/server/pom.xml new file mode 100644 index 0000000..698791c --- /dev/null +++ b/code/server/pom.xml @@ -0,0 +1,47 @@ + + + + 4.0.0 + + org.example + example01 + 1.0-SNAPSHOT + + + 18 + 18 + UTF-8 + + + + + org.mybatis + mybatis + 3.5.2 + + + + com.oracle + ojdbc6 + 11.2.0.1.0 + + + + log4j + log4j + 1.2.17 + + + + + junit + junit + 4.12 + test + + + + + \ No newline at end of file diff --git a/code/server/src/main/java/com/keafmd/dao/IUserDao.java b/code/server/src/main/java/com/keafmd/dao/IUserDao.java new file mode 100644 index 0000000..bbc7482 --- /dev/null +++ b/code/server/src/main/java/com/keafmd/dao/IUserDao.java @@ -0,0 +1,8 @@ +package com.keafmd.dao; + +import com.keafmd.domain.User; +import java.util.List; + +public interface IUserDao { + List findAll(); +} diff --git a/code/server/src/main/java/com/keafmd/domain/User.java b/code/server/src/main/java/com/keafmd/domain/User.java new file mode 100644 index 0000000..33f8b97 --- /dev/null +++ b/code/server/src/main/java/com/keafmd/domain/User.java @@ -0,0 +1,52 @@ +package com.keafmd.domain; + +import java.util.Date; + +public class User { + private Integer id; + private String name; + private String dept_name; + private Float salary; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUsername() { + return name; + } + + public void setUsername(String name) { + this.name = name; + } + + public String getDept_name() { + return dept_name; + } + + public void setDept_name(String dept_name) { + this.dept_name = dept_name; + } + + public Float getSalary() { + return salary; + } + + public void setSalary(Float salary) { + this.salary = salary; + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", name='" + name + '\'' + + ", dept_name='" + dept_name + '\'' + + ", salary='" + salary + '\'' + + '}'; + } +} diff --git a/code/server/src/main/resources/SqlMapConfig.xml b/code/server/src/main/resources/SqlMapConfig.xml new file mode 100644 index 0000000..3e72ce6 --- /dev/null +++ b/code/server/src/main/resources/SqlMapConfig.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/code/server/src/main/resources/com/keafmd/dao/IUserDao.xml b/code/server/src/main/resources/com/keafmd/dao/IUserDao.xml new file mode 100644 index 0000000..2e5c84f --- /dev/null +++ b/code/server/src/main/resources/com/keafmd/dao/IUserDao.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/code/server/src/main/resources/log4j.properties b/code/server/src/main/resources/log4j.properties new file mode 100644 index 0000000..138c037 --- /dev/null +++ b/code/server/src/main/resources/log4j.properties @@ -0,0 +1,19 @@ +# Set root category priority to INFO and its only appender to CONSOLE. +#log4j.rootCategory=INFO, CONSOLE debug info warn error fatal +log4j.rootCategory=debug, CONSOLE, LOGFILE + +# Set the enterprise logger category to FATAL and its only appender to CONSOLE. +log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE + +# CONSOLE is set to be a ConsoleAppender using a PatternLayout. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n + +# LOGFILE is set to be a File appender using a PatternLayout. +log4j.appender.LOGFILE=org.apache.log4j.FileAppender +log4j.appender.LOGFILE.File=d:\axis.log +log4j.appender.LOGFILE.Append=true +log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n + diff --git a/code/server/src/test/java/com/keafmd/test/MybatisTest.java b/code/server/src/test/java/com/keafmd/test/MybatisTest.java new file mode 100644 index 0000000..8deb44f --- /dev/null +++ b/code/server/src/test/java/com/keafmd/test/MybatisTest.java @@ -0,0 +1,35 @@ +package com.keafmd.test; + +import com.keafmd.dao.IUserDao; +import com.keafmd.domain.User; +import org.apache.ibatis.io.Resources; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.SqlSessionFactoryBuilder; + +import java.io.InputStream; +import java.util.Collections; +import java.util.List; + +public class MybatisTest { + + public static void main(String[] args) throws Exception{ + //1.读取配置文件 + InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml"); + //2.创建SqlSessionFactory工厂 + SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder(); + SqlSessionFactory factory = builder.build(in); + //3.使用工厂生产SqlSession对象 + SqlSession session = factory.openSession(); + //4.使用SqlSession创建Dao接口的代理对象 + IUserDao userDao = session.getMapper(IUserDao.class); + //5.使用代理对象执行方法 + List users = Collections.unmodifiableList(userDao.findAll()); + for (User user : users) { + System.out.println(user); + } + //6.释放资源 + session.close(); + in.close(); + } +} diff --git a/document/ER_Diagram.erx b/document/ER_Diagram.erx new file mode 100644 index 0000000..81e6545 --- /dev/null +++ b/document/ER_Diagram.erx @@ -0,0 +1,2 @@ + +SCOTT127.0.0.1:1521/ORCL2024/5/31NORMAL16777215E:\MyWorkStation\product\11.2.0\dbhome_1000127.0.0.1orcl15211TNSwGLGqqfOfGV5TvX9zUHSIBxxsyDao0l+9pxtBs3Wr3A=Diagram 115{F719BCE1-0A2D-4B33-A7A4-5C1A1593A332}SCOTT2{EAA71972-EC35-4D60-823D-795F023F7BDD}T_BELONG-1-13{8D520B07-BBE7-49AA-B204-5E9064CCABA6}U_ID-1VARCHAR2 (5 Byte) -13{76A38759-40D0-4286-904C-D116B97F25B6}D_ID-1VARCHAR2 (5 Byte) 09{A4090282-7DAF-4A9E-A483-2C36B90FB6D6}SYS_C001163910{814FBF48-4921-4BC1-B0D1-69BCD1278EBA}SYS_C0011639010{F08F5473-E0BB-4F7D-839D-0B3D4CCB9674}SYS_C0011640-110{CD22F051-EC7D-46D4-80B6-D8C6ACDB263A}SYS_C0011641-12{80EAFC5C-5F99-4206-B0FB-6A64D89246E0}T_COMMIT-1-13{4B8D6D3B-E236-4DB5-9B49-0450C0CCEB33}R_ID-1VARCHAR2 (5 Byte) -13{E3583257-1749-4AE6-985A-3FDC0175D064}U_ID-1VARCHAR2 (5 Byte) 09{7BCAF32C-4E9D-4E08-939F-AD285974302C}SYS_C001163610{53570048-2340-46A8-99F5-8942735DF3A6}SYS_C0011636010{98B9FB6A-7DF7-48E3-881D-8C746E37C6E4}SYS_C0011638-110{8AA05521-1028-412F-B3FE-7A16D30E3E40}SYS_C0011637-12{87D323A7-3ACC-48C6-B918-053466594B24}T_DEPARTMENT-103{4C1EA408-2A49-4520-8D01-54FB15506C10}ID-1VARCHAR2 (5 Byte) -13{E5F5F2D3-475C-4F9C-BE34-79372F714FC5}NAME-1VARCHAR2 (10 Byte) 03{FA5DB52E-E19F-4E91-99E4-923508959A9F}MEMBER-1NUMBER (3) 03{9AF1F92B-8A39-4096-B873-B11C87CA9D52}FLOOR-1VARCHAR2 (2 Byte) 09{9F173EDD-660C-47E0-AABD-9ABB3A4812BC}SYS_C001162610{479A6E35-CB02-4C74-916C-BC6D7E268C9F}SYS_C001162602{E75E1B96-898A-4FDE-B087-93981DD6EBAF}T_DRUGS-103{DABA9E72-0A05-45FD-B673-485FD6D7D40F}ID-1VARCHAR2 (5 Byte) -13{25CE7E3F-5318-43F0-B399-0A87548F7872}NAME-1VARCHAR2 (20 Byte) 03{08A6383B-5765-41E6-8626-957947B8F49A}NUM-1NUMBER (3) 03{C3FF3D37-CB09-4970-91C9-7010D13F68C0}UNIT_PRICE-1NUMBER (5,2) 09{9F4CD589-6A26-44EB-A755-D45901B1C4F3}SYS_C001162010{E098F124-ECE6-4A7B-94A8-EB3B533F1DB0}SYS_C001162002{5FD3BC65-C89F-420C-AE93-CD57CC9493B6}T_NORMS-103{96D2B8CC-DF25-471B-8A79-673C008D9710}ID-1VARCHAR2 (5 Byte) -13{578569E4-817F-4988-B4CF-C8D7A58F750F}FEATHER-1VARCHAR2 (10 Byte) 09{A729041F-44BE-432F-9B62-CA7B8CD0FABA}SYS_C001162110{637E3D96-89AD-4567-B8A8-72D415F51BF6}SYS_C001162102{7ED0CB16-63B0-4E55-B915-37A343849DC9}T_REQUEST-103{4BA431FC-7819-47C6-83CA-6CB74EA5C7DE}ID-1VARCHAR2 (5 Byte) -13{5F89A8CF-2BAD-4115-9F70-4D0A3C9F6B1C}NUM-1NUMBER (4) 03{97B4A322-3389-4F7E-AC97-124FB1C6F0ED}REQ_DATE-1DATE 09{9094E5EA-DC9F-44CB-995F-2DEF28A0BCCF}SYS_C001162310{8E83FCC6-086C-4DD4-B955-E9622C673CB0}SYS_C001162302{50AC92A5-DAA5-4A03-9B7E-392180839D31}T_REQUIRE-1-13{03E1E999-7CAE-466F-8F2A-85221E18EE42}D_ID-1VARCHAR2 (5 Byte) -13{B9A8221B-35B5-4D51-8E63-16A7C6B1E978}R_ID-1VARCHAR2 (5 Byte) -19{F97EF472-2BFF-4A1C-8C6A-6489B62DBB2E}SYS_C001163310{69FDA413-2089-443A-8CFB-41D10AA536F0}SYS_C0011633010{1EF260BD-BD17-4D72-9D9A-04191675DA67}SYS_C0011634-110{A79DE38E-597E-4A26-8052-E5901F8EA1DC}SYS_C0011635-12{5677B528-8986-493D-BC51-C7133AC074F9}T_SUM_COMMIT-1-13{6F6EAA80-44DF-4087-AD80-302403D42FDA}R_ID-1VARCHAR2 (5 Byte) -13{025D5979-00F8-4825-BB7F-E172857514EB}D_ID-1VARCHAR2 (5 Byte) 09{0124F6DA-C9FB-4C5B-8F69-A9943AC5206C}SYS_C001164210{82D3C53D-CA09-4217-9EC3-E3A321B39B7B}SYS_C0011642010{7FB681A1-EEAF-4864-97F6-8F06E4623B2D}SYS_C0011643-110{D126D585-606F-4B92-BECC-8F90A3EA2359}SYS_C0011644-12{C06D6399-26B2-4490-9580-CE2E977E2499}T_TYPE-1-13{1FA14355-146D-49D5-B7BB-76F9A1C52AE5}D_ID-1VARCHAR2 (5 Byte) -13{EEF2F1DC-F779-48BA-8F5E-CC712D483AE6}N_ID-1VARCHAR2 (5 Byte) 09{201B144B-EB19-4D5F-A4C4-B4FFB3806442}SYS_C001162710{65B9716E-1AF4-478B-877C-1CD75B426369}SYS_C0011627010{FE4C5082-BC2B-41B2-BA2D-F090401EA801}SYS_C0011628-110{B0A793ED-DC20-4162-8922-23EBFE62AC63}SYS_C0011629-12{B4904FC9-2DB3-4CA3-85F0-2062B58B5E81}T_USER-103{E752F0CC-EA50-4C8B-9B2B-BB1250EC2CF7}ID-1VARCHAR2 (5 Byte) -13{5EF8C983-D5ED-4E71-9069-51217427CB37}NAME-1VARCHAR2 (10 Byte) 03{95D1CE59-BEC4-413A-8975-D5D317F858ED}SEX-1CHAR (1 Byte) 03{DB8C0EA4-CA3E-48E4-87A4-E337DCB23C4D}AGE-1NUMBER (2) 03{6ADE7B89-3E0B-4E5A-9333-E178AF500FE8}PHONENUMBER-1VARCHAR2 (11 Byte) 03{5131EBA0-8BF9-42AD-AA4B-1E358FDB8D7C}ROLE-1VARCHAR2 (10 Byte) -19{73EADC7A-591C-4E47-8E27-3C72BE17C486}SYS_C001162510{B603121E-730B-4398-8C18-3CAFDECC33AF}SYS_C001162504{F1F0A895-28E2-49B0-B730-610AECEDDD29}SYS_C0011634-10-1-1-1SYS_C00116204{FFE1DB3B-F210-4A1E-A47E-56EFD9FDABBF}SYS_C0011635-10-1-1-1SYS_C00116234{3AF23C71-16BF-4993-BB15-38FCB6D95360}SYS_C0011643-10-1-1-1SYS_C00116234{1ED8159D-F41B-4853-9EC7-38FCEDE35720}SYS_C0011644-1000-1SYS_C00116264{3ACBBA04-F733-47FD-892B-DD94709BECB1}SYS_C0011628-10-1-1-1SYS_C00116204{ECA8F6BE-CB0D-420C-BAA6-3262DCA3BFC9}SYS_C0011638-1000-1SYS_C00116254{17675419-4690-4295-B19A-815E64AD427A}SYS_C0011640-10-1-1-1SYS_C00116254{CA6263F7-2DE8-44B4-BF10-2E34259C9242}SYS_C0011629-1000-1SYS_C00116214{E99B1685-7367-443B-BA84-3FD89759B4D5}SYS_C0011641-1000-1SYS_C00116264{43A058B2-DB98-49C5-8B7C-B388651B76D3}SYS_C0011637-10-1-1-1SYS_C0011623501{DECC181D-7B89-4C11-A3C0-1C633A6629EA}All Items502{350DB290-760A-4345-A206-8708BFC820BD}T_BELONG015793151000-28Tahoma16711680100150202-1-1128989105-10-1-10-10-1502{1DBEFF63-0285-4F65-9E0E-8E67AA907F9F}T_COMMIT015793151000-28Tahoma167116801001502000-146189405-10-1-10-10-1502{BC90463B-0F4C-4929-B996-2DDF5C34C8A2}T_DEPARTMENT015793151000-28Tahoma167116801002003045-1-1815101005-10-1-10-10-1502{C160D71B-8BA1-4953-A545-1C80F83ACA26}T_DRUGS015793151000-28Tahoma167116801002001534-1-1811104005-10-1-10-10-1502{7223C890-4494-47A2-98E7-2DEE9561BCD5}T_NORMS015793151000-28Tahoma167116801001501561-1-1156198605-10-1-10-10-1502{73AE6E81-4555-48FF-AFDF-A6806CBB951F}T_REQUEST015793151000-28Tahoma1671168010016116470-110099505-10-1-10-10-1502{5FE77AC2-D976-49AD-B269-63BCC83B1E5A}T_REQUIRE015793151000-28Tahoma167116801001501601-1-146190605-10-1-10-10-1502{B72A7F42-AD3A-41A7-AD14-1CE6A2F8DAA9}T_SUM_COMMIT015793151000-28Tahoma167116801001503055-1-146199205-10-1-10-10-1502{D940B43A-FF65-47D3-AB21-E9BE5E9C4663}T_TYPE015793151000-28Tahoma167116801001501609-1-1121189105-10-1-10-10-1502{5B0535BE-4D80-4CEF-9A3E-913D2B86477A}T_USER015793151000-28Tahoma16711680100278100-1-1811109405-10-1-10-10-1504{6F998A68-73F9-4BE4-B0C2-967817821E25}SYS_C0011634015793151000-28Tahoma16711680120548112054780205464220546112054711504{127FCF40-173C-4BEA-91E3-09363225E8C2}SYS_C0011635015793151000-28Tahoma16711680121442612144292205443020544612099361504{A52480C5-32F1-47D8-9689-096CCFCFCA20}SYS_C0011643015793151000-28Tahoma16711680126421802673180302451130555112849346504{A7E6E6C4-AA4C-4FD0-96EB-8FA6055D9E3C}SYS_C0011644015793151000-28Tahoma16711680130458823014882302456130555613019722504{4FC619D1-C4B2-407D-B4D7-F6558342EAA5}SYS_C0011628015793151000-28Tahoma1671168012054101120541042205411802054121120541111504{90B21204-BAB6-44AA-87DA-808B6D67FFA8}SYS_C0011638015793151000-28Tahoma167116801647811647780647642647611647711504{D27FDA5A-1F67-4BC8-8CBF-3398D151DF9A}SYS_C0011640015793151000-28Tahoma16711680164710896471120648125864812896471189504{FDA52745-0C89-4CEF-B7B8-6A8302020276}SYS_C0011629015793151000-28Tahoma1671168012054156120541530205413922054136120541461504{3C48561A-D716-430F-8090-20535339944A}SYS_C0011641015793151000-28Tahoma16711680130459483014948112413641093136420691156504{B573E225-B12E-4CE4-90A9-FA4560134CAA}SYS_C0011637015793151000-28Tahoma167116801164718016161801125536109453613703581001001501508021029701001677721515793151-100-28Tahoma000100167116801-10-1-1-10-105-1-10-100-12024/5/31Diagram 12024/5/31AuthorLast ChangeDiagramDate of CreationCompanyProjectVersion diff --git a/document/关系模式解释.docx b/document/关系模式解释.docx new file mode 100644 index 0000000..d3b3de1 Binary files /dev/null and b/document/关系模式解释.docx differ diff --git a/document/药品系统ER图&关系模式图.docx b/document/药品系统ER图&关系模式图.docx new file mode 100644 index 0000000..25e654a Binary files /dev/null and b/document/药品系统ER图&关系模式图.docx differ diff --git a/document/药房系统测试.docx b/document/药房系统测试.docx new file mode 100644 index 0000000..c3b6c37 Binary files /dev/null and b/document/药房系统测试.docx differ