소스 검색

产业产值村汇总

Newspaper 2 년 전
부모
커밋
b8d2dbf84c

+ 1 - 1
huimv-cattle/src/main/java/com/huimv/cattle/mapper/IndustryOutputMapper.java

@@ -21,5 +21,5 @@ public interface IndustryOutputMapper extends BaseMapper<IndustryOutput> {
 
     void deleteAll(@Param("farmCode") String farmCode);
 
-    List<IndustryOutput> getIndustryOutputScreen();
+    List<IndustryOutput> getIndustryOutputScreen(String[] farmCode);
 }

+ 6 - 1
huimv-cattle/src/main/java/com/huimv/cattle/mapper/xml/IndustryOutputMapper.xml

@@ -19,6 +19,11 @@
         delete from industry_output where farm_code = #{farmCode}
     </delete>
     <select id="getIndustryOutputScreen" resultType="com.huimv.cattle.pojo.IndustryOutput">
-        SELECT SUM(sales_money)  salesMoney, `year`, farm_code FROM  `industry_output`  WHERE farm_code !=0  GROUP BY `year` order by `year` DESC
+        SELECT SUM(sales_money)  salesMoney, `year`, farm_code FROM  `industry_output`
+        WHERE farm_code IN
+        <foreach collection="farmCode"   item="cityCode" open="(" separator="," close=")">
+            #{cityCode}
+        </foreach>
+        GROUP BY `year` order by `year` DESC
     </select>
 </mapper>

+ 26 - 5
huimv-cattle/src/main/java/com/huimv/cattle/service/impl/IndustryOutputServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
 import com.huimv.cattle.pojo.DataSource;
 import com.huimv.cattle.pojo.IndustryOutput;
 import com.huimv.cattle.mapper.IndustryOutputMapper;
@@ -40,6 +41,8 @@ public class IndustryOutputServiceImpl extends ServiceImpl<IndustryOutputMapper,
     private DataSourceService dataSourceService;
     @Autowired
     private DateUtil dateUtil;
+    @Autowired
+    private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
 
     @Override
     public Result getIndustryOutput(HttpServletRequest request, Map<String, String> paramsMap) {
@@ -98,16 +101,34 @@ public class IndustryOutputServiceImpl extends ServiceImpl<IndustryOutputMapper,
 
     @Override
     public Result getIndustryOutputScreen(HttpServletRequest request, Map<String, String> paramsMap) {
+        String farmCode = paramsMap.get("farmCode");
+        if (StringUtils.isBlank(farmCode)) {
+            farmCode = TokenSign.getFarmCode(request);
+        }
         DataSource dataSource = dataSourceService.getDataSourceStatus();
+        String cityCode;
+        String[] city;
+        List<String> subCityList = new ArrayList<>();
         if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==2) {
-            List<IndustryOutput> industryOutputs =  industryOutputMapper.getIndustryOutputScreen();
+            cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
+            city = cityCode.split(",");
+            List<IndustryOutput> industryOutputs =  industryOutputMapper.getIndustryOutputScreen(city);
+            return new Result(ResultCode.SUCCESS,industryOutputs);
+        }else if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==3){
+            cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
+            city = cityCode.split(",");
+            for (String s : city) {
+                String subCityCode = sysRegionCounTownVillMapper.listSub(s);
+                String[] strings = subCityCode.split(",");
+                for (String string : strings) {
+                    subCityList.add(string);
+                }
+            }
+            String[] subCity = subCityList.toArray(new String[subCityList.size()]);
+            List<IndustryOutput> industryOutputs =  industryOutputMapper.getIndustryOutputScreen(subCity);
             return new Result(ResultCode.SUCCESS,industryOutputs);
         }
 
-        String farmCode = paramsMap.get("farmCode");
-        if (StringUtils.isBlank(farmCode)) {
-            farmCode = TokenSign.getFarmCode(request);
-        }
         String yearNum = paramsMap.get("yearNum");
 //        if (StringUtils.isBlank(yearNum)){
 //            yearNum = "0";