去掉编号函数

This commit is contained in:
季圣华
2019-07-10 23:08:02 +08:00
parent 10aa65b7a3
commit fdebb1e565
6 changed files with 17 additions and 30 deletions

View File

@@ -111,10 +111,11 @@ public interface DepotHeadMapperEx {
* */
void updatedepotHead(DepotHead depotHead);
void updateBuildOnlyNumber();
/**
* 获得一个全局唯一的数作为订单号的追加
* */
Long getBuildOnlyNumber(@Param("seq_name") String seq_name);
Long getBuildOnlyNumber(@Param("seq_name") String seq_name);
int batchDeleteDepotHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);

View File

@@ -264,10 +264,12 @@ public class DepotHeadService {
/**
* 创建一个唯一的序列号
* */
public String buildOnlyNumber()throws Exception{
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String buildOnlyNumber()throws Exception{
Long buildOnlyNumber=null;
synchronized (this){
try{
depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
@@ -275,7 +277,6 @@ public class DepotHeadService {
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
}
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());

View File

@@ -434,8 +434,13 @@
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBuildOnlyNumber">
update tbl_sequence set current_val = current_val + 1 where seq_name = 'depot_number_seq'
</update>
<select id="getBuildOnlyNumber" resultType="java.lang.Long">
select _nextval(#{seq_name}) from dual;
select current_val from tbl_sequence where seq_name = 'depot_number_seq'
</select>
<update id="batchDeleteDepotHeadByIds">