入库出库

This commit is contained in:
2026-03-20 16:49:29 +08:00
parent 0e38acaca6
commit 1179d90955
2 changed files with 112 additions and 6 deletions

View File

@ -15,8 +15,15 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import com.pictc.datalog.DataOperationContent; import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener; import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.jdbc.JdbcTools;
import com.pictc.jdbc.model.JdbcParam;
import com.pictc.utils.StringUtils;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
@ -99,7 +106,24 @@ public class LngInventoryInController {
@Override @Override
public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) { public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
if(dto.getId() == null) {
params.add(JdbcParam.ofString("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
}); });
return R.ok(res.getId()); return R.ok(res.getId());
@ -119,7 +143,24 @@ public class LngInventoryInController {
@Override @Override
public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) { public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
if(dto.getId() == null) {
params.add(JdbcParam.ofString("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
})); }));
} }
@ -138,7 +179,19 @@ public class LngInventoryInController {
@Override @Override
public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) { public UpdateLngInventoryInDto after(DataOperationContent<UpdateLngInventoryInDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_before_delete(?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
})); }));

View File

@ -15,8 +15,15 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import com.pictc.datalog.DataOperationContent; import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener; import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.jdbc.JdbcTools;
import com.pictc.jdbc.model.JdbcParam;
import com.pictc.utils.StringUtils;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
@ -99,7 +106,24 @@ public class LngInventoryOutController {
@Override @Override
public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) { public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
if(dto.getId() == null) {
params.add(JdbcParam.ofString("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
}); });
return R.ok(res.getId()); return R.ok(res.getId());
@ -119,7 +143,24 @@ public class LngInventoryOutController {
@Override @Override
public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) { public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
if(dto.getId() == null) {
params.add(JdbcParam.ofString("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
})); }));
} }
@ -138,7 +179,19 @@ public class LngInventoryOutController {
@Override @Override
public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) { public UpdateLngInventoryOutDto after(DataOperationContent<UpdateLngInventoryOutDto> content) {
return null; String sql = StringUtils.format("{? = call pc_{0}.f_before_delete(?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
return content.getObj();
} }
})); }));