package com.gszc.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.gszc.entity.*;
import com.gszc.entity.Park;
import com.gszc.mapper.IndustryMapper;
import com.gszc.mapper.InvoiceCategoryMapper;
import com.gszc.mapper.ParkMapper;
import com.gszc.mapper.ParkMapper;
import com.gszc.service.IParkService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
*
* 园区 服务实现类
*
*
* @author ky
* @since 2020-05-26
*/
@Service
@Transactional
public class ParkServiceImpl extends ServiceImpl implements IParkService {
@Autowired
ParkMapper parkMapper;
@Autowired
IndustryMapper industryMapper;
@Autowired
InvoiceCategoryMapper invoiceCategoryMapper;
public void addPark(Park park){
String id = UUID.randomUUID().toString();
park.setId(id);
park.setCreateDate(new Date());
park.setModifyDate(new Date());
parkMapper.insert(park);
}
public void deletePark(Park park){
parkMapper.deleteById(park);
}
public void updatePark(Park park){
parkMapper.updateById(park);
}
public List queryParkByCompanyType(String type){
List result = parkMapper.selectList(new EntityWrapper().like("company_category", type).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 queryIndustryList(){
List industryList = industryMapper.selectList(new EntityWrapper().eq("1","1").orderBy("create_date", false));
return industryList;
}
public List queryInvoiceCategoryList(){
List InvoiceCategoryList = invoiceCategoryMapper.selectList(new EntityWrapper().eq("1","1").orderBy("id", true));
return InvoiceCategoryList;
}
public List queryInvoiceCategoryByPark(String parkId) {
List list = new ArrayList<>();
Park park = parkMapper.selectById(parkId);
String invoiceCategory = park.getInvoiceCategory();
String[] split = invoiceCategory.split(",");
for(int i = 0;i());
List result = parkMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper().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 queryParkList(){
List result = parkMapper.selectList(new EntityWrapper().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