|
|
@@ -5,16 +5,38 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.customer.service.CustomerService;
|
|
|
+import com.goafanti.common.dao.AdminMapper;
|
|
|
import com.goafanti.common.dao.CustomerMapper;
|
|
|
+import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.Customer;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
@Service
|
|
|
public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implements CustomerService {
|
|
|
@Autowired
|
|
|
private CustomerMapper customerMapper ;
|
|
|
+ @Autowired
|
|
|
+ private AdminMapper adminMapper;
|
|
|
@Override
|
|
|
public int addCustomer(Customer cus) {
|
|
|
int res = customerMapper.insertCustomer(cus);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteCustomer(String id) {
|
|
|
+ customerMapper.deleteCustomerByPrimaryKey(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String findLadderIds(String adminId) {
|
|
|
+ String result = "";
|
|
|
+ Admin admin = adminMapper.selectByPrimaryKey(adminId);
|
|
|
+ if(admin != null && StringUtils.isNotBlank(admin.getSuperiorId())){
|
|
|
+ result += admin.getSuperiorId() + ",";
|
|
|
+ result += findLadderIds(admin.getSuperiorId());
|
|
|
+ }
|
|
|
+ if(!result.equals("")) result = result.substring(0, result.length()-1);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
}
|