You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.4 KiB

/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ccic.safeliab.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ccic.safeliab.entity.Customer;
import com.ccic.safeliab.entity.Device;
import com.ccic.safeliab.entity.User;
import com.ccic.safeliab.support.Condition;
import com.ccic.safeliab.util.CcicUtill;
import com.ccic.safeliab.vo.CustomerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Map;
/**
* 服务实现类
*
* @author edwong
*/
@Service
public class StatisticsServiceImpl implements StatisticsService {
@Autowired
private ICustomerService customerService;
@Override
public Page<Customer> findPage(CustomerVO customer) {
Page<Customer> page = new Page(customer.getPage(), customer.getNum());
QueryWrapper<Customer> wrapper = Condition.getQueryWrapper(customer);
if (!StringUtils.isEmpty(customer.getKeyword())) {
// 客户名称与编号过滤
wrapper.lambda().like(Customer::getCustomerName, customer.getKeyword())
.or()
.like(Customer::getCustomerNo, customer.getKeyword());
}
if (!StringUtils.isEmpty(customer.getTypePid())) {
// 归属机构
wrapper.lambda().eq(Customer::getTypePid, customer.getTypePid());
}
if (!StringUtils.isEmpty(customer.getTypePid())) {
// 管理分类
wrapper.lambda().eq(Customer::getTypePid, customer.getTypePid());
}
wrapper.orderByDesc("changed_at");
customerService.page(page,wrapper);
return page;
}
}