ky 5 years ago
parent fecf1a7c4e
commit c379ca2977

@ -1,6 +1,7 @@
package com.gszc.controller; package com.gszc.controller;
import com.alibaba.fastjson.JSONObject;
import com.gszc.build.Result; import com.gszc.build.Result;
import com.gszc.build.ResultBuilder; import com.gszc.build.ResultBuilder;
import com.gszc.entity.Industry; import com.gszc.entity.Industry;
@ -48,5 +49,37 @@ public class MiniParkController {
return ResultBuilder.withPayload(invoiceCategories).build(); return ResultBuilder.withPayload(invoiceCategories).build();
} }
@PostMapping("/queryIndustryList")
@ApiOperation(value = "查看行业类型", notes = "查看行业类型")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result queryIndustryList() {
List<Industry> industries = parkService.queryIndustryList();
return ResultBuilder.withPayload(industries).build();
}
@PostMapping("/queryInvoiceCategoryList")
@ApiOperation(value = "查看开票类型", notes = "查看开票类型")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result queryInvoiceCategoryList() {
List<InvoiceCategory> invoiceCategories = parkService.queryInvoiceCategoryList();
return ResultBuilder.withPayload(invoiceCategories).build();
}
@PostMapping("/queryParkList")
@ApiOperation(value = "查看park", notes = "查看park")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result queryParkList() {
List<Park> parks = parkService.queryParkList();
return ResultBuilder.withPayload(parks).build();
}
} }

@ -75,6 +75,9 @@ public class Park extends Model<Park> {
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
@TableField(exist = false) @TableField(exist = false)
private JSONArray industry; private JSONArray industry;
@ApiModelProperty(hidden = true)
@TableField(exist = false)
private JSONArray invoiceCategoryList;
@Override @Override

@ -100,11 +100,53 @@ public class ParkServiceImpl extends ServiceImpl<ParkMapper, Park> implements IP
Integer count = parkMapper.selectCount(new EntityWrapper<Park>()); Integer count = parkMapper.selectCount(new EntityWrapper<Park>());
List<Park> result = parkMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper<Park>().eq("1", "1").orderBy("create_date", false)); List<Park> result = parkMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper<Park>().eq("1", "1").orderBy("create_date", false));
for(Park park:result){
String industryCategory = park.getIndustryCategory();
String[] split = industryCategory.split(",");
JSONArray jsonArray = new JSONArray();
for(int i=0;i<split.length;i++){
Industry industry = industryMapper.selectById(split[i]);
jsonArray.add(industry);
}
park.setIndustry(jsonArray);
String invoiceCategory = park.getInvoiceCategory();
String[] split1 = invoiceCategory.split(",");
JSONArray jsonArray1 = new JSONArray();
for(int i=0;i<split1.length;i++){
InvoiceCategory invoiceCategory1 = invoiceCategoryMapper.selectById(split1[i]);
jsonArray1.add(invoiceCategory1);
}
park.setInvoiceCategoryList(jsonArray1);
}
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("count",count); jsonObject.put("count",count);
jsonObject.put("data",result); jsonObject.put("data",result);
return jsonObject; return jsonObject;
} }
public List<Park> queryParkList(){
List<Park> result = parkMapper.selectList(new EntityWrapper<Park>().eq("1", "1").orderBy("create_date", false));
for(Park park:result){
String industryCategory = park.getIndustryCategory();
String[] split = industryCategory.split(",");
JSONArray jsonArray = new JSONArray();
for(int i=0;i<split.length;i++){
Industry industry = industryMapper.selectById(split[i]);
jsonArray.add(industry);
}
park.setIndustry(jsonArray);
String invoiceCategory = park.getInvoiceCategory();
String[] split1 = invoiceCategory.split(",");
JSONArray jsonArray1 = new JSONArray();
for(int i=0;i<split1.length;i++){
InvoiceCategory invoiceCategory1 = invoiceCategoryMapper.selectById(split1[i]);
jsonArray1.add(invoiceCategory1);
}
park.setInvoiceCategoryList(jsonArray1);
}
return result;
}
} }

Loading…
Cancel
Save