commit
9571b7c766
4 changed files with 847 additions and 510 deletions
@ -0,0 +1,141 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import com.yipin.liuwanr.entity.Customer; |
||||
import com.yipin.liuwanr.entity.UserM; |
||||
import com.yipin.liuwanr.service.CustomerService; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
@RunWith(SpringRunner.class) |
||||
@SpringBootTest |
||||
public class CustomerServiceTest { |
||||
@Autowired |
||||
private CustomerService customerService; |
||||
|
||||
//添加客户
|
||||
@Test |
||||
@Transactional |
||||
public void addCustomer() { |
||||
Customer customer = new Customer(); |
||||
customer.setCountries("测试"); |
||||
customer.setIndustry("测试"); |
||||
customer.setProvinceId(1); |
||||
customer.setAdminName("测试"); |
||||
customer.setAdminPhone("测试"); |
||||
customer.setCityId(1); |
||||
customer.setCustomerType(1); |
||||
customer.setStopTime("测试"); |
||||
customer.setEmail("测试"); |
||||
customer.setSchoolId(1); |
||||
customer.setIndustryClassId(1); |
||||
customer.setIndustryId(1); |
||||
customer.setCustomerName("测试"); |
||||
HashMap<String, Object> map = customerService.addCustomer(customer); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//客户管理添加用户
|
||||
@Test |
||||
@Transactional |
||||
public void addAdmin() { |
||||
UserM userm = new UserM(); |
||||
userm.setCountries("测试"); |
||||
userm.setProvinceId(1); |
||||
userm.setCityId(1); |
||||
userm.setPhone("13137366429"); |
||||
userm.setEmail("123@gmail.com"); |
||||
HashMap<String, Object> map = customerService.addAdmin(userm); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
public void queryCustomer() { |
||||
Customer customer = new Customer(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
|
||||
HashMap<String, Object> map = customerService.queryCustomer(customer, pageNo, pageSize); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
public void queryCustomerDetails() { |
||||
Integer customerId = 10; |
||||
HashMap<String, Object> map = customerService.queryCustomerDetails(customerId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//查询客户是否存在
|
||||
@Test |
||||
public void queryCustomerIsExists() { |
||||
Integer schoolId = 10; |
||||
HashMap<String, Object> map = customerService.queryCustomerIsExists(schoolId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//删除客户
|
||||
@Test |
||||
@Transactional |
||||
public void deleteCustomer() { |
||||
Customer customer = new Customer(); |
||||
customer.setCountries("测试"); |
||||
customer.setIndustry("测试"); |
||||
customer.setProvinceId(1); |
||||
customer.setAdminName("测试"); |
||||
customer.setAdminPhone("测试"); |
||||
customer.setCityId(1); |
||||
customer.setCustomerType(1); |
||||
customer.setStopTime("测试"); |
||||
customer.setEmail("测试"); |
||||
customer.setSchoolId(1); |
||||
customer.setIndustryClassId(1); |
||||
customer.setIndustryId(1); |
||||
customer.setCustomerName("测试"); |
||||
HashMap<String, Object> map = customerService.deleteCustomer(customer); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//更新客户
|
||||
@Test |
||||
@Transactional |
||||
public void updateCustomer() { |
||||
Customer customer = new Customer(); |
||||
customer.setCustomerId(53); |
||||
customer.setCountries("测试"); |
||||
customer.setIndustry("测试"); |
||||
customer.setProvinceId(1); |
||||
customer.setAdminName("测试"); |
||||
customer.setAdminPhone("测试"); |
||||
customer.setCityId(1); |
||||
customer.setCustomerType(1); |
||||
customer.setStopTime("测试"); |
||||
customer.setEmail("测试"); |
||||
customer.setSchoolId(1); |
||||
customer.setIndustryClassId(1); |
||||
customer.setIndustryId(1); |
||||
customer.setCustomerName("测试"); |
||||
HashMap<String, Object> map = customerService.updateCustomer(customer); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//查询行业类
|
||||
@Test |
||||
public void queryCustomerIndustryClass() { |
||||
HashMap<String, Object> map = customerService.queryCustomerIndustryClass(); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//查询行业
|
||||
@Test |
||||
public void queryCustomerIndustry() { |
||||
Integer industryClassId = 10; |
||||
HashMap<String, Object> map = customerService.queryCustomerIndustry(industryClassId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
} |
Loading…
Reference in new issue