CustomerServiceImpl.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.goafanti.admin.service.impl;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. import org.apache.commons.lang3.StringUtils;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7. import com.goafanti.core.mybatis.BaseMybatisDao;
  8. import com.goafanti.admin.service.CustomerService;
  9. import com.goafanti.common.dao.CustomerMapper;
  10. import com.goafanti.common.model.Customer;
  11. import com.goafanti.core.mybatis.page.Pagination;
  12. import com.goafanti.core.shiro.token.TokenManager;
  13. @Service
  14. public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implements CustomerService {
  15. @Autowired
  16. private CustomerMapper customerMapper ;
  17. @Override
  18. public int addCustomer(Customer cus) {
  19. int res = customerMapper.insertCustomer(cus);
  20. return res;
  21. }
  22. @Override
  23. public int deleteCustomer(String id) {
  24. int res = customerMapper.deleteByPrimaryKey(id);
  25. return res;
  26. }
  27. @SuppressWarnings("unchecked")
  28. @Override
  29. public Pagination<Customer> findCustomerByPage(String companyName ,Integer customerTyp ,String province ,String customerName ,String telNum ,
  30. String customerStatue ,String CompanyIntention ,String fllowSituation ,Integer pageNo, Integer pageSize) {
  31. return (Pagination<Customer>) findPage("findSearchCustomerListByPage", "findSearchCustomerCount",
  32. buildListParams(companyName, customerTyp, province, customerName, telNum, customerStatue, CompanyIntention,
  33. fllowSituation, TokenManager.getUserId()),
  34. pageNo, pageSize);
  35. }
  36. private Map<String, Object> buildListParams(String companyName, Integer customerTyp,String province,String customerName,String telNum,
  37. String customerStatue,String CompanyIntention,String fllowSituation,String aid) {
  38. Map<String, Object> params = new HashMap<>();
  39. if (null != companyName) {
  40. params.put("companyName", companyName);
  41. }
  42. if (null!=customerTyp) {
  43. params.put("customerTyp", customerTyp);
  44. }
  45. if (StringUtils.isNotBlank(province)) {
  46. params.put("province", province);
  47. }
  48. if (StringUtils.isNotBlank(customerName)) {
  49. params.put("customerName", customerName);
  50. }
  51. if (null!=customerStatue ) {
  52. params.put("customerStatue", customerStatue);
  53. }
  54. if (StringUtils.isNotBlank(CompanyIntention)) {
  55. params.put("CompanyIntention", CompanyIntention);
  56. }
  57. if (StringUtils.isNotBlank(fllowSituation)) {
  58. params.put("fllowSituation", fllowSituation);
  59. }
  60. if (StringUtils.isNotBlank(aid)) {
  61. params.put("aid", aid);
  62. }
  63. return params;
  64. }
  65. }