├── .idea
├── .name
├── modules.xml
├── encodings.xml
├── misc.xml
├── libraries
│ ├── Maven__junit_junit_4_12.xml
│ ├── Maven__org_ow2_asm_asm_5_0_4.xml
│ ├── Maven__org_yaml_snakeyaml_1_19.xml
│ ├── Maven__org_mybatis_mybatis_3_4_6.xml
│ ├── Maven__com_zaxxer_HikariCP_2_7_9.xml
│ ├── Maven__net_minidev_json_smart_2_3.xml
│ ├── Maven__org_objenesis_objenesis_2_6.xml
│ ├── Maven__com_alibaba_fastjson_1_2_47.xml
│ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml
│ ├── Maven__org_webjars_bower_jquery_3_2_1.xml
│ ├── Maven__com_fasterxml_classmate_1_3_4.xml
│ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml
│ ├── Maven__net_bytebuddy_byte_buddy_1_7_11.xml
│ ├── Maven__org_assertj_assertj_core_3_9_1.xml
│ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml
│ ├── Maven__org_xmlunit_xmlunit_core_2_5_1.xml
│ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml
│ ├── Maven__net_minidev_accessors_smart_1_2.xml
│ ├── Maven__org_mockito_mockito_core_2_15_0.xml
│ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml
│ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml
│ ├── Maven__org_mybatis_mybatis_spring_1_3_2.xml
│ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml
│ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml
│ ├── Maven__mysql_mysql_connector_java_5_1_46.xml
│ ├── Maven__javax_servlet_javax_servlet_api_3_1_0.xml
│ ├── Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml
│ ├── Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml
│ ├── Maven__org_thymeleaf_thymeleaf_3_0_9_RELEASE.xml
│ ├── Maven__org_unbescape_unbescape_1_1_5_RELEASE.xml
│ ├── Maven__org_attoparser_attoparser_2_0_4_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_9_6.xml
│ ├── Maven__org_springframework_spring_tx_5_0_7_RELEASE.xml
│ ├── Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml
│ ├── Maven__javax_annotation_javax_annotation_api_1_3_2.xml
│ ├── Maven__javax_validation_validation_api_2_0_1_Final.xml
│ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_31.xml
│ ├── Maven__org_springframework_spring_aop_5_0_7_RELEASE.xml
│ ├── Maven__org_springframework_spring_jcl_5_0_7_RELEASE.xml
│ ├── Maven__org_springframework_spring_web_5_0_7_RELEASE.xml
│ ├── Maven__org_springframework_spring_core_5_0_7_RELEASE.xml
│ ├── Maven__org_springframework_spring_jdbc_5_0_7_RELEASE.xml
│ ├── Maven__org_springframework_spring_test_5_0_7_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_9_6.xml
│ ├── Maven__org_springframework_spring_beans_5_0_7_RELEASE.xml
│ ├── Maven__commons_collections_commons_collections_unknown.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_31.xml
│ ├── Maven__org_springframework_spring_webmvc_5_0_7_RELEASE.xml
│ ├── Maven__org_thymeleaf_thymeleaf_spring5_3_0_9_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_spring_context_5_0_7_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml
│ ├── Maven__org_springframework_spring_expression_5_0_7_RELEASE.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_31.xml
│ ├── Maven__org_springframework_boot_spring_boot_test_2_0_3_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_6.xml
│ ├── Maven__org_hibernate_validator_hibernate_validator_6_0_10_Final.xml
│ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_2.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_6.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_2_0_3_RELEASE.xml
│ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml
│ ├── Maven__org_springframework_boot_spring_boot_devtools_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_0_3_RELEASE.xml
│ ├── Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_0_3_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_6.xml
│ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_2.xml
│ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_0_3_RELEASE.xml
│ └── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_3_RELEASE.xml
├── compiler.xml
├── workspace.xml
└── $CACHE_FILE$
├── image
├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
├── 6.png
└── 7.png
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── cra
│ │ │ ├── CraApplication.java
│ │ │ ├── service
│ │ │ ├── LogsService.java
│ │ │ ├── BookinfoService.java
│ │ │ ├── ContactsService.java
│ │ │ ├── CustomersService.java
│ │ │ ├── UsersService.java
│ │ │ └── impl
│ │ │ │ ├── CustomersServiceImpl.java
│ │ │ │ ├── ContactsServiceImpl.java
│ │ │ │ ├── BookinfoServiceImpl.java
│ │ │ │ ├── LogsServiceImpl.java
│ │ │ │ └── UsersServiceImpl.java
│ │ │ ├── mapper
│ │ │ ├── LogsMapper.java
│ │ │ ├── BookinfoMapper.java
│ │ │ ├── ContactsMapper.java
│ │ │ ├── UsersMapper.java
│ │ │ └── CustomersMapper.java
│ │ │ ├── util
│ │ │ ├── SessionConfiguration.java
│ │ │ └── SelectUsers.java
│ │ │ ├── Interceptor
│ │ │ └── SessionInterceptor.java
│ │ │ ├── entity
│ │ │ ├── Roles.java
│ │ │ ├── Logs.java
│ │ │ ├── Bookinfo.java
│ │ │ ├── Users.java
│ │ │ ├── Contacts.java
│ │ │ └── Customers.java
│ │ │ └── controller
│ │ │ ├── FrontendController.java
│ │ │ ├── LogsController.java
│ │ │ ├── BookinfoController.java
│ │ │ ├── ContactsController.java
│ │ │ ├── UsersController.java
│ │ │ └── CustomersController.java
│ └── resources
│ │ ├── application.properties
│ │ └── mapper
│ │ ├── LogsMapper.xml
│ │ ├── BookinfoMapper.xml
│ │ ├── UsersMapper.xml
│ │ ├── ContactsMapper.xml
│ │ └── CustomersMapper.xml
└── test
│ └── java
│ └── com
│ └── example
│ └── cra
│ ├── CraApplicationTests.java
│ ├── service
│ └── UsersServiceTest.java
│ └── mapper
│ └── UsersMapperTest.java
├── README.md
├── pom.xml
├── crm.sql
└── demo_7_7.iml
/.idea/.name:
--------------------------------------------------------------------------------
1 | demo_7_7
--------------------------------------------------------------------------------
/image/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/1.png
--------------------------------------------------------------------------------
/image/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/2.png
--------------------------------------------------------------------------------
/image/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/3.png
--------------------------------------------------------------------------------
/image/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/4.png
--------------------------------------------------------------------------------
/image/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/5.png
--------------------------------------------------------------------------------
/image/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/6.png
--------------------------------------------------------------------------------
/image/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No192Customer-Relationship-Management-System-CRM-/HEAD/image/7.png
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/CraApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.cra;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class CraApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(CraApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/test/java/com/example/cra/CraApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.example.cra;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class CraApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__junit_junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/LogsService.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Logs;
6 |
7 | public interface LogsService {
8 | public List getAllLogs();
9 |
10 | public Logs getALog(int log_id);
11 |
12 | public List getLogByCustName(String cust_name);
13 |
14 | public boolean addLog(Logs logs);
15 |
16 | public boolean editLog(Logs logs);
17 |
18 | public boolean delLog(int log_id);
19 |
20 | public List getCustName();
21 | }
22 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_mybatis_3_4_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/BookinfoService.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Bookinfo;
6 |
7 | public interface BookinfoService {
8 | public List getAllBookinfo();
9 |
10 | public Bookinfo getABookinfo(int book_id);
11 |
12 | public boolean addBookinfo(Bookinfo bookinfo);
13 |
14 | public boolean editBookinfo(Bookinfo bookinfo);
15 |
16 | public boolean delBookinfo(int book_id);
17 |
18 | public List getBookinfoByCustName(String cust_name);
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_zaxxer_HikariCP_2_7_9.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_json_smart_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_alibaba_fastjson_1_2_47.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_webjars_bower_jquery_3_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_classmate_1_3_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/ContactsService.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import com.example.cra.entity.Contacts;
4 |
5 | import java.util.List;
6 |
7 | public interface ContactsService {
8 | public String addContacts(Contacts contacts);
9 |
10 | public List contactsList();
11 |
12 | public String delContacts(int cont_id);
13 |
14 | public List queryContacts(String datemin, String datemax, String cust_name);
15 |
16 | public Contacts selectContacts(int cont_id);
17 |
18 | public boolean updateContacts(Contacts contacts);
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_7_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_assertj_assertj_core_3_9_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_5_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/mapper/LogsMapper.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Logs;
6 | import org.apache.ibatis.annotations.Mapper;
7 |
8 | @Mapper
9 | public interface LogsMapper {
10 | public List getAllLogs();
11 |
12 | public Logs getALog(int log_id);
13 |
14 | public List getLogByCustName(String cust_name);
15 |
16 | public boolean addLog(Logs logs);
17 |
18 | public boolean editLog(Logs logs);
19 |
20 | public boolean delLog(int log_id);
21 |
22 | public List getCustName();
23 | }
24 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mockito_mockito_core_2_15_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_mybatis_spring_1_3_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_46.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_thymeleaf_3_0_9_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_unbescape_unbescape_1_1_5_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/mapper/BookinfoMapper.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Bookinfo;
6 | import org.apache.ibatis.annotations.Mapper;
7 |
8 | @Mapper
9 | public interface BookinfoMapper {
10 | public List getAllBookinfo();//查询全部数据
11 |
12 | public Bookinfo getABookinfo(int book_id);//id查询
13 |
14 | public List getBookinfoByCustName(String cust_name);//通过客户名称查询
15 |
16 | public boolean addBookinfo(Bookinfo bookinfo);//添加
17 |
18 | public boolean editBookinfo(Bookinfo bookinfo);//修改
19 |
20 | public boolean delBookinfo(int book_id);//删除
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/util/SessionConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.util;
2 |
3 | import com.example.cra.Interceptor.SessionInterceptor;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
7 |
8 | @Configuration
9 | public class SessionConfiguration extends WebMvcConfigurerAdapter {
10 | @Override
11 | public void addInterceptors(InterceptorRegistry registry) {
12 | registry.addInterceptor(new SessionInterceptor()).addPathPatterns("/front/home");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_attoparser_attoparser_2_0_4_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_tx_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_3_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_validation_validation_api_2_0_1_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_aop_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_jcl_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_web_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_core_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_jdbc_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_test_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | #mysql\uFFFD\uFFFD\uFFFD\uFFFD
2 | spring.datasource.url=jdbc:mysql://localhost:3306/crm?useUnicode=true&characterEncoding=utf8
3 | spring.datasource.username=root
4 | spring.datasource.password=root
5 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver
6 | #mybatis\uFFFD\uFFFD\uFFFD\uFFFD
7 | mybatis.mapper-locations=classpath:mapper/*.xml
8 | mybatis.type-aliases-package=com.example.cra.entity
9 |
10 | spring.thymeleaf.prefix=classpath:/templates/
11 | spring.thymeleaf.suffix=.html
12 | spring.thymeleaf.mode=LEGACYHTML5
13 | spring.thymeleaf.cache=false
14 |
15 | spring.resources.static-locations=classpath:/static/
16 |
17 | logging.level.com.example.cra.mapper=debug
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_beans_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_collections_commons_collections_unknown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_webmvc_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_thymeleaf_spring5_3_0_9_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_context_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_expression_5_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/mapper/ContactsMapper.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import com.example.cra.entity.Contacts;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.List;
8 |
9 | @Mapper
10 | public interface ContactsMapper {
11 | //添加
12 | public int addContacts(Contacts contacts);
13 |
14 | public List contactsList();
15 |
16 | public int delContacts(int cont_id);
17 |
18 | public List queryContacts(@Param("datemin") String datemin, @Param("datemax") String datemax, @Param("cust_name") String cust_name);
19 |
20 | public Contacts selectContacts(int cont_id);
21 |
22 | public int updateContacts(Contacts contacts);
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/Interceptor/SessionInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.Interceptor;
2 |
3 | import org.springframework.web.servlet.HandlerInterceptor;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpServletResponse;
7 | import java.io.IOException;
8 |
9 | public class SessionInterceptor implements HandlerInterceptor {
10 | @Override
11 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
12 | Object obj = request.getSession().getAttribute("username");
13 | if (obj == null) {
14 | response.sendRedirect("/front/index");
15 | return false;
16 | }
17 | return true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hibernate_validator_hibernate_validator_6_0_10_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_devtools_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/CustomersService.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import com.example.cra.entity.Customers;
4 |
5 | import java.util.List;
6 |
7 | public interface CustomersService {
8 | public List getAllCustomers();
9 |
10 | public Customers getCustomerById(int id);
11 |
12 | public Customers getCustomersByStatus(String status);
13 |
14 | public Customers getCustomersByCust_name(String Cust_name);
15 |
16 | public int deleteCustomerByName(String cust_name);
17 |
18 | public int updateCustomer(Customers customer);
19 |
20 | public int insertCustomer(Customers customer);
21 |
22 | public List queryCustomers(String cust_name, Integer user_id, Integer cust_background, Integer listed,
23 | Integer cust_type, Integer status);
24 | }
25 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Roles.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | public class Roles {
4 | private int role_id;
5 | private String role_name;
6 | private String role_desc;
7 |
8 | public Roles() {
9 | }
10 |
11 | public int getRole_id() {
12 | return role_id;
13 | }
14 |
15 | public void setRole_id(int role_id) {
16 | this.role_id = role_id;
17 | }
18 |
19 | public String getRole_name() {
20 | return role_name;
21 | }
22 |
23 | public void setRole_name(String role_name) {
24 | this.role_name = role_name;
25 | }
26 |
27 | public String getRole_desc() {
28 | return role_desc;
29 | }
30 |
31 | public void setRole_desc(String role_desc) {
32 | this.role_desc = role_desc;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "Roles{" +
38 | "role_id=" + role_id +
39 | ", role_name='" + role_name + '\'' +
40 | ", role_desc='" + role_desc + '\'' +
41 | '}';
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/UsersService.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import com.example.cra.entity.Users;
4 | import com.example.cra.util.SelectUsers;
5 |
6 | import java.text.ParseException;
7 | import java.util.List;
8 |
9 | public interface UsersService {
10 |
11 | //登录
12 | public Users login(String username, String password);
13 |
14 | //系统管理员创建用户信息,默认角色为销售
15 | public String createUsers(Users user);
16 |
17 | //系统管理员对系统所有用户进行编辑
18 | public String editUsers(String editname, String editRole);
19 |
20 | //系统管理员对系统所有用户进行删除
21 | public String delUsers(String user_name);
22 |
23 | //系统管理员对系统所有用户进行查看
24 | public List listUsers();
25 |
26 | //查询满足条件的Users
27 | public List selectUsers(SelectUsers selectUsers) throws ParseException;
28 |
29 | //通过用户名查找用户id
30 | public int findUserIdByUserName(String user_name);
31 |
32 | //检测用户名
33 | public String checkname(String username);
34 |
35 | //查询用户
36 | public Users queryuser(int user_id);
37 |
38 | public boolean updateUser(Users user);
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/mapper/UsersMapper.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import com.example.cra.entity.Users;
4 | import com.example.cra.util.SelectUsers;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Param;
7 |
8 | import java.util.List;
9 |
10 | @Mapper
11 | public interface UsersMapper {
12 | //登陆
13 | public Users login(Users users);
14 |
15 | //注册
16 | public int register(Users user);
17 |
18 | //权限查询 TODO
19 | public int selectRoleId(String user_name);
20 |
21 | //删除用户
22 | public int deleteUsers(String user_name);
23 |
24 | //查看用户
25 | public List selectAll();
26 |
27 | //编辑用户
28 | public int updateUsers(@Param("editname") String editname, @Param("editRole") String editRole);
29 |
30 | //查询满足条件的用户
31 | public List selectUsers(SelectUsers selectUsers);
32 |
33 | //根据用户名查找用户id
34 | public int findUserIdByUserName(@Param("user_name") String user_name);
35 |
36 | public int checkname(String username);
37 |
38 | public Users queryuser(int user_id);
39 |
40 | public int updateUser(Users user);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 基于Springboot的客户关系管理系统(CRM)
2 | =
3 | ### 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/))
4 | ### 作者微信:19941326836 QQ:952045282
5 | ### 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习
6 | ### 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务
7 | ### 所有选题地址https://github.com/nature924/allProject
8 |
9 | 一、项目介绍
10 | ---
11 | 基于SpringBoot框架的实现的客户关系管理系统(CRM),主要功能如下
12 |
13 | ### 【后台功能】
14 | 权限管理模块: 包括系统的登录与注册功能
15 | 用户管理模块: 基于RBAC的权限模型设计, 实现分配角色的功能功能
16 | 客户管理模块: 对客户信息进行新增 修改 删除 查看
17 | 联络信息管理模块: 对联络信息进行增删改查
18 | 文档管理模块: 对文档进行管理
19 | 预订管理模块: 可以新增预订, 查询修改删除预订信息
20 | 日志管理模块: 新增管理日志
21 |
22 |
23 |
24 |
25 |
26 |
27 | 二、项目技术
28 | ---
29 | - 编程语言:Java
30 | - 数据库:MySQL
31 | - 项目管理工具:Maven
32 | - 前端技术:VUE、HTML、Jquery、Bootstrap
33 | - 后端技术:Spring、SpringMVC、MyBatis
34 |
35 | 三、运行环境
36 | ---
37 | - 操作系统:Windows、macOS都可以
38 | - JDK版本:JDK1.8以上都可以
39 | - 开发工具:IDEA、Ecplise、Myecplise都可以
40 | - 数据库: MySQL5.7以上都可以
41 | - Tomcat:任意版本都可以
42 | - Maven:任意版本都可以
43 |
44 | 四、运行截图
45 | ---
46 |
47 | ### 程序截图:
48 | 
49 | 
50 | 
51 | 
52 | 
53 | 
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/test/java/com/example/cra/service/UsersServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service;
2 |
3 | import com.example.cra.entity.Users;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.boot.test.context.SpringBootTest;
8 | import org.springframework.test.context.junit4.SpringRunner;
9 |
10 | import java.util.Date;
11 | import java.util.List;
12 |
13 | @RunWith(SpringRunner.class)
14 | @SpringBootTest
15 | public class UsersServiceTest {
16 | @Autowired
17 | private UsersService usersService;
18 |
19 | @Test
20 | public void login() {
21 | Users result = usersService.login(null, null);
22 | System.out.println(result.toString());
23 | }
24 |
25 | //系统管理员创建用户信息,默认角色为销售
26 | @Test
27 | public void createUsers() {
28 | Users user = new Users();
29 | user.setUser_name("7月8日");
30 | user.setPassword("7月8日");
31 | user.setSex("女");
32 | user.setBirthday(new Date());
33 | user.setRole_id(3);
34 | user.setStatus(1);
35 | String result = usersService.createUsers(user);
36 | System.out.println(result);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/mapper/CustomersMapper.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Customers;
6 | import org.apache.ibatis.annotations.Mapper;
7 | import org.apache.ibatis.annotations.Param;
8 |
9 |
10 | @Mapper
11 | public interface CustomersMapper {
12 |
13 | public List getAllCustomers();
14 |
15 | public Customers getCustomerById(int id);
16 |
17 | public Customers getCustomersByStatus(String status);
18 |
19 | public Customers getCustomersByCust_name(String Cust_name);
20 |
21 | public Customers getCustomersByUser_id(int user_id);
22 |
23 | public List queryCustomers(@Param("cust_name") String cust_name,
24 | @Param("user_id") Integer user_id,
25 | @Param("cust_background") Integer cust_background,
26 | @Param("listed") Integer listed,
27 | @Param("cust_type") Integer cust_type,
28 | @Param("status") Integer status);
29 |
30 | public int deleteCustomerById(int id);
31 |
32 | public int deleteCustomerByName(String cust_name);
33 |
34 | public int updateCustomer(Customers customer);
35 |
36 | public int insertCustomer(Customers customer);
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Logs.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | import java.util.Date;
4 |
5 | public class Logs {
6 | private int log_id;
7 | private String title;
8 | private String desc;
9 | private int cust_id;
10 | private String cust_name;
11 | private Date create_time;
12 |
13 | public int getLog_id() {
14 | return log_id;
15 | }
16 |
17 | public void setLog_id(int log_id) {
18 | this.log_id = log_id;
19 | }
20 |
21 | public String getTitle() {
22 | return title;
23 | }
24 |
25 | public void setTitle(String title) {
26 | this.title = title;
27 | }
28 |
29 | public String getDesc() {
30 | return desc;
31 | }
32 |
33 | public void setDesc(String desc) {
34 | this.desc = desc;
35 | }
36 |
37 | public int getCust_id() {
38 | return cust_id;
39 | }
40 |
41 | public void setCust_id(int cust_id) {
42 | this.cust_id = cust_id;
43 | }
44 |
45 | public Date getCreate_time() {
46 | return create_time;
47 | }
48 |
49 | public void setCreate_time(Date create_time) {
50 | this.create_time = create_time;
51 | }
52 |
53 | public String getCust_name() {
54 | return cust_name;
55 | }
56 |
57 | public void setCust_name(String cust_name) {
58 | this.cust_name = cust_name;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/util/SelectUsers.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.util;
2 |
3 | public class SelectUsers {
4 | private String username;
5 | private String sex;
6 | private String datemin;
7 | private String datemax;
8 | private int select_role;
9 | private int select_status;
10 |
11 | public SelectUsers() {
12 | }
13 |
14 | public String getUsername() {
15 | return username;
16 | }
17 |
18 | public void setUsername(String username) {
19 | this.username = username;
20 | }
21 |
22 | public String getSex() {
23 | return sex;
24 | }
25 |
26 | public void setSex(String sex) {
27 | this.sex = sex;
28 | }
29 |
30 | public String getDatemin() {
31 | return datemin;
32 | }
33 |
34 | public void setDatemin(String datemin) {
35 | this.datemin = datemin;
36 | }
37 |
38 | public String getDatemax() {
39 | return datemax;
40 | }
41 |
42 | public void setDatemax(String datemax) {
43 | this.datemax = datemax;
44 | }
45 |
46 | public int getSelect_role() {
47 | return select_role;
48 | }
49 |
50 | public void setSelect_role(int select_role) {
51 | this.select_role = select_role;
52 | }
53 |
54 | public int getSelect_status() {
55 | return select_status;
56 | }
57 |
58 | public void setSelect_status(int select_status) {
59 | this.select_status = select_status;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Bookinfo.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | import java.util.Date;
4 |
5 | public class Bookinfo {
6 | private int book_id;
7 | private int cust_id;
8 | private String cust_name;
9 | private String title;
10 | private String desc;
11 | private Date book_time;
12 | private Date create_time;
13 |
14 | public int getBook_id() {
15 | return book_id;
16 | }
17 |
18 | public void setBook_id(int book_id) {
19 | this.book_id = book_id;
20 | }
21 |
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | public void setTitle(String title) {
27 | this.title = title;
28 | }
29 |
30 | public String getDesc() {
31 | return desc;
32 | }
33 |
34 | public void setDesc(String desc) {
35 | this.desc = desc;
36 | }
37 |
38 | public Date getBook_time() {
39 | return book_time;
40 | }
41 |
42 | public void setBook_time(Date book_time) {
43 | this.book_time = book_time;
44 | }
45 |
46 | public Date getCreate_time() {
47 | return create_time;
48 | }
49 |
50 | public void setCreate_time(Date create_time) {
51 | this.create_time = create_time;
52 | }
53 |
54 | public int getCust_id() {
55 | return cust_id;
56 | }
57 |
58 | public void setCust_id(int cust_id) {
59 | this.cust_id = cust_id;
60 | }
61 |
62 | public String getCust_name() {
63 | return cust_name;
64 | }
65 |
66 | public void setCust_name(String cust_name) {
67 | this.cust_name = cust_name;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/LogsMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
12 |
13 |
14 | INSERT INTO logs (logs.title, logs.desc, logs.cust_id, logs.create_time)
15 | VALUES (#{title}, #{desc}, (SELECT customer_id FROM customers WHERE cust_name = #{cust_name}), #{create_time})
16 |
17 |
18 |
19 | UPDATE logs SET title = #{title}, logs.desc = #{desc},
20 | cust_id = (SELECT customer_id FROM customers WHERE cust_name = #{cust_name}), create_time = #{create_time}
21 | WHERE log_id = #{log_id}
22 |
23 |
24 |
25 | DELETE FROM logs WHERE log_id = #{log_id}
26 |
27 |
28 |
31 |
32 |
35 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/BookinfoMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
12 |
13 |
14 | INSERT INTO bookinfo (cust_id, title, bookinfo.desc, book_time, create_time)
15 | VALUES ((SELECT customer_id FROM customers WHERE cust_name = #{cust_name}),
16 | #{title}, #{desc}, #{book_time}, #{create_time})
17 |
18 |
19 |
20 | UPDATE bookinfo SET cust_id = (SELECT customer_id FROM customers WHERE cust_name = #{cust_name}),
21 | title = #{title}, bookinfo.desc = #{desc}, book_time = #{book_time}, create_time = #{create_time}
22 | WHERE book_id = #{book_id}
23 |
24 |
25 |
26 | DELETE FROM bookinfo WHERE book_id = #{book_id}
27 |
28 |
29 |
32 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/impl/CustomersServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Customers;
6 | import com.example.cra.mapper.CustomersMapper;
7 | import com.example.cra.service.CustomersService;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | @Service
12 | public class CustomersServiceImpl implements CustomersService {
13 |
14 | @Autowired
15 | private CustomersMapper customersMapper;
16 |
17 | @Override
18 | public List getAllCustomers() {
19 | List customersList = customersMapper.getAllCustomers();
20 | return customersList;
21 | }
22 |
23 | @Override
24 | public Customers getCustomerById(int id) {
25 | return customersMapper.getCustomerById(id);
26 | }
27 |
28 | @Override
29 | public Customers getCustomersByStatus(String status) {
30 | return null;
31 | }
32 |
33 | @Override
34 | public Customers getCustomersByCust_name(String Cust_name) {
35 | Customers customers = customersMapper.getCustomersByCust_name(Cust_name);
36 | return customers;
37 | }
38 |
39 | @Override
40 | public int deleteCustomerByName(String cust_name) {
41 | return customersMapper.deleteCustomerByName(cust_name);
42 | }
43 |
44 | @Override
45 | public int updateCustomer(Customers customer) {
46 | return customersMapper.updateCustomer(customer);
47 | }
48 |
49 | @Override
50 | public int insertCustomer(Customers customer) {
51 | return customersMapper.insertCustomer(customer);
52 | }
53 |
54 | @Override
55 | public List queryCustomers(String cust_name, Integer user_id, Integer cust_background, Integer listed,
56 | Integer cust_type, Integer status) {
57 | return customersMapper.queryCustomers(cust_name, user_id, cust_background, listed, cust_type, status);
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/impl/ContactsServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service.impl;
2 |
3 | import com.example.cra.entity.Contacts;
4 | import com.example.cra.mapper.ContactsMapper;
5 | import com.example.cra.mapper.CustomersMapper;
6 | import com.example.cra.service.ContactsService;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 |
12 | @Service
13 | public class ContactsServiceImpl implements ContactsService {
14 |
15 | @Autowired
16 | private ContactsMapper contactsMapper;
17 |
18 | @Autowired
19 | private CustomersMapper customersMapper;
20 |
21 | @Override
22 | public String addContacts(Contacts contacts) {
23 | int result = contactsMapper.addContacts(contacts);
24 | if (result > 0) {
25 | return "新增联络成功!";
26 | } else {
27 | return "新增联络失败!";
28 | }
29 | }
30 |
31 | @Override
32 | public List contactsList() {
33 | List contacts = contactsMapper.contactsList();
34 | return contacts;
35 | }
36 |
37 | @Override
38 | public String delContacts(int cont_id) {
39 | int result = contactsMapper.delContacts(cont_id);
40 | if (result > 0) {
41 | return "删除成功!";
42 | } else {
43 | return "删除失败!";
44 | }
45 | }
46 |
47 | @Override
48 | public List queryContacts(String datemin, String datemax, String cust_name) {
49 | List contacts = contactsMapper.queryContacts(datemin, datemax, cust_name);
50 | return contacts;
51 | }
52 |
53 | @Override
54 | public Contacts selectContacts(int cont_id) {
55 | return contactsMapper.selectContacts(cont_id);
56 | }
57 |
58 | @Override
59 | public boolean updateContacts(Contacts contacts){
60 | int result = contactsMapper.updateContacts(contacts);
61 | if(result>0){
62 | return true;
63 | }else {
64 | return false;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/test/java/com/example/cra/mapper/UsersMapperTest.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.mapper;
2 |
3 | import com.example.cra.entity.Users;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.boot.test.context.SpringBootTest;
8 | import org.springframework.test.context.junit4.SpringRunner;
9 |
10 | import java.util.Date;
11 | import java.util.List;
12 |
13 | @RunWith(SpringRunner.class)
14 | @SpringBootTest
15 | public class UsersMapperTest {
16 | @Autowired
17 | private UsersMapper usersMapper;
18 |
19 | @Test
20 | public void login() {
21 | Users users = new Users();
22 | users.setUser_name("admin");
23 | users.setPassword("admin");
24 | Users u = usersMapper.login(users);
25 | System.out.println(u.toString());
26 | }
27 |
28 | @Test
29 | public void register() {
30 | Users users = new Users();
31 | users.setUser_name("abc");
32 | users.setPassword("abc");
33 | users.setSex("男");
34 | users.setBirthday(new Date());
35 | users.setRole_id(1);
36 | users.setStatus(2);
37 | usersMapper.register(users);
38 | }
39 |
40 | @Test
41 | public void selectRoleId() {
42 | int i = usersMapper.selectRoleId("admin");
43 | System.out.println("RoleId:"+i);
44 | }
45 | @Test
46 | public void deleteUsers(){
47 | String user_name = "abc";
48 | int e = usersMapper.deleteUsers(user_name);
49 | if(e>0){
50 | System.out.println("删除成功!");
51 | }else {
52 | System.out.println("删除失败!");
53 | }
54 | }
55 | @Test
56 | public void selectAll() {
57 | List list = usersMapper.selectAll();
58 | for (Users u : list) {
59 | System.out.println(u.toString());
60 | }
61 | }
62 | @Test
63 | public void updateUsers(){
64 | Users users = new Users();
65 | users.setUser_name("abc");
66 | users.setPassword("12314");
67 | // usersMapper.updateUsers(users);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Users.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 |
5 | import java.util.Date;
6 |
7 | public class Users {
8 | private int user_id;
9 | private String user_name;
10 | private String password;
11 | private String sex;
12 | @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
13 | private Date birthday;
14 | private int role_id;
15 | private int status;
16 |
17 | public Users() {
18 | }
19 |
20 | public int getUser_id() {
21 | return user_id;
22 | }
23 |
24 | public void setUser_id(int user_id) {
25 | this.user_id = user_id;
26 | }
27 |
28 | public String getUser_name() {
29 | return user_name;
30 | }
31 |
32 | public void setUser_name(String user_name) {
33 | this.user_name = user_name;
34 | }
35 |
36 | public String getPassword() {
37 | return password;
38 | }
39 |
40 | public void setPassword(String password) {
41 | this.password = password;
42 | }
43 |
44 | public String getSex() {
45 | return sex;
46 | }
47 |
48 | public void setSex(String sex) {
49 | this.sex = sex;
50 | }
51 |
52 | public Date getBirthday() {
53 | return birthday;
54 | }
55 |
56 | public void setBirthday(Date birthday) {
57 | this.birthday = birthday;
58 | }
59 |
60 | public int getRole_id() {
61 | return role_id;
62 | }
63 |
64 | public void setRole_id(int role_id) {
65 | this.role_id = role_id;
66 | }
67 |
68 | public int getStatus() {
69 | return status;
70 | }
71 |
72 | public void setStatus(int status) {
73 | this.status = status;
74 | }
75 |
76 | @Override
77 | public String toString() {
78 | return "Users{" +
79 | "user_id=" + user_id +
80 | ", user_name='" + user_name + '\'' +
81 | ", password='" + password + '\'' +
82 | ", sex='" + sex + '\'' +
83 | ", birthday=" + birthday +
84 | ", role_id=" + role_id +
85 | ", status=" + status +
86 | '}';
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/impl/BookinfoServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Bookinfo;
6 | import com.example.cra.mapper.BookinfoMapper;
7 | import com.example.cra.service.BookinfoService;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Component;
10 |
11 | @Component
12 | public class BookinfoServiceImpl implements BookinfoService {
13 | @Autowired
14 | private BookinfoMapper bookinfoMapper;
15 |
16 | @Override
17 | public List getAllBookinfo() {
18 | List list = null;
19 | list = bookinfoMapper.getAllBookinfo();
20 | return list;
21 | }
22 |
23 | @Override
24 | public Bookinfo getABookinfo(int book_id) {
25 | Bookinfo bookinfo = null;
26 | bookinfo = bookinfoMapper.getABookinfo(book_id);
27 | if (bookinfo == null)
28 | System.out.println("无法查询到相关内容");
29 | else
30 | System.out.println("查询成功");
31 | return bookinfo;
32 | }
33 |
34 | @Override
35 | public boolean addBookinfo(Bookinfo bookinfo) {
36 | boolean isSuccess = false;
37 | isSuccess = bookinfoMapper.addBookinfo(bookinfo);
38 | if (isSuccess)
39 | System.out.println("插入成功");
40 | else
41 | System.out.println("插入失败");
42 | return isSuccess;
43 | }
44 |
45 | @Override
46 | public boolean editBookinfo(Bookinfo bookinfo) {
47 | boolean isSuccess = false;
48 | isSuccess = bookinfoMapper.editBookinfo(bookinfo);
49 | if (isSuccess)
50 | System.out.println("修改成功");
51 | else
52 | System.out.println("修改失败");
53 | return isSuccess;
54 | }
55 |
56 | @Override
57 | public boolean delBookinfo(int book_id) {
58 | boolean isSuccess = false;
59 | isSuccess = bookinfoMapper.delBookinfo(book_id);
60 | if (isSuccess)
61 | System.out.println("删除成功");
62 | else
63 | System.out.println("删除失败");
64 | return isSuccess;
65 | }
66 |
67 | @Override
68 | public List getBookinfoByCustName(String cust_name) {
69 | List list = null;
70 | list = bookinfoMapper.getBookinfoByCustName(cust_name);
71 | return list;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/impl/LogsServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import com.example.cra.entity.Logs;
6 | import com.example.cra.mapper.LogsMapper;
7 | import com.example.cra.service.LogsService;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Component;
10 |
11 | @Component
12 | public class LogsServiceImpl implements LogsService {
13 | @Autowired
14 | private LogsMapper logsMapper;
15 |
16 | @Override
17 | public List getAllLogs() {
18 | List list = null;
19 | list = logsMapper.getAllLogs();
20 | if (list != null)
21 | System.out.println("查询成功");
22 | else
23 | System.out.println("查询失败");
24 | return list;
25 | }
26 |
27 | @Override
28 | public Logs getALog(int log_id) {
29 | Logs logs = null;
30 | logs = logsMapper.getALog(log_id);
31 | if (logs != null)
32 | System.out.println("查询成功");
33 | else
34 | System.out.println("查询失败");
35 | return logs;
36 | }
37 |
38 | @Override
39 | public boolean addLog(Logs logs) {
40 | boolean isSuccess = false;
41 | isSuccess = logsMapper.addLog(logs);
42 | if (isSuccess)
43 | System.out.println("插入成功");
44 | else
45 | System.out.println("插入失败");
46 | return isSuccess;
47 | }
48 |
49 | @Override
50 | public boolean editLog(Logs logs) {
51 | boolean isSuccess = false;
52 | isSuccess = logsMapper.editLog(logs);
53 | if (isSuccess)
54 | System.out.println("修改成功");
55 | else
56 | System.out.println("修改失败");
57 | return isSuccess;
58 | }
59 |
60 | @Override
61 | public boolean delLog(int log_id) {
62 | boolean isSuccess = false;
63 | isSuccess = logsMapper.delLog(log_id);
64 | if (isSuccess)
65 | System.out.println("删除成功");
66 | else
67 | System.out.println("删除失败");
68 | return isSuccess;
69 | }
70 |
71 | public List getCustName() {
72 | List list = logsMapper.getCustName();
73 | return list;
74 | }
75 |
76 | @Override
77 | public List getLogByCustName(String cust_name) {
78 | List list = null;
79 | list = logsMapper.getLogByCustName(cust_name);
80 | return list;
81 | }
82 |
83 | ;
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/UsersMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 | insert into users(user_name,password,sex,birthday,role_id,status) values(#{user_name},#{password},#{sex},#{birthday},#{role_id},#{status})
10 |
11 |
14 |
15 | delete from users where user_name = #{user_name}
16 |
17 |
20 |
21 | update users set role_id = #{editRole} where user_name=#{editname}
22 |
23 |
34 |
37 |
40 |
43 |
44 | update users set user_name = #{user_name},password=#{password},sex=#{sex},birthday=#{birthday},role_id=#{role_id},status=#{status} where user_id = #{user_id}
45 |
46 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/ContactsMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | insert into contacts(cust_id,cont_name,cont_dept,cont_position,cont_telephone,cont_mobile,cont_email,cont_qq,tech_degree,more_info,create_time)
18 | values (#{cust_id},#{cont_name},#{cont_dept},#{cont_position},#{cont_telephone},
19 | #{cont_mobile},#{cont_email},#{cont_qq},#{tech_degree},#{more_info},#{create_time})
20 |
21 |
26 |
27 | delete from contacts where cont_id = #{cont_id}
28 |
29 |
39 |
42 |
43 | update contacts
44 | set cust_id=#{cust_id},cont_name=#{cont_name},cont_dept=#{cont_dept},cont_position=#{cont_position},cont_telephone=#{cont_telephone},cont_mobile=#{cont_mobile},
45 | cont_email=#{cont_email},cont_qq=#{cont_qq},tech_degree=#{tech_degree},more_info=#{more_info}
46 | where cont_id = #{cont_id}
47 |
48 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/FrontendController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RequestMethod;
6 |
7 | @Controller
8 | @RequestMapping("/front")
9 | public class FrontendController {
10 |
11 | @RequestMapping(value = "/index", method = RequestMethod.GET)
12 | public String login() {
13 | return "index";
14 | }
15 |
16 | @RequestMapping(value = "/home", method = RequestMethod.GET)
17 | public String index() {
18 | return "home";
19 | }
20 |
21 | @RequestMapping(value = "/user-add", method = RequestMethod.GET)
22 | public String userAdd() {
23 | return "user-add";
24 | }
25 |
26 | @RequestMapping(value = "/user-list", method = RequestMethod.GET)
27 | public String userList() {
28 | return "user-list";
29 | }
30 |
31 | @RequestMapping(value = "/user-update", method = RequestMethod.GET)
32 | public String userUpdate() {
33 | return "user-update";
34 | }
35 |
36 | @RequestMapping(value = "/contact-add", method = RequestMethod.GET)
37 | public String contactAdd() {
38 | return "contact-add";
39 | }
40 |
41 | @RequestMapping(value = "/contact-list", method = RequestMethod.GET)
42 | public String contactList() {
43 | return "contact-list";
44 | }
45 |
46 | @RequestMapping(value = "/contact-update", method = RequestMethod.GET)
47 | public String contactUpdate() {
48 | return "contact-update";
49 | }
50 |
51 | @RequestMapping(value = "/customer-add", method = RequestMethod.GET)
52 | public String customerAdd() {
53 | return "customer-add";
54 | }
55 |
56 | @RequestMapping(value = "/customer-list", method = RequestMethod.GET)
57 | public String customerList() {
58 | return "customer-list";
59 | }
60 |
61 | @RequestMapping(value = "/bookinfo-add", method = RequestMethod.GET)
62 | public String bookinfoAdd() {
63 | return "bookinfo-add";
64 | }
65 |
66 | @RequestMapping(value = "/bookinfo-list", method = RequestMethod.GET)
67 | public String bookinfoList() {
68 | return "bookinfo-list";
69 | }
70 |
71 | @RequestMapping(value = "/bookinfo-update", method = RequestMethod.GET)
72 | public String bookinfoUpdate() {
73 | return "bookinfo-update";
74 | }
75 |
76 | @RequestMapping(value = "/log-add", method = RequestMethod.GET)
77 | public String logAdd() {
78 | return "log-add";
79 | }
80 |
81 | @RequestMapping(value = "/log-list", method = RequestMethod.GET)
82 | public String logList() {
83 | return "log-list";
84 | }
85 |
86 | @RequestMapping(value = "/log-update", method = RequestMethod.GET)
87 | public String logUpdate() {
88 | return "log-update";
89 | }
90 |
91 | @RequestMapping(value = "/document-add", method = RequestMethod.GET)
92 | public String documentAdd() {
93 | return "document-add";
94 | }
95 |
96 | @RequestMapping(value = "/document-list", method = RequestMethod.GET)
97 | public String documentList() {
98 | return "document-list";
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/LogsController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import java.util.Date;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import com.example.cra.entity.Logs;
9 | import com.example.cra.service.LogsService;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.ResponseBody;
14 |
15 | import com.alibaba.fastjson.JSON;
16 |
17 | @Controller
18 | @RequestMapping("/logs")
19 | public class LogsController {
20 | @Autowired
21 | private LogsService logsService;
22 |
23 | @RequestMapping("/getlogs")
24 | @ResponseBody
25 | public String getAllBookinfo() {
26 | List list = logsService.getAllLogs();
27 | String jsonString = JSON.toJSONString(list);
28 | System.out.println(jsonString);
29 | return jsonString;
30 | }
31 |
32 | @RequestMapping("/findlog")
33 | @ResponseBody
34 | public String getALog(int log_id) {
35 | Logs logs = null;
36 | logs = logsService.getALog(log_id);
37 | String json = JSON.toJSONString(logs);
38 | System.out.println(json);
39 | return json;
40 | }
41 |
42 | @RequestMapping("/addlog")
43 | @ResponseBody
44 | public Map addLog(String title, String cust_name, String desc, Date create_time) {
45 | Map map = new HashMap<>();
46 | Logs logs = new Logs();
47 | logs.setTitle(title);
48 | logs.setDesc(desc);
49 | logs.setCust_name(cust_name);
50 | logs.setCreate_time(create_time);
51 | System.out.println(JSON.toJSONString(logs));
52 | boolean isSuccess = logsService.addLog(logs);
53 | map.put("isSuccess", isSuccess);
54 | return map;
55 | }
56 |
57 | @RequestMapping("/editlog")
58 | @ResponseBody
59 | public Map editLog(int log_id, String title, String desc, String cust_name, Date create_time) {
60 | Map map = new HashMap<>();
61 | Logs logs = logsService.getALog(log_id);
62 | System.out.println(JSON.toJSONString(logs));
63 | logs.setTitle(title);
64 | logs.setDesc(desc);
65 | logs.setCust_name(cust_name);
66 | logs.setCreate_time(create_time);
67 | boolean isSuccess = logsService.editLog(logs);
68 | map.put("isSuccess", isSuccess);
69 | return map;
70 | }
71 |
72 | @RequestMapping("/dellog")
73 | public String delLog(int log_id) {
74 | logsService.delLog(log_id);
75 | return "log-list";
76 | }
77 |
78 | @RequestMapping("/getcustname")
79 | @ResponseBody
80 | public String getCustName() {
81 | List list = logsService.getCustName();
82 | String json = JSON.toJSONString(list);
83 | System.out.println(json);
84 | return json;
85 | }
86 |
87 | @RequestMapping("/getlogbycustname")
88 | @ResponseBody
89 | public String getLogByCustName(String cust_name) {
90 | List list = logsService.getLogByCustName(cust_name);
91 | String json = JSON.toJSONString(list);
92 | System.out.println(json);
93 | return json;
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/service/impl/UsersServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.service.impl;
2 |
3 | import com.example.cra.entity.Users;
4 | import com.example.cra.mapper.UsersMapper;
5 | import com.example.cra.service.UsersService;
6 | import com.example.cra.util.SelectUsers;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.text.ParseException;
11 | import java.text.SimpleDateFormat;
12 | import java.util.ArrayList;
13 | import java.util.Date;
14 | import java.util.List;
15 | import java.util.Map;
16 |
17 | @Service
18 | public class UsersServiceImpl implements UsersService {
19 |
20 | @Autowired
21 | private UsersMapper usersMapper;
22 |
23 | @Override
24 | public Users login(String username, String password) {
25 | Users user = new Users();
26 | user.setUser_name(username);
27 | user.setPassword(password);
28 | Users result = usersMapper.login(user);
29 | if (result != null) {
30 | return result;
31 | } else {
32 | return null;
33 | }
34 | }
35 |
36 | @Override
37 | public String createUsers(Users user) {
38 | int result = usersMapper.register(user);
39 | if (result > 0) {
40 | return "创建用户成功!";
41 | } else {
42 | return "创建用户失败!";
43 | }
44 | }
45 |
46 | @Override
47 | public String editUsers(String editname, String editRole) {
48 | int result = usersMapper.updateUsers(editname, editRole);
49 | if (result > 0) {
50 | return "修改用户成功!";
51 | } else {
52 | return "修改用户失败!";
53 | }
54 | }
55 |
56 | @Override
57 | public String delUsers(String username) {
58 | int result = usersMapper.deleteUsers(username);
59 | if (result > 0) {
60 | return "删除用户成功!";
61 | } else {
62 | return "删除用户失败!";
63 | }
64 | }
65 |
66 | @Override
67 | public List listUsers() {
68 | List users = new ArrayList();
69 | users = usersMapper.selectAll();
70 | return users;
71 | }
72 |
73 | @Override
74 | public List selectUsers(SelectUsers selectUsers) {
75 | List users = new ArrayList();
76 | users = usersMapper.selectUsers(selectUsers);
77 | return users;
78 | }
79 |
80 | @Override
81 | public int findUserIdByUserName(String user_name) {
82 | return usersMapper.findUserIdByUserName(user_name);
83 | }
84 |
85 | //检测用户名
86 | @Override
87 | public String checkname(String username) {
88 | int result = usersMapper.checkname(username);
89 | if (result > 0) {
90 | return "用户名已存在,不能使用!";
91 | } else {
92 | return "用户名可以使用!";
93 | }
94 | }
95 |
96 | //查询用户
97 | @Override
98 | public Users queryuser(int user_id) {
99 | return usersMapper.queryuser(user_id);
100 | }
101 |
102 | @Override
103 | public boolean updateUser(Users user) {
104 | int result = usersMapper.updateUser(user);
105 | if (result>0){
106 | return true;
107 | }else {
108 | return false;
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.libo
7 | demo_7_7
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo_7_7
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | javax.servlet
34 | javax.servlet-api
35 |
36 |
37 | com.fasterxml.jackson.core
38 | jackson-databind
39 |
40 |
41 |
42 | commons-collections
43 | commons-collections
44 |
45 |
46 |
47 | com.alibaba
48 | fastjson
49 | 1.2.47
50 |
51 |
52 | org.mybatis.spring.boot
53 | mybatis-spring-boot-starter
54 | 1.3.2
55 |
56 |
57 | org.springframework.boot
58 | spring-boot-devtools
59 | runtime
60 |
61 |
62 | mysql
63 | mysql-connector-java
64 | runtime
65 |
66 |
67 | org.springframework.boot
68 | spring-boot-starter-test
69 | test
70 |
71 |
72 | org.springframework.boot
73 | spring-boot-starter-thymeleaf
74 |
75 |
76 |
77 | org.webjars.bower
78 | jquery
79 | 3.2.1
80 |
81 |
82 |
83 |
84 |
85 |
86 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/BookinfoController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import java.util.Date;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import com.example.cra.entity.Bookinfo;
9 | import com.example.cra.service.BookinfoService;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.RequestMethod;
14 | import org.springframework.web.bind.annotation.RequestParam;
15 | import org.springframework.web.bind.annotation.ResponseBody;
16 | import com.alibaba.fastjson.JSON;
17 |
18 | @Controller
19 | @RequestMapping("/bookinfo")
20 | public class BookinfoController {
21 | @Autowired
22 | private BookinfoService bookinfoService;
23 |
24 | @RequestMapping("/getbookinfos")
25 | @ResponseBody
26 | public String getAllBookinfo() {
27 | List list = bookinfoService.getAllBookinfo();
28 | String JsonString = JSON.toJSONString(list);
29 | System.out.println(JsonString);
30 | return JsonString;
31 | }
32 |
33 | @RequestMapping("/findbookinfo")
34 | @ResponseBody
35 | public String getABookinfo(int book_id) {
36 | Bookinfo bookinfo = null;
37 | bookinfo = bookinfoService.getABookinfo(book_id);
38 | String json = JSON.toJSONString(bookinfo);
39 | System.out.println(json);
40 | return json;
41 | }
42 |
43 | @RequestMapping(value = "/addbookinfo",method = RequestMethod.GET)
44 | @ResponseBody
45 | public Map addBookinfo(@RequestParam("cust_name") String cust_name,
46 | @RequestParam("title") String title,
47 | @RequestParam("desc") String desc,
48 | @RequestParam("book_time") Date book_time,
49 | @RequestParam("create_time") Date create_time) {
50 | Map map = new HashMap<>();
51 | Bookinfo bookinfo = new Bookinfo();
52 | bookinfo.setCust_name(cust_name);
53 | bookinfo.setTitle(title);
54 | bookinfo.setDesc(desc);
55 | bookinfo.setBook_time(book_time);
56 | bookinfo.setCreate_time(create_time);
57 | System.out.println(JSON.toJSONString(bookinfo));
58 | boolean isSuccess = bookinfoService.addBookinfo(bookinfo);
59 | map.put("isSuccess", isSuccess);
60 | return map;
61 | }
62 |
63 | @RequestMapping("/editbookinfo")
64 | @ResponseBody
65 | public Map editBookinfo(int book_id, String cust_name, String title, String desc, Date book_time, Date create_time) {
66 | Map map = new HashMap<>();
67 | Bookinfo bookinfo = bookinfoService.getABookinfo(book_id);
68 | System.out.println(JSON.toJSONString(bookinfo));
69 | bookinfo.setBook_id(book_id);
70 | bookinfo.setCust_name(cust_name);
71 | bookinfo.setTitle(title);
72 | bookinfo.setDesc(desc);
73 | bookinfo.setBook_time(book_time);
74 | bookinfo.setCreate_time(create_time);
75 | boolean isSuccess = bookinfoService.editBookinfo(bookinfo);
76 | map.put("isSuccess", isSuccess);
77 | return map;
78 | }
79 |
80 | @RequestMapping("/delbookinfo")
81 | public String delBookinfo(int book_id) {
82 | bookinfoService.delBookinfo(book_id);
83 | return "bookinfo-list";
84 | }
85 |
86 | @RequestMapping("/getbookinfobycustname")
87 | @ResponseBody
88 | public String getBookinfoByCustName(String cust_name) {
89 | List list = bookinfoService.getBookinfoByCustName(cust_name);
90 | String json = JSON.toJSONString(list);
91 | System.out.println(json);
92 | return json;
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/CustomersMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
12 |
15 |
18 |
21 |
46 |
47 | insert into
48 | CUSTOMERS(cust_name,cust_type,cust_background,
49 | listed,reg_capital,year_sales,entp_scale,tester_no,url,
50 | zip_code,address,major_services,main_products,status,
51 | user_id,create_time)
52 | values(#{cust_name},#{cust_type},
53 | #{cust_background},#{listed},#{reg_capital},#{year_sales},
54 | #{entp_scale},#{tester_no},#{url},#{zip_code},
55 | #{address},#{major_services},#{main_products},#{status},
56 | #{user_id},#{create_time});
57 |
58 |
59 | UPDATE CUSTOMERS
60 |
61 | cust_type=#{cust_type},
62 | cust_background=#{cust_background},
63 | listed=#{listed},
64 | reg_capital=#{reg_capital},
65 | year_sales=#{year_sales},
66 | entp_scale=#{entp_scale},
67 | tester_no=#{tester_no},
68 | url=#{url},
69 | zip_code=#{zip_code},
70 | address=#{address},
71 | major_services=#{major_services},
72 | main_products=#{main_products},
73 | status=#{status},
74 | user_id=#{user_id},
75 | create_time=#{create_time},
76 |
77 | WHERE cust_name=#{cust_name}
78 |
79 |
80 | DELETE FROM CUSTOMERS WHERE customer_id = #{id}
81 |
82 |
83 | DELETE FROM CUSTOMERS WHERE cust_name = #{cust_name}
84 |
85 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Contacts.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 |
5 | import java.util.Date;
6 |
7 | public class Contacts {
8 | private int cont_id;
9 | private int cust_id;
10 | private String cont_name;
11 | private String cont_dept;
12 | private String cont_position;
13 | private String cont_telephone;
14 | private String cont_mobile;
15 | private String cont_email;
16 | private String cont_qq;
17 | private String tech_degree;
18 | private String more_info;
19 | @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
20 | private Date create_time;
21 | private Customers customers;
22 |
23 | public Contacts() {
24 | }
25 |
26 | public int getCont_id() {
27 | return cont_id;
28 | }
29 |
30 | public void setCont_id(int cont_id) {
31 | this.cont_id = cont_id;
32 | }
33 |
34 | public int getCust_id() {
35 | return cust_id;
36 | }
37 |
38 | public void setCust_id(int cust_id) {
39 | this.cust_id = cust_id;
40 | }
41 |
42 | public String getCont_name() {
43 | return cont_name;
44 | }
45 |
46 | public void setCont_name(String cont_name) {
47 | this.cont_name = cont_name;
48 | }
49 |
50 | public String getCont_dept() {
51 | return cont_dept;
52 | }
53 |
54 | public void setCont_dept(String cont_dept) {
55 | this.cont_dept = cont_dept;
56 | }
57 |
58 | public String getCont_position() {
59 | return cont_position;
60 | }
61 |
62 | public void setCont_position(String cont_position) {
63 | this.cont_position = cont_position;
64 | }
65 |
66 | public String getCont_telephone() {
67 | return cont_telephone;
68 | }
69 |
70 | public void setCont_telephone(String cont_telephone) {
71 | this.cont_telephone = cont_telephone;
72 | }
73 |
74 | public String getCont_mobile() {
75 | return cont_mobile;
76 | }
77 |
78 | public void setCont_mobile(String cont_mobile) {
79 | this.cont_mobile = cont_mobile;
80 | }
81 |
82 | public String getCont_email() {
83 | return cont_email;
84 | }
85 |
86 | public void setCont_email(String cont_email) {
87 | this.cont_email = cont_email;
88 | }
89 |
90 | public String getCont_qq() {
91 | return cont_qq;
92 | }
93 |
94 | public void setCont_qq(String cont_qq) {
95 | this.cont_qq = cont_qq;
96 | }
97 |
98 | public String getTech_degree() {
99 | return tech_degree;
100 | }
101 |
102 | public void setTech_degree(String tech_degree) {
103 | this.tech_degree = tech_degree;
104 | }
105 |
106 | public String getMore_info() {
107 | return more_info;
108 | }
109 |
110 | public void setMore_info(String more_info) {
111 | this.more_info = more_info;
112 | }
113 |
114 | public Date getCreate_time() {
115 | return create_time;
116 | }
117 |
118 | public void setCreate_time(Date create_time) {
119 | this.create_time = create_time;
120 | }
121 |
122 | public Customers getCustomers() {
123 | return customers;
124 | }
125 |
126 | public void setCustomers(Customers customers) {
127 | this.customers = customers;
128 | }
129 |
130 | @Override
131 | public String toString() {
132 | return "Contacts{" +
133 | "cont_id=" + cont_id +
134 | ", cust_id=" + cust_id +
135 | ", cont_name='" + cont_name + '\'' +
136 | ", cont_dept='" + cont_dept + '\'' +
137 | ", cont_position='" + cont_position + '\'' +
138 | ", cont_telephone='" + cont_telephone + '\'' +
139 | ", cont_mobile='" + cont_mobile + '\'' +
140 | ", cont_email='" + cont_email + '\'' +
141 | ", cont_qq='" + cont_qq + '\'' +
142 | ", tech_degree='" + tech_degree + '\'' +
143 | ", more_info='" + more_info + '\'' +
144 | ", create_time=" + create_time +
145 | ", customers=" + customers +
146 | '}';
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/ContactsController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import com.example.cra.entity.Contacts;
4 | import com.example.cra.service.ContactsService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestMethod;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import javax.servlet.http.HttpServletRequest;
12 | import java.util.Date;
13 | import java.util.HashMap;
14 | import java.util.List;
15 | import java.util.Map;
16 |
17 | @RestController
18 | @RequestMapping("/contacts")
19 | public class ContactsController {
20 |
21 | @Autowired
22 | private ContactsService contactsService;
23 |
24 | @RequestMapping(value = "/addcontacts" , method = RequestMethod.POST)
25 | public Map addContacts(HttpServletRequest request) {
26 | Map map = new HashMap();
27 | String cust_id = request.getParameter("cust_id");
28 | String cont_name= request.getParameter("cont_name");
29 | String cont_dept= request.getParameter("cont_dept");
30 | String cont_position= request.getParameter("cont_position");
31 | String cont_telephone= request.getParameter("cont_telephone");
32 | String cont_mobile= request.getParameter("cont_mobile");
33 | String cont_email= request.getParameter("cont_email");
34 | String cont_qq= request.getParameter("cont_qq");
35 | String tech_degree= request.getParameter("tech_degree");
36 | String more_info= request.getParameter("more_info");
37 | Contacts contacts = new Contacts();
38 | contacts.setCust_id(Integer.parseInt(cust_id));
39 | contacts.setCont_name(cont_name);
40 | contacts.setCont_dept(cont_dept);
41 | contacts.setCont_position(cont_position);
42 | contacts.setCont_telephone(cont_telephone);
43 | contacts.setCont_mobile(cont_mobile);
44 | contacts.setCont_email(cont_email);
45 | contacts.setCont_qq(cont_qq);
46 | contacts.setTech_degree(tech_degree);
47 | contacts.setMore_info(more_info);
48 | contacts.setCreate_time(new Date());
49 | String result = contactsService.addContacts(contacts);
50 | map.put("msg",result);
51 | return map;
52 | }
53 |
54 | @RequestMapping(value = "/contactsList" , method = RequestMethod.GET)
55 | public Map contactsList(HttpServletRequest request) {
56 | Map map = new HashMap();
57 | List contacts = contactsService.contactsList();
58 | map.put("contacts",contacts);
59 | return map;
60 | }
61 | @RequestMapping(value = "/delcontacts" , method = RequestMethod.GET)
62 | public Map delContacts(@RequestParam("cont_id") String cont_id) {
63 | Map map = new HashMap();
64 | String result = contactsService.delContacts(Integer.parseInt(cont_id));
65 | map.put("msg",result);
66 | return map;
67 | }
68 |
69 | @RequestMapping(value = "/querycontacts" , method = RequestMethod.POST)
70 | public Map queryContacts(@RequestParam("datemin") String datemin,
71 | @RequestParam("datemax") String datemax,
72 | @RequestParam("cust_name") String cust_name) {
73 | Map map = new HashMap();
74 | List contacts = contactsService.queryContacts(datemin,datemax,cust_name);
75 | map.put("contacts",contacts);
76 | return map;
77 | }
78 | @RequestMapping(value = "/selectcontacts" , method = RequestMethod.POST)
79 | public Map selectContacts(@RequestParam("cont_id") String cont_id) {
80 | Map map = new HashMap();
81 | Contacts contact = contactsService.selectContacts(Integer.parseInt(cont_id));
82 | map.put("contact",contact);
83 | return map;
84 | }
85 | @RequestMapping(value = "/updatecontacts" , method = RequestMethod.POST)
86 | public Map updateContacts(HttpServletRequest request) {
87 | Map map = new HashMap();
88 | Contacts contacts = new Contacts();
89 | contacts.setCont_id(Integer.parseInt(request.getParameter("cont_id")));
90 | contacts.setCust_id(Integer.parseInt(request.getParameter("cust_id")));
91 | contacts.setCont_name(request.getParameter("cont_name"));
92 | contacts.setCont_dept(request.getParameter("cont_dept"));
93 | contacts.setCont_position(request.getParameter("cont_position"));
94 | contacts.setCont_telephone(request.getParameter("cont_telephone"));
95 | contacts.setCont_mobile(request.getParameter("cont_mobile"));
96 | contacts.setCont_email(request.getParameter("cont_email"));
97 | contacts.setCont_qq(request.getParameter("cont_qq"));
98 | contacts.setTech_degree(request.getParameter("tech_degree"));
99 | contacts.setMore_info(request.getParameter("more_info"));
100 | boolean result = contactsService.updateContacts(contacts);
101 | map.put("success",result);
102 | return map;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | 1671697161273
65 |
66 |
67 | 1671697161273
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/entity/Customers.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 |
5 | import java.util.Date;
6 |
7 | public class Customers {
8 | private int customer_id;
9 | private String cust_name;
10 | private int cust_type;
11 | private int cust_background;
12 | private int listed;
13 | private int reg_capital;
14 | private int year_sales;
15 | private int entp_scale;
16 | private int tester_no;
17 | private String url;
18 | private String zip_code;
19 | private String address;
20 | private String major_services;
21 | private String main_products;
22 | private int status;
23 | @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
24 | private Date create_time;
25 | private int user_id;
26 | private String user_name;
27 |
28 | public Customers() {
29 |
30 | }
31 |
32 |
33 | public int getCustomer_id() {
34 | return customer_id;
35 | }
36 |
37 |
38 | public void setCustomer_id(int customer_id) {
39 | this.customer_id = customer_id;
40 | }
41 |
42 |
43 | public String getCust_name() {
44 | return cust_name;
45 | }
46 |
47 |
48 | public void setCust_name(String cust_name) {
49 | this.cust_name = cust_name;
50 | }
51 |
52 |
53 | public int getCust_type() {
54 | return cust_type;
55 | }
56 |
57 |
58 | public void setCust_type(int cust_type) {
59 | this.cust_type = cust_type;
60 | }
61 |
62 |
63 | public int getCust_background() {
64 | return cust_background;
65 | }
66 |
67 |
68 | public void setCust_background(int cust_background) {
69 | this.cust_background = cust_background;
70 | }
71 |
72 |
73 | public int getListed() {
74 | return listed;
75 | }
76 |
77 |
78 | public void setListed(int listed) {
79 | this.listed = listed;
80 | }
81 |
82 |
83 | public int getReg_capital() {
84 | return reg_capital;
85 | }
86 |
87 |
88 | public void setReg_capital(int reg_capital) {
89 | this.reg_capital = reg_capital;
90 | }
91 |
92 |
93 | public int getYear_sales() {
94 | return year_sales;
95 | }
96 |
97 |
98 | public void setYear_sales(int year_sales) {
99 | this.year_sales = year_sales;
100 | }
101 |
102 |
103 | public int getEntp_scale() {
104 | return entp_scale;
105 | }
106 |
107 |
108 | public void setEntp_scale(int entp_scale) {
109 | this.entp_scale = entp_scale;
110 | }
111 |
112 |
113 | public int getTester_no() {
114 | return tester_no;
115 | }
116 |
117 |
118 | public void setTester_no(int tester_no) {
119 | this.tester_no = tester_no;
120 | }
121 |
122 |
123 | public String getUrl() {
124 | return url;
125 | }
126 |
127 |
128 | public void setUrl(String url) {
129 | this.url = url;
130 | }
131 |
132 |
133 | public String getZip_code() {
134 | return zip_code;
135 | }
136 |
137 |
138 | public void setZip_code(String zip_code) {
139 | this.zip_code = zip_code;
140 | }
141 |
142 |
143 | public String getAddress() {
144 | return address;
145 | }
146 |
147 |
148 | public void setAddress(String address) {
149 | this.address = address;
150 | }
151 |
152 |
153 | public String getMajor_services() {
154 | return major_services;
155 | }
156 |
157 |
158 | public void setMajor_services(String major_services) {
159 | this.major_services = major_services;
160 | }
161 |
162 |
163 | public String getMain_products() {
164 | return main_products;
165 | }
166 |
167 |
168 | public void setMain_products(String main_products) {
169 | this.main_products = main_products;
170 | }
171 |
172 |
173 | public int getStatus() {
174 | return status;
175 | }
176 |
177 |
178 | public void setStatus(int status) {
179 | this.status = status;
180 | }
181 |
182 |
183 | public Date getCreate_time() {
184 | return create_time;
185 | }
186 |
187 |
188 | public void setCreate_time(Date create_time) {
189 | this.create_time = create_time;
190 | }
191 |
192 |
193 | public int getUser_id() {
194 | return user_id;
195 | }
196 |
197 |
198 | public void setUser_id(int user_id) {
199 | this.user_id = user_id;
200 | }
201 |
202 | public String getUser_name() {
203 | return user_name;
204 | }
205 |
206 | public void setUser_name(String user_name) {
207 | this.user_name = user_name;
208 | }
209 |
210 | @Override
211 | public String toString() {
212 | return "Customers{" +
213 | "customer_id=" + customer_id +
214 | ", cust_name='" + cust_name + '\'' +
215 | ", cust_type=" + cust_type +
216 | ", cust_background=" + cust_background +
217 | ", listed=" + listed +
218 | ", reg_capital=" + reg_capital +
219 | ", year_sales=" + year_sales +
220 | ", entp_scale=" + entp_scale +
221 | ", tester_no=" + tester_no +
222 | ", url='" + url + '\'' +
223 | ", zip_code='" + zip_code + '\'' +
224 | ", address='" + address + '\'' +
225 | ", major_services='" + major_services + '\'' +
226 | ", main_products='" + main_products + '\'' +
227 | ", status=" + status +
228 | ", create_time=" + create_time +
229 | ", user_id=" + user_id +
230 | ", user_name='" + user_name + '\'' +
231 | '}';
232 | }
233 | }
234 |
--------------------------------------------------------------------------------
/crm.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : root
5 | Source Server Version : 50722
6 | Source Host : localhost:3306
7 | Source Database : crm
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50722
11 | File Encoding : 65001
12 |
13 | Date: 2018-07-23 21:40:09
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 |
18 | -- ----------------------------
19 | -- Table structure for bookinfo
20 | -- ----------------------------
21 | DROP TABLE IF EXISTS `bookinfo`;
22 | CREATE TABLE `bookinfo` (
23 | `book_id` int(11) NOT NULL AUTO_INCREMENT,
24 | `title` varchar(50) NOT NULL,
25 | `desc` varchar(200) DEFAULT NULL,
26 | `book_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
27 | `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
28 | `cust_id` int(11) NOT NULL,
29 | PRIMARY KEY (`book_id`),
30 | KEY `cust_id` (`cust_id`),
31 | CONSTRAINT `bookinfo_ibfk_1` FOREIGN KEY (`cust_id`) REFERENCES `customers` (`customer_id`)
32 | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
33 |
34 | -- ----------------------------
35 | -- Records of bookinfo
36 | -- ----------------------------
37 | INSERT INTO `bookinfo` VALUES ('6', 'testaaa', 'a', '2018-07-08 00:00:00', '2018-07-01 00:00:00', '1');
38 | INSERT INTO `bookinfo` VALUES ('9', 'test', 'aa', '2018-07-21 00:00:00', '2018-07-14 00:00:00', '1');
39 | INSERT INTO `bookinfo` VALUES ('11', 'dd', 'd', '2018-07-14 00:00:00', '2018-07-15 00:00:00', '6');
40 |
41 | -- ----------------------------
42 | -- Table structure for contacts
43 | -- ----------------------------
44 | DROP TABLE IF EXISTS `contacts`;
45 | CREATE TABLE `contacts` (
46 | `cont_id` int(11) NOT NULL AUTO_INCREMENT,
47 | `cust_id` int(11) NOT NULL,
48 | `cont_name` varchar(20) NOT NULL,
49 | `cont_dept` varchar(50) NOT NULL,
50 | `cont_position` varchar(50) NOT NULL,
51 | `cont_telephone` varchar(20) DEFAULT NULL,
52 | `cont_mobile` varchar(20) NOT NULL,
53 | `cont_email` varchar(50) DEFAULT NULL,
54 | `cont_qq` varchar(20) DEFAULT NULL,
55 | `tech_degree` char(1) DEFAULT NULL,
56 | `more_info` varchar(200) DEFAULT NULL,
57 | `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
58 | PRIMARY KEY (`cont_id`),
59 | KEY `cust_id` (`cust_id`),
60 | CONSTRAINT `contacts_ibfk_1` FOREIGN KEY (`cust_id`) REFERENCES `customers` (`customer_id`)
61 | ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
62 |
63 | -- ----------------------------
64 | -- Records of contacts
65 | -- ----------------------------
66 | INSERT INTO `contacts` VALUES ('5', '1', '張三', 'aa', 'aaaa', 'aaa', 'aaa', 'aaa', 'aaa', '1', 'aaaa', '2018-07-14 01:04:14');
67 | INSERT INTO `contacts` VALUES ('15', '6', '李四', '技术部', '员工', '无', '3123131321', '123', '3123123', '2', 'aaaa', '2018-07-14 08:09:40');
68 |
69 | -- ----------------------------
70 | -- Table structure for customers
71 | -- ----------------------------
72 | DROP TABLE IF EXISTS `customers`;
73 | CREATE TABLE `customers` (
74 | `customer_id` int(11) NOT NULL AUTO_INCREMENT,
75 | `cust_name` varchar(50) NOT NULL,
76 | `cust_type` int(11) NOT NULL,
77 | `cust_background` int(11) NOT NULL,
78 | `listed` char(1) NOT NULL,
79 | `reg_capital` int(11) NOT NULL,
80 | `year_sales` int(11) DEFAULT NULL,
81 | `entp_scale` int(11) DEFAULT NULL,
82 | `tester_no` int(11) DEFAULT NULL,
83 | `url` varchar(50) DEFAULT NULL,
84 | `zip_code` varchar(15) DEFAULT NULL,
85 | `address` varchar(50) DEFAULT NULL,
86 | `main_products` varchar(200) DEFAULT NULL,
87 | `major_services` varchar(200) DEFAULT NULL,
88 | `status` char(1) NOT NULL,
89 | `user_id` int(11) NOT NULL,
90 | `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
91 | PRIMARY KEY (`customer_id`),
92 | KEY `user_id` (`user_id`),
93 | CONSTRAINT `customers_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`)
94 | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
95 |
96 | -- ----------------------------
97 | -- Records of customers
98 | -- ----------------------------
99 | INSERT INTO `customers` VALUES ('1', '学院', '3', '2', '1', '8', '8', '8', '8', 'www', '8', '丽', '白', '无w', '3', '3', '2018-07-23 21:39:17');
100 | INSERT INTO `customers` VALUES ('6', 'm', '1', '1', '1', '5', '3', '5', '3', '5', '3', '5', '3', '3', '2', '1', '2018-07-13 08:43:55');
101 | INSERT INTO `customers` VALUES ('10', 'test1', '3', '2', '2', '6', '6', '6', '6', '6', '6', '6', '6', '6', '1', '3', '2018-07-23 21:39:19');
102 | INSERT INTO `customers` VALUES ('11', 'test2', '3', '2', '2', '6', '6', '6', '6', '6', '6', '6', '6', '6', '2', '1', '2018-07-23 21:39:25');
103 |
104 | -- ----------------------------
105 | -- Table structure for logs
106 | -- ----------------------------
107 | DROP TABLE IF EXISTS `logs`;
108 | CREATE TABLE `logs` (
109 | `log_id` int(11) NOT NULL AUTO_INCREMENT,
110 | `title` varchar(50) NOT NULL,
111 | `desc` varchar(200) DEFAULT NULL,
112 | `cust_id` int(11) NOT NULL,
113 | `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
114 | PRIMARY KEY (`log_id`),
115 | KEY `cust_id` (`cust_id`),
116 | CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`cust_id`) REFERENCES `customers` (`customer_id`)
117 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
118 |
119 | -- ----------------------------
120 | -- Records of logs
121 | -- ----------------------------
122 | INSERT INTO `logs` VALUES ('5', 'u', 'u', '1', '2018-07-11 00:00:00');
123 | INSERT INTO `logs` VALUES ('8', 'ddddd', 'ddddd', '1', '2018-07-06 00:00:00');
124 |
125 | -- ----------------------------
126 | -- Table structure for roles
127 | -- ----------------------------
128 | DROP TABLE IF EXISTS `roles`;
129 | CREATE TABLE `roles` (
130 | `role_id` int(11) NOT NULL AUTO_INCREMENT,
131 | `role_name` varchar(20) NOT NULL,
132 | `role_desc` varchar(255) DEFAULT NULL,
133 | PRIMARY KEY (`role_id`)
134 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
135 |
136 | -- ----------------------------
137 | -- Records of roles
138 | -- ----------------------------
139 |
140 | -- ----------------------------
141 | -- Table structure for users
142 | -- ----------------------------
143 | DROP TABLE IF EXISTS `users`;
144 | CREATE TABLE `users` (
145 | `user_id` int(11) NOT NULL AUTO_INCREMENT,
146 | `user_name` varchar(20) NOT NULL,
147 | `password` varchar(20) NOT NULL,
148 | `sex` varchar(2) NOT NULL,
149 | `birthday` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
150 | `role_id` int(11) NOT NULL,
151 | `status` int(11) NOT NULL,
152 | PRIMARY KEY (`user_id`)
153 | ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
154 |
155 | -- ----------------------------
156 | -- Records of users
157 | -- ----------------------------
158 | INSERT INTO `users` VALUES ('1', 'admin', 'admin', '0', '2018-07-11 18:38:03', '1', '1');
159 | INSERT INTO `users` VALUES ('3', 'abc', '12314', '1', '2018-07-14 08:03:52', '2', '0');
160 | INSERT INTO `users` VALUES ('16', 'test1', '1', '0', '2018-07-14 08:04:01', '3', '1');
161 | INSERT INTO `users` VALUES ('17', 'test2', '1', '1', '1998-08-08 00:00:00', '2', '1');
162 | INSERT INTO `users` VALUES ('18', 'aaaa', '1', '0', '2018-07-14 00:00:00', '3', '0');
163 | SET FOREIGN_KEY_CHECKS=1;
164 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/UsersController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import com.example.cra.entity.Users;
4 | import com.example.cra.service.UsersService;
5 | import com.example.cra.util.SelectUsers;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.web.bind.annotation.*;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import java.text.ParseException;
11 | import java.text.SimpleDateFormat;
12 | import java.util.*;
13 |
14 | @RestController
15 | @RequestMapping("/users")
16 | public class UsersController {
17 | @Autowired
18 | private UsersService usersService;
19 |
20 | //登录
21 | @RequestMapping(value = "/login", method = RequestMethod.POST)
22 | public Map login(@RequestParam("username") String username,
23 | @RequestParam("password") String password, HttpServletRequest request) {
24 | Map map = new HashMap();
25 | Users result = usersService.login(username, password);
26 | if (result != null) {
27 | request.getSession().setAttribute("username", username);
28 | map.put("success", true);
29 | map.put("msg", "登陆成功!");
30 | } else {
31 | map.put("success", false);
32 | map.put("msg", "登陆失败!");
33 | }
34 | return map;
35 | }
36 |
37 | //系统管理员创建用户信息,默认角色为销售
38 | @RequestMapping(value = "/addUsers", method = RequestMethod.POST)
39 | public Map addUsers(HttpServletRequest request) throws ParseException {
40 | Map map = new HashMap();
41 | Users user = new Users();
42 | user.setUser_name(request.getParameter("username"));
43 | user.setPassword(request.getParameter("password"));
44 | user.setSex(request.getParameter("sex"));
45 | Date date = new SimpleDateFormat("yyyy-MM-dd").parse(request.getParameter("birthday"));
46 | user.setBirthday(date);
47 | user.setRole_id(Integer.parseInt(request.getParameter("authority")));
48 | user.setStatus(1);
49 | String result = usersService.createUsers(user);
50 | map.put("msg", result);
51 | return map;
52 | }
53 |
54 | @RequestMapping(value = "/selectUsers", method = RequestMethod.POST)
55 | public Map selectUsers(@RequestParam("select_username") String username,
56 | @RequestParam("select_sex") String sex,
57 | @RequestParam("datemin") String datemin,
58 | @RequestParam("datemax") String datemax,
59 | @RequestParam("select_role") String select_role,
60 | @RequestParam("select_status") String select_status) throws ParseException {
61 | Map map = new HashMap();
62 | SelectUsers selectUsers = new SelectUsers();
63 | selectUsers.setUsername(username);
64 | selectUsers.setSex(sex);
65 | if (datemin != null && datemin != "") {
66 | selectUsers.setDatemin(datemin);
67 | }
68 | if (datemax != null && datemax != "") {
69 | selectUsers.setDatemax(datemax);
70 | }
71 | selectUsers.setSelect_role(Integer.parseInt(select_role));
72 | selectUsers.setSelect_status(Integer.parseInt(select_status));
73 | List users = usersService.selectUsers(selectUsers);
74 | map.put("users", users);
75 | return map;
76 | }
77 |
78 | //修改用户角色
79 | @RequestMapping(value = "/editUsers", method = RequestMethod.POST)
80 | public Map editUsers(@RequestParam("editname") String editname,
81 | @RequestParam("editRole") String editRole) {
82 | Map map = new HashMap();
83 | String result = usersService.editUsers(editname, editRole);
84 | map.put("msg", result);
85 | return map;
86 | }
87 |
88 | //系统管理员对系统所有用户进行删除
89 | @RequestMapping(value = "/delUsers", method = RequestMethod.GET)
90 | public Map delUsers(@RequestParam("del_user_name") String del_user_name) {
91 | Map map = new HashMap();
92 | String result = usersService.delUsers(del_user_name);
93 | map.put("msg", result);
94 | return map;
95 | }
96 |
97 | //系统管理员对系统所有用户进行查看
98 | @RequestMapping(value = "/listUsers", method = RequestMethod.GET)
99 | public Map listUsers() {
100 | Map map = new HashMap();
101 | List users = new ArrayList();
102 | users = usersService.listUsers();
103 | map.put("users", users);
104 | return map;
105 | }
106 |
107 | //获取session
108 | @RequestMapping(value = "/session", method = RequestMethod.POST)
109 | public Map session(HttpServletRequest request) {
110 | Map map = new HashMap();
111 | map.put("session", request.getSession().getAttribute("username"));
112 | return map;
113 | }
114 |
115 | //通过用户名获取用户id
116 | @RequestMapping(value = "/getUserId", method = RequestMethod.GET)
117 | public Map getUserId(@RequestParam("user_name") String user_name) {
118 | Map map = new HashMap();
119 | Integer user_id = usersService.findUserIdByUserName(user_name);
120 | map.put("user_id", user_id);
121 | System.out.println(user_id);
122 | return map;
123 | }
124 |
125 | //检测用户名
126 | @RequestMapping(value = "/checkname", method = RequestMethod.POST)
127 | public Map checkname(@RequestParam("username") String username) {
128 | Map map = new HashMap();
129 | String result = usersService.checkname(username);
130 | map.put("msg", result);
131 | return map;
132 | }
133 |
134 | @RequestMapping(value = "/selectuser", method = RequestMethod.POST)
135 | public Map selectuser(@RequestParam("userid") String user_id) {
136 | Map map = new HashMap();
137 | Users result = usersService.queryuser(Integer.parseInt(user_id));
138 | map.put("users", result);
139 | return map;
140 | }
141 |
142 | @RequestMapping(value = "/updateuser", method = RequestMethod.POST)
143 | public Map updateUser(HttpServletRequest request) throws ParseException {
144 | Map map = new HashMap();
145 | Users user = new Users();
146 | user.setUser_id(Integer.parseInt(request.getParameter("userid")));
147 | user.setUser_name(request.getParameter("username"));
148 | user.setPassword(request.getParameter("password"));
149 | user.setSex(request.getParameter("sex"));
150 | Date date = new SimpleDateFormat("yyyy-MM-dd").parse(request.getParameter("birthday"));
151 | user.setBirthday(date);
152 | user.setRole_id(Integer.parseInt(request.getParameter("authority")));
153 | user.setStatus(Integer.parseInt(request.getParameter("status")));
154 | boolean result = usersService.updateUser(user);
155 | map.put("success",result);
156 | return map;
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/.idea/$CACHE_FILE$:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Abstraction issuesJava
10 |
11 |
12 | Android
13 |
14 |
15 | Assignment issuesJava
16 |
17 |
18 | Bitwise operation issuesJava
19 |
20 |
21 | Bitwise operation issuesJavaScript
22 |
23 |
24 | CDI (Contexts and Dependency Injection)
25 |
26 |
27 | Class metricsJava
28 |
29 |
30 | Class structureJava
31 |
32 |
33 | Cloning issuesJava
34 |
35 |
36 | Code maturityJava
37 |
38 |
39 | Code style issuesJava
40 |
41 |
42 | Code style issuesJavaScript
43 |
44 |
45 | CodePlugin DevKit
46 |
47 |
48 | CodeSpring CoreSpring
49 |
50 |
51 | Compiler issuesJava
52 |
53 |
54 | Control flow issuesJava
55 |
56 |
57 | Control flow issuesJavaScript
58 |
59 |
60 | CorrectnessLintAndroid
61 |
62 |
63 | DOM issuesJavaScript
64 |
65 |
66 | Data flowJava
67 |
68 |
69 | Data flowJavaScript
70 |
71 |
72 | Declaration redundancyJava
73 |
74 |
75 | ECMAScript 6 migration aidsJavaScript
76 |
77 |
78 | EncapsulationJava
79 |
80 |
81 | Error handlingJava
82 |
83 |
84 | Error handlingJavaScript
85 |
86 |
87 | FinalizationJava
88 |
89 |
90 | General
91 |
92 |
93 | GeneralJavaScript
94 |
95 |
96 | Google Web Toolkit
97 |
98 |
99 | Groovy
100 |
101 |
102 | ImportsJava
103 |
104 |
105 | Inheritance issuesJava
106 |
107 |
108 | InitializationJava
109 |
110 |
111 | InternationalizationJava
112 |
113 |
114 | J2ME issuesJava
115 |
116 |
117 | JBoss Seam
118 |
119 |
120 | JSP
121 |
122 |
123 | JUnitJava
124 |
125 |
126 | Java
127 |
128 |
129 | Java 5Java language level migration aidsJava
130 |
131 |
132 | Java 8Java language level migration aidsJava
133 |
134 |
135 | Java 9Java language level migration aidsJava
136 |
137 |
138 | Java EE
139 |
140 |
141 | Java interop issuesKotlin
142 |
143 |
144 | Java language level migration aidsJava
145 |
146 |
147 | JavaBeans issuesJava
148 |
149 |
150 | JavaFX
151 |
152 |
153 | JavaScript
154 |
155 |
156 | JavaScript function metricsJavaScript
157 |
158 |
159 | JavadocJava
160 |
161 |
162 | Kotlin
163 |
164 |
165 | LintAndroid
166 |
167 |
168 | LoggingJava
169 |
170 |
171 | MemoryJava
172 |
173 |
174 | Method metricsJava
175 |
176 |
177 | Naming conventionsJava
178 |
179 |
180 | Nullability problemsProbable bugsJava
181 |
182 |
183 | Numeric issuesJava
184 |
185 |
186 | PerformanceJava
187 |
188 |
189 | PerformanceLintAndroid
190 |
191 |
192 | Plugin DevKit
193 |
194 |
195 | PortabilityJava
196 |
197 |
198 | Potentially confusing code constructsJavaScript
199 |
200 |
201 | Probable bugsGroovy
202 |
203 |
204 | Probable bugsJava
205 |
206 |
207 | Probable bugsJavaScript
208 |
209 |
210 | Probable bugsKotlin
211 |
212 |
213 | SecurityJava
214 |
215 |
216 | SecurityLintAndroid
217 |
218 |
219 | Serialization issuesJava
220 |
221 |
222 | Spring
223 |
224 |
225 | Spring CoreSpring
226 |
227 |
228 | Spring DataSpring
229 |
230 |
231 | Threading issuesGroovy
232 |
233 |
234 | Threading issuesJava
235 |
236 |
237 | UsabilityLintAndroid
238 |
239 |
240 | Verbose or redundant code constructsJava
241 |
242 |
243 | VisibilityJava
244 |
245 |
246 | Web Services
247 |
248 |
249 |
250 |
251 |
252 |
--------------------------------------------------------------------------------
/demo_7_7.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/src/main/java/com/example/cra/controller/CustomersController.java:
--------------------------------------------------------------------------------
1 | package com.example.cra.controller;
2 |
3 | import java.util.Date;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 |
11 | import com.example.cra.entity.Customers;
12 | import com.example.cra.service.CustomersService;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.stereotype.Controller;
15 | import org.springframework.web.bind.annotation.RequestMapping;
16 | import org.springframework.web.bind.annotation.RequestMethod;
17 | import org.springframework.web.bind.annotation.RequestParam;
18 | import org.springframework.web.bind.annotation.ResponseBody;
19 | import org.springframework.web.servlet.ModelAndView;
20 |
21 | @Controller
22 | @RequestMapping(value = "/customers")
23 | public class CustomersController {
24 |
25 | @Autowired
26 | private CustomersService customersService;
27 |
28 | @RequestMapping(value = "/", method = RequestMethod.GET)
29 | public ModelAndView showCustomers(HttpServletResponse response, HttpServletRequest request) {
30 | return new ModelAndView("customer-list");
31 | }
32 |
33 | @RequestMapping(value = "/add", method = RequestMethod.GET)
34 | public ModelAndView addCustomers(HttpServletResponse response, HttpServletRequest request) {
35 | return new ModelAndView("customer-add");
36 | }
37 |
38 | @RequestMapping(value = "/update", method = RequestMethod.GET)
39 | public ModelAndView updateCustomer(HttpServletResponse response, HttpServletRequest request) {
40 | return new ModelAndView("customer-update");
41 | }
42 |
43 | @ResponseBody
44 | @RequestMapping(value = "/getAllCustomers", method = RequestMethod.GET)
45 | public Map getAllCustomers() {
46 | Map map = new HashMap();
47 | List costomersList = customersService.getAllCustomers();
48 | map.put("Customers", costomersList);
49 | return map;
50 | }
51 |
52 | @ResponseBody
53 | @RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
54 | public Map addCustomer(HttpServletRequest request) {
55 | Map map = new HashMap();
56 | Customers customer = new Customers();
57 | customer.setCust_name(request.getParameter("cust_name"));
58 | customer.setCust_type(Integer.valueOf(request.getParameter("cust_type")));
59 | customer.setCust_background(Integer.valueOf(request.getParameter("cust_background")));
60 | customer.setListed(Integer.valueOf(request.getParameter("listed")));
61 | customer.setReg_capital(Integer.valueOf(request.getParameter("reg_capital")));
62 | if (!request.getParameter("year_sales").equals("")) {
63 | customer.setYear_sales(Integer.valueOf(request.getParameter("year_sales")));
64 | }
65 | if (!request.getParameter("entp_scale").equals("")) {
66 | customer.setEntp_scale(Integer.valueOf(request.getParameter("entp_scale")));
67 | }
68 | if (!request.getParameter("tester_no").equals("")) {
69 | customer.setTester_no(Integer.valueOf(request.getParameter("tester_no")));
70 | }
71 | customer.setUrl(request.getParameter("url"));
72 | customer.setZip_code(request.getParameter("zip_code"));
73 | customer.setAddress(request.getParameter("address"));
74 | customer.setMain_products(request.getParameter("main_products"));
75 | customer.setMajor_services(request.getParameter("major_services"));
76 | customer.setStatus(Integer.parseInt(request.getParameter("status")));
77 | customer.setUser_id(1);//待修改
78 | Date date = new Date();
79 | customer.setCreate_time(date);
80 | System.out.println(customer.toString());
81 | if (customersService.insertCustomer(customer) > 0) {
82 | map.put("msg", "新增成功!");
83 | } else {
84 | map.put("msg", "新增失败!");
85 | }
86 | return map;
87 | }
88 |
89 | @ResponseBody
90 | @RequestMapping(value = "/updateShowCustomer", method = RequestMethod.GET)
91 | public Map updateShowCustomer(HttpServletRequest request) {
92 | Map map = new HashMap();
93 | System.out.println(request.getParameter("name"));
94 | Customers customer = customersService.getCustomersByCust_name(request.getParameter("name"));
95 | map.put("Customer", customer);
96 | System.out.println(customer.toString());
97 | return map;
98 | }
99 |
100 | @ResponseBody
101 | @RequestMapping(value = "/updateCustomer", method = RequestMethod.POST)
102 | public Map updateCustomer(HttpServletRequest request) {
103 | Map map = new HashMap();
104 | Customers customer = new Customers();
105 | customer.setCust_name(request.getParameter("cust_name"));
106 | customer.setCust_type(Integer.valueOf(request.getParameter("cust_type")));
107 | customer.setCust_background(Integer.valueOf(request.getParameter("cust_background")));
108 | customer.setListed(Integer.valueOf(request.getParameter("listed")));
109 | customer.setReg_capital(Integer.valueOf(request.getParameter("reg_capital")));
110 | if (!request.getParameter("year_sales").equals("")) {
111 | customer.setYear_sales(Integer.valueOf(request.getParameter("year_sales")));
112 | }
113 | if (!request.getParameter("entp_scale").equals("")) {
114 | customer.setEntp_scale(Integer.valueOf(request.getParameter("entp_scale")));
115 | }
116 | if (!request.getParameter("tester_no").equals("")) {
117 | customer.setTester_no(Integer.valueOf(request.getParameter("tester_no")));
118 | }
119 | customer.setUrl(request.getParameter("url"));
120 | customer.setZip_code(request.getParameter("zip_code"));
121 | customer.setAddress(request.getParameter("address"));
122 | customer.setMain_products(request.getParameter("main_products"));
123 | customer.setMajor_services(request.getParameter("major_services"));
124 | customer.setStatus(Integer.parseInt(request.getParameter("status")));
125 | customer.setUser_id(1);//待修改
126 | System.out.println(customer.toString());
127 | if (customersService.updateCustomer(customer) > 0) {
128 | map.put("msg", "修改成功!");
129 | } else {
130 | map.put("msg", "修改失败!");
131 | }
132 | return map;
133 | }
134 |
135 | @ResponseBody
136 | @RequestMapping(value = "/deleteCustomer", method = RequestMethod.GET)
137 | public Map deleteCustomer(HttpServletRequest request) {
138 | Map map = new HashMap();
139 | if (customersService.deleteCustomerByName(request.getParameter("cust_name")) > 0) {
140 | map.put("msg", "删除成功!");
141 | } else {
142 | map.put("msg", "删除失败!");
143 | }
144 | return map;
145 | }
146 |
147 | @ResponseBody
148 | @RequestMapping(value = "/updateUserId", method = RequestMethod.GET)
149 | public Map updateUserId(@RequestParam("user_id") int user_id, @RequestParam("cust_name") String cust_name) {
150 | Map map = new HashMap();
151 | Customers customer = new Customers();
152 | customer.setCust_name(cust_name);
153 | customer.setUser_id(user_id);
154 | if (customersService.updateCustomer(customer) > 0) {
155 | map.put("msg", "指派成功!");
156 | } else {
157 | map.put("msg", "指派失败!");
158 | }
159 | return map;
160 | }
161 |
162 | @ResponseBody
163 | @RequestMapping(value = "/queryCustomers", method = RequestMethod.GET)
164 | public Map queryCustomers(HttpServletRequest request) {
165 | Map map = new HashMap();
166 | List costomersList;
167 | String cust_name = "";
168 | Integer user_id = null, cust_background = null, listed = null, status = null, cust_type = null;
169 | if (!request.getParameter("ss").equals("")) {
170 | listed = Integer.parseInt(request.getParameter("ss"));
171 | }
172 | if (!request.getParameter("bj").equals("")) {
173 | cust_background = Integer.parseInt(request.getParameter("bj"));
174 | }
175 | if (!request.getParameter("zt").equals("")) {
176 | status = Integer.parseInt(request.getParameter("zt"));
177 | }
178 | if (!request.getParameter("leix").equals("")) {
179 | cust_type = Integer.parseInt(request.getParameter("leix"));
180 | }
181 | if (!request.getParameter("user_id").equals("")) {
182 | user_id = Integer.parseInt(request.getParameter("user_id"));
183 | }
184 | if (!request.getParameter("cname").equals("")) {
185 | cust_name = request.getParameter("cname");
186 | }
187 | // if(user_id.equals(null) && cust_name.equals(null) && cust_background.equals(null) && listed.equals(null)
188 | // && status.equals(null) && cust_type.equals(null)) {
189 | // costomersList = customersService.getAllCustomers();
190 | // }else {
191 | costomersList = customersService.queryCustomers(cust_name, user_id, cust_background, listed, cust_type, status);
192 | System.out.println(costomersList.toString());
193 | System.out.println(cust_name);
194 | // }
195 | map.put("Customers", costomersList);
196 | for (Customers customers : costomersList) {
197 | customers.toString();
198 | }
199 | return map;
200 | }
201 | }
202 |
--------------------------------------------------------------------------------