|
@@ -1,11 +1,21 @@
|
|
package com.huimv.cattle.service.impl;
|
|
package com.huimv.cattle.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.huimv.cattle.pojo.FarmKindCount;
|
|
import com.huimv.cattle.pojo.FarmKindCount;
|
|
import com.huimv.cattle.mapper.FarmKindCountMapper;
|
|
import com.huimv.cattle.mapper.FarmKindCountMapper;
|
|
|
|
+import com.huimv.cattle.pojo.IndustryOutput;
|
|
import com.huimv.cattle.service.FarmKindCountService;
|
|
import com.huimv.cattle.service.FarmKindCountService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.huimv.common.utils.Result;
|
|
|
|
+import com.huimv.common.utils.ResultCode;
|
|
|
|
+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;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 服务实现类
|
|
* 服务实现类
|
|
@@ -16,5 +26,27 @@ import org.springframework.stereotype.Service;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class FarmKindCountServiceImpl extends ServiceImpl<FarmKindCountMapper, FarmKindCount> implements FarmKindCountService {
|
|
public class FarmKindCountServiceImpl extends ServiceImpl<FarmKindCountMapper, FarmKindCount> implements FarmKindCountService {
|
|
|
|
+ @Autowired
|
|
|
|
+ private FarmKindCountMapper farmKindCountMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result getFarmKindCount() {
|
|
|
|
+ List<FarmKindCount> farmKindCount = farmKindCountMapper.getFarmKindCount();
|
|
|
|
+ return new Result(ResultCode.SUCCESS,farmKindCount);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result saveFarmKindCount(Map<String, String> paramsMap) {
|
|
|
|
+ farmKindCountMapper.deleteAll();
|
|
|
|
+ String list = paramsMap.get("list");
|
|
|
|
+ JSONArray listJa = JSONArray.parseArray(list);
|
|
|
|
+ for (int a = listJa.size()-1; a >= 0 ; a--){
|
|
|
|
+ JSONObject jsonObject = listJa.getJSONObject(a);
|
|
|
|
+ FarmKindCount farmKindCount = new FarmKindCount();
|
|
|
|
+ farmKindCount.setFarmKind(jsonObject.getString("farmKind"));
|
|
|
|
+ farmKindCount.setFarmCount(jsonObject.getInteger("farmCount"));
|
|
|
|
+ farmKindCountMapper.insert(farmKindCount);
|
|
|
|
+ }
|
|
|
|
+ return new Result(ResultCode.SUCCESS);
|
|
|
|
+ }
|
|
}
|
|
}
|