|
@@ -1,6 +1,14 @@
|
|
package com.huimv.management.service.impl;
|
|
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.UnitDao;
|
|
|
|
+import com.huimv.management.entity.PastureEntity;
|
|
|
|
+import com.huimv.management.entity.PastureEntity;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -16,14 +24,47 @@ import com.huimv.management.service.PastureService;
|
|
@Service("pastureService")
|
|
@Service("pastureService")
|
|
public class PastureServiceImpl extends ServiceImpl<PastureDao, PastureEntity> implements PastureService {
|
|
public class PastureServiceImpl extends ServiceImpl<PastureDao, PastureEntity> implements PastureService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private PastureDao pastureDao;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<PastureEntity> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
|
+ String keywords = (String) params.get("keywords");
|
|
|
|
+ //没有参数
|
|
|
|
+ if (keywords == null || keywords.equals("")){
|
|
|
|
+ IPage<PastureEntity> page = this.page(
|
|
|
|
+ new Query<PastureEntity>().getPage(params),
|
|
|
|
+ new QueryWrapper<PastureEntity>()
|
|
|
|
+ );
|
|
|
|
+ return new PageUtils(page);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lambdaQuery.like(PastureEntity::getName,keywords);
|
|
|
|
+ IPage<PastureEntity> page = page(this.page(
|
|
|
|
+ new Query<PastureEntity>().getPage(params)
|
|
|
|
+ ), lambdaQuery);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return new PageUtils(page);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List findAll() {
|
|
|
|
+ LambdaQueryWrapper<PastureEntity> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
|
+ List<PastureEntity> pastureEntities = pastureDao.selectList(lambdaQuery);
|
|
|
|
+ return pastureEntities;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* @Override
|
|
|
|
+ public PageUtils queryPage(Map<String, Object> params) {
|
|
IPage<PastureEntity> page = this.page(
|
|
IPage<PastureEntity> page = this.page(
|
|
new Query<PastureEntity>().getPage(params),
|
|
new Query<PastureEntity>().getPage(params),
|
|
new QueryWrapper<PastureEntity>()
|
|
new QueryWrapper<PastureEntity>()
|
|
);
|
|
);
|
|
|
|
|
|
return new PageUtils(page);
|
|
return new PageUtils(page);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
}
|