Commit 05709adb authored by zhengyi's avatar zhengyi

竞争对手下拉框数据接口补充模糊匹配参数查询,并最多返回30条数据

parent b207ead5
...@@ -47,7 +47,13 @@ public interface CustomerCompetitorService extends IService<CustomerCompetitorDO ...@@ -47,7 +47,13 @@ public interface CustomerCompetitorService extends IService<CustomerCompetitorDO
* @return 客户竞争对手列表 * @return 客户竞争对手列表
*/ */
List<CustomerCompetitorDO> getCompetitorList(Collection<Long> ids); List<CustomerCompetitorDO> getCompetitorList(Collection<Long> ids);
List<CustomerCompetitorDO> getCompetitorList();
/**
* 搜索
* @param searchKey 关键字
* @return
*/
List<CustomerCompetitorDO> getCompetitorListBySearchKey(String searchKey);
/** /**
* 获得客户竞争对手分页 * 获得客户竞争对手分页
......
...@@ -2,6 +2,10 @@ package cn.iocoder.yudao.module.customer.service.customerCompetitor; ...@@ -2,6 +2,10 @@ package cn.iocoder.yudao.module.customer.service.customerCompetitor;
import java.util.*; import java.util.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
...@@ -76,8 +80,11 @@ public class CustomerCompetitorServiceImpl extends AbstractService<CustomerCompe ...@@ -76,8 +80,11 @@ public class CustomerCompetitorServiceImpl extends AbstractService<CustomerCompe
} }
@Override @Override
public List<CustomerCompetitorDO> getCompetitorList() { public List<CustomerCompetitorDO> getCompetitorListBySearchKey(String searchKey) {
return competitorMapper.selectList(); return competitorMapper.selectList(new LambdaQueryWrapper<CustomerCompetitorDO>()
.like(StringUtils.isNotBlank(searchKey), CustomerCompetitorDO::getName, searchKey)
.orderDesc(CustomerCompetitorDO::getId)
.last("limit 30"));
} }
@Override @Override
......
...@@ -75,9 +75,10 @@ public class CustomerCompetitorController { ...@@ -75,9 +75,10 @@ public class CustomerCompetitorController {
@GetMapping("/listAll") @GetMapping("/listAll")
@ApiOperation("获得所有客户竞争对手列表") @ApiOperation("获得所有客户竞争对手列表")
@ApiImplicitParam(name = "searchKey", value = "关键字", required = false, dataTypeClass = String.class)
// @PreAuthorize("@ss.hasPermission('customer:competitor:query')") // @PreAuthorize("@ss.hasPermission('customer:competitor:query')")
public CommonResult<List<CustomerCompetitorBackVO>> getCompetitorListAll() { public CommonResult<List<CustomerCompetitorBackVO>> getCompetitorListAll(@RequestParam("searchKey") String searchKey) {
List<CustomerCompetitorDO> list = competitorService.getCompetitorList(); List<CustomerCompetitorDO> list = competitorService.getCompetitorListBySearchKey(searchKey);
return success(CustomerCompetitorConvert.INSTANCE.convertList(list)); return success(CustomerCompetitorConvert.INSTANCE.convertList(list));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment