开发OTA备案工具
This commit is contained in:
+18
@@ -143,6 +143,24 @@ public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaB
|
||||
return Result.OK(otaBaSjSjxtbh);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过otaId查询
|
||||
*
|
||||
* @param otaId
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-通过otaId查询")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-通过otaId查询", notes = "升级备案-本次升级的系统名称与参数变化-通过otaId查询")
|
||||
@GetMapping(value = "/queryByOtaId")
|
||||
public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
|
||||
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
|
||||
JSONObject json = otaBaSjSjxtbhService.queryByOtaId(otaId, otaIdT);
|
||||
if (json == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
|
||||
+2
@@ -57,4 +57,6 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
||||
* @return
|
||||
*/
|
||||
List<OtaBaSjSjxtbh> queryList();
|
||||
|
||||
JSONObject queryByOtaId(String otaId, String otaIdT);
|
||||
}
|
||||
|
||||
+32
@@ -1,17 +1,22 @@
|
||||
package com.jero.modules.ota.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
|
||||
import com.jero.modules.ota.entity.OtaBaCxList;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
@@ -32,6 +37,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
||||
String otaId = (String) json.get("otaId");
|
||||
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(otaId)) {
|
||||
deleteByOtaId(otaId);
|
||||
JSONArray list = json.getJSONArray("list");
|
||||
for (Object obj : list) {
|
||||
OtaBaSjSjxtbh bh = JSONObject.parseObject(obj.toString(), OtaBaSjSjxtbh.class);
|
||||
@@ -99,4 +105,30 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
||||
public List<OtaBaSjSjxtbh> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryByOtaId(String otaId, String otaIdT) {
|
||||
List<OtaBaSjSjxtbh> res = this.getByOtaId(otaId);
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
res = getByOtaId(otaIdT);
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("list", res);
|
||||
return json;
|
||||
}
|
||||
|
||||
private List<OtaBaSjSjxtbh> getByOtaId(String otaId) {
|
||||
LambdaQueryWrapper<OtaBaSjSjxtbh> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OtaBaSjSjxtbh::getOtaId, otaId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
public void deleteByOtaId(String otaId) {
|
||||
List<OtaBaSjSjxtbh> list = this.getByOtaId(otaId);
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (OtaBaSjSjxtbh bh : list) {
|
||||
ids.add(bh.getId());
|
||||
}
|
||||
this.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user