|
@@ -1,6 +1,15 @@
|
|
|
package com.huimv.management.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.huimv.management.dao.PigstyDao;
|
|
|
+import com.huimv.management.entity.UnitEntity;
|
|
|
+import com.huimv.management.entity.UnitEntity;
|
|
|
+import com.huimv.management.entity.UnitEntity;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -16,7 +25,7 @@ import com.huimv.management.service.UnitService;
|
|
|
@Service("unitService")
|
|
|
public class UnitServiceImpl extends ServiceImpl<UnitDao, UnitEntity> implements UnitService {
|
|
|
|
|
|
- @Override
|
|
|
+ /* @Override
|
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
|
IPage<UnitEntity> page = this.page(
|
|
|
new Query<UnitEntity>().getPage(params),
|
|
@@ -24,6 +33,39 @@ public class UnitServiceImpl extends ServiceImpl<UnitDao, UnitEntity> implements
|
|
|
);
|
|
|
|
|
|
return new PageUtils(page);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UnitDao unitDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageUtils queryPage(Map<String, Object> params) {
|
|
|
+
|
|
|
+ LambdaQueryWrapper<UnitEntity> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
+ String keywords = (String) params.get("keywords");
|
|
|
+ //没有参数
|
|
|
+ if (keywords == null || keywords.equals("")){
|
|
|
+ IPage<UnitEntity> page = this.page(
|
|
|
+ new Query<UnitEntity>().getPage(params),
|
|
|
+ new QueryWrapper<UnitEntity>()
|
|
|
+ );
|
|
|
+ return new PageUtils(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ lambdaQuery.like(UnitEntity::getNumber,keywords);
|
|
|
+ IPage<UnitEntity> page = page(this.page(
|
|
|
+ new Query<UnitEntity>().getPage(params)
|
|
|
+ ), lambdaQuery);
|
|
|
+
|
|
|
+
|
|
|
+ return new PageUtils(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List findAll() {
|
|
|
+ LambdaQueryWrapper<UnitEntity> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
+ List<UnitEntity> pastureEntities = unitDao.selectList(lambdaQuery);
|
|
|
+ return pastureEntities;
|
|
|
}
|
|
|
|
|
|
}
|