|  |  |  | 
|---|
|  |  |  | package com.moral.api.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.moral.api.entity.Supervision; | 
|---|
|  |  |  | import com.moral.api.entity.SysArea; | 
|---|
|  |  |  | import com.moral.api.mapper.SupervisionMapper; | 
|---|
|  |  |  | import com.moral.api.service.SupervisionService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.moral.api.service.SysAreaService; | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.util.FileUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SupervisionMapper supervisionMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysAreaService sysAreaService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | 
|---|
|  |  |  | supervisionMapper.selectPage(supervisionPage, queryWrapper); | 
|---|
|  |  |  | List<Supervision> supervisions = supervisionPage.getRecords(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取区域名字 | 
|---|
|  |  |  | List<Map<String, Object>> item = new ArrayList<>(); | 
|---|
|  |  |  | QueryWrapper<SysArea> sysAreaQueryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | sysAreaQueryWrapper.eq("area_code", cityCode); | 
|---|
|  |  |  | SysArea one = sysAreaService.getOne(sysAreaQueryWrapper); | 
|---|
|  |  |  | String cityName = one.getAreaName(); | 
|---|
|  |  |  | for (Supervision supervision : supervisions) { | 
|---|
|  |  |  | Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(supervision), Map.class); | 
|---|
|  |  |  | map.remove("isDelete"); | 
|---|
|  |  |  | map.remove("createTime"); | 
|---|
|  |  |  | map.remove("updateTime"); | 
|---|
|  |  |  | map.put("cityName", cityName); | 
|---|
|  |  |  | item.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> result = new LinkedHashMap<>(); | 
|---|
|  |  |  | result.put("total", supervisionPage.getTotal()); | 
|---|
|  |  |  | result.put("totalPage", supervisionPage.getPages()); | 
|---|
|  |  |  | result.put("current", supervisionPage.getCurrent()); | 
|---|
|  |  |  | result.put("pageSize", supervisionPage.getSize()); | 
|---|
|  |  |  | result.put("item", supervisions); | 
|---|
|  |  |  | result.put("item", item); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|