/** * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). *

* 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 *

* http://www.apache.org/licenses/LICENSE-2.0 *

* 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 findPage(CustomerVO customer) { Page page = new Page(customer.getPage(), customer.getNum()); QueryWrapper 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; } }