调整通用接口返回格式,避免两层
This commit is contained in:
parent
63b0a26a65
commit
cf845501c0
|
@ -2,6 +2,7 @@ package com.hzya.frame.sysnew.comparison.service;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
||||
|
@ -17,7 +18,7 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
|
|||
* @Author hecan
|
||||
* @Date 2024/5/7 15:55
|
||||
* **/
|
||||
JsonResultEntity queryEntityPage(JSONObject jsonObject);
|
||||
Object queryEntityPage(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,7 +28,7 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
|
|||
* @Author hecan
|
||||
* @Date 2024/5/7 16:52
|
||||
* **/
|
||||
JsonResultEntity saveEntity(JSONObject jsonObject);
|
||||
Object saveEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -37,7 +38,7 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
|
|||
* @Author hecan
|
||||
* @Date 2024/5/9 10:19
|
||||
* **/
|
||||
JsonResultEntity updateEntity(JSONObject jsonObject);
|
||||
Object updateEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,7 +48,7 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
|
|||
* @Author hecan
|
||||
* @Date 2024/5/9 13:59
|
||||
* **/
|
||||
JsonResultEntity deleteEntity(JSONObject jsonObject);
|
||||
Object deleteEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//分页查询通用数据数据
|
||||
@Override
|
||||
public JsonResultEntity queryEntityPage(JSONObject json) {
|
||||
public Object queryEntityPage(JSONObject json) {
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
if (jsonObject == null) {
|
||||
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
|
||||
|
@ -122,7 +122,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return BaseResult.getSuccessMessageEntity("查询成功", pageInfo);
|
||||
return pageInfo;
|
||||
} catch (Exception e) {
|
||||
logger.info("查询通用数据错误:{}", e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("查询失败");
|
||||
|
@ -133,7 +133,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//新增通用数据数据
|
||||
@Override
|
||||
public JsonResultEntity saveEntity(JSONObject json) {
|
||||
public Object saveEntity(JSONObject json) {
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
if (jsonObject == null) {
|
||||
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
|
||||
|
@ -330,7 +330,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
list.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","1");
|
||||
return BaseResult.getSuccessMessageEntity("保存成功", list);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
|
@ -345,7 +345,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//更新通用数据数据
|
||||
@Override
|
||||
public JsonResultEntity updateEntity(JSONObject json) {
|
||||
public Object updateEntity(JSONObject json) {
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
if (jsonObject == null) {
|
||||
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
|
||||
|
@ -465,7 +465,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
jsonObjects.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1");
|
||||
return BaseResult.getSuccessMessageEntity("更新成功", jsonObjects);
|
||||
return jsonObjects;
|
||||
}else{
|
||||
return BaseResult.getFailureMessageEntity("更新失败");
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//删除通用数据
|
||||
@Override
|
||||
public JsonResultEntity deleteEntity(JSONObject json) {
|
||||
public Object deleteEntity(JSONObject json) {
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
if (jsonObject == null) {
|
||||
return BaseResult.getFailureMessageEntity("数据为空,请先传递数据");
|
||||
|
@ -575,7 +575,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
||||
}
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1");
|
||||
return BaseResult.getSuccessMessageEntity("删除成功",integer);
|
||||
return integer;
|
||||
}else{
|
||||
return BaseResult.getFailureMessageEntity("删除失败","请查看data_id是否在表中存在");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue