1、删除无用demo代码
2、添加主数据模块项目
This commit is contained in:
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.pictc.jdbc.JdbcTools;
|
||||
import com.pictc.jdbc.model.JdbcParam;
|
||||
import com.pictc.utils.ListUtils;
|
||||
import com.pictc.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 通用保存、删除、启用、作废存储过程调用
|
||||
* 通用 CommonCallService
|
||||
* 合同 ContractCallService
|
||||
* 采购 ProcurementCallService
|
||||
* 销售 SalesCallService
|
||||
* 运输 TransportCallService
|
||||
* 储备 ReserveCallService
|
||||
* 财务 FinanceCallService
|
||||
*/
|
||||
@Component
|
||||
public class CommonCallService {
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
一、新增、修改记录时,在同一个事务里执行如下过程:
|
||||
1、更新表;
|
||||
2、调用数据库函数pc_表名.f_save(表主键);
|
||||
3、函数返回非空、或者数据库异常时rollback,函数返回空时commit;
|
||||
* @param table 表名
|
||||
* @param id 表主键
|
||||
* @return String 返回类型 函数返回非空、或者数据库异常时rollback,函数返回空时commit;
|
||||
*/
|
||||
public String saveAfter(String table,Long id) {
|
||||
String sql = StringUtils.format("{? = call pc_{0}.f_save(?)}",table);
|
||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(id));
|
||||
JdbcTools.call(sql,params);
|
||||
return outParam.getStringValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
二、删除记录时,在同一个事务里执行如下过程:
|
||||
1、调用数据库函数pc_表名.f_delete(表主键);
|
||||
2、函数返回非空、或者数据库异常时rollback,函数返回空时commit;
|
||||
* @return
|
||||
* @return String 返回类型
|
||||
*/
|
||||
public String deleteBefore(String table,Long id) {
|
||||
String sql = StringUtils.format("{? = call pc_{0}.f_delete(?)}",table);
|
||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(id));
|
||||
JdbcTools.call(sql,params);
|
||||
return outParam.getStringValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
二、停用时,在同一个事务里执行如下过程:
|
||||
1、调用数据库函数pc_表名.f_off(表主键);
|
||||
2、函数返回非空、或者数据库异常时rollback,函数返回空时commit;
|
||||
* @return
|
||||
* @return String 返回类型
|
||||
*/
|
||||
public String disableBefore(String table,Long id) {
|
||||
String sql = StringUtils.format("{? = call pc_{0}.f_off(?)}",table);
|
||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(id));
|
||||
JdbcTools.call(sql,params);
|
||||
return outParam.getStringValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
1、调用数据库函数pc_表名.f_on(表主键);
|
||||
2、函数返回非空、或者数据库异常时rollback,函数返回空时commit;
|
||||
* @return
|
||||
* @return String 返回类型
|
||||
*/
|
||||
public String enableBefore(String table,Long id) {
|
||||
String sql = StringUtils.format("{? = call pc_{0}.f_on(?)}",table);
|
||||
List<JdbcParam> params = ListUtils.newArrayList(JdbcParam.ofLong(id));
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(id));
|
||||
JdbcTools.call(sql,params);
|
||||
return outParam.getStringValue();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 合同相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class ContractCallService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 财务相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class FinanceCallService {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 采购相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class ProcurementCallService {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 储备相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class ReserveCallService {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 销售相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class SalesCallService {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.common.db.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 张福财
|
||||
* @date 2025年10月14日 上午11:47:59
|
||||
* @Description: 运输相关的存储过程
|
||||
*/
|
||||
@Component
|
||||
public class TransportCallService {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user