新增羊群结构后端接口
This commit is contained in:
parent
896d12b9b1
commit
77b0c4e0d1
@ -73,4 +73,31 @@ public class SheepFileController extends BaseController
|
||||
return success(sheep);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/stat/sheepType")
|
||||
public AjaxResult statSheepType() {
|
||||
return success(sheepFileService.countBySheepType());
|
||||
}
|
||||
|
||||
@GetMapping("/stat/breedStatus")
|
||||
public AjaxResult statBreedStatus() {
|
||||
return success(sheepFileService.countByBreedStatus());
|
||||
}
|
||||
|
||||
@GetMapping("/stat/variety")
|
||||
public AjaxResult statVariety() {
|
||||
return success(sheepFileService.countByVariety());
|
||||
}
|
||||
|
||||
@GetMapping("/stat/lactationParity")
|
||||
public AjaxResult statLactationParity() {
|
||||
return success(sheepFileService.countParityOfLactation());
|
||||
}
|
||||
|
||||
// 在群总数
|
||||
@GetMapping("/stat/inGroupCount")
|
||||
public AjaxResult inGroupCount() {
|
||||
return success(sheepFileService.countInGroup());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.zhyc.module.base.domain.SheepFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 羊只档案Mapper接口
|
||||
@ -38,4 +39,25 @@ public interface SheepFileMapper
|
||||
* @return 结果
|
||||
*/
|
||||
SheepFile selectSheepByManageTags(String tags);
|
||||
|
||||
|
||||
// 在群羊只总数
|
||||
Long countInGroup();
|
||||
|
||||
|
||||
// 羊只类别分布(按 name 分组)
|
||||
List<Map<String,Object>> countBySheepType();
|
||||
|
||||
// 繁育状态分布(按 breed 分组)
|
||||
List<Map<String,Object>> countByBreedStatus();
|
||||
|
||||
// 品种分布(按 variety 分组)
|
||||
List<Map<String,Object>> countByVariety();
|
||||
|
||||
// 泌乳羊胎次分布(name = '泌乳羊' 时按 parity 分组)
|
||||
List<Map<String,Object>> countParityOfLactation();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.zhyc.module.base.service;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 羊只档案Service接口
|
||||
@ -30,4 +31,11 @@ public interface ISheepFileService
|
||||
|
||||
|
||||
SheepFile selectBasSheepByManageTags(String trim);
|
||||
|
||||
Long countInGroup();
|
||||
|
||||
List<Map<String,Object>> countBySheepType();
|
||||
List<Map<String,Object>> countByBreedStatus();
|
||||
List<Map<String,Object>> countByVariety();
|
||||
List<Map<String,Object>> countParityOfLactation();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import com.zhyc.module.base.service.ISheepFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.List;import java.util.Map;
|
||||
|
||||
/**
|
||||
* 羊只档案Service业务层处理
|
||||
@ -47,4 +47,28 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
return sheepFileMapper.selectSheepByManageTags(tags);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> countBySheepType() {
|
||||
return sheepFileMapper.countBySheepType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> countByBreedStatus() {
|
||||
return sheepFileMapper.countByBreedStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> countByVariety() {
|
||||
return sheepFileMapper.countByVariety();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> countParityOfLactation() {
|
||||
return sheepFileMapper.countParityOfLactation();
|
||||
}
|
||||
@Override
|
||||
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
|
||||
|
||||
|
||||
}
|
||||
|
@ -100,4 +100,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 在群羊只总数 -->
|
||||
<select id="countInGroup" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1
|
||||
</select>
|
||||
|
||||
<!-- 羊只类别分布 -->
|
||||
<select id="countBySheepType" resultType="java.util.Map">
|
||||
SELECT name AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY name
|
||||
</select>
|
||||
|
||||
<!-- 繁育状态分布 -->
|
||||
<select id="countByBreedStatus" resultType="java.util.Map">
|
||||
SELECT breed AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY breed
|
||||
</select>
|
||||
|
||||
<!-- 品种分布 -->
|
||||
<select id="countByVariety" resultType="java.util.Map">
|
||||
SELECT variety AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY variety
|
||||
</select>
|
||||
|
||||
<!-- 泌乳羊胎次分布 -->
|
||||
<select id="countParityOfLactation" resultType="java.util.Map">
|
||||
SELECT parity AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND name = '泌乳羊'
|
||||
GROUP BY parity
|
||||
ORDER BY parity
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user