Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
fdebb1e5
Commit
fdebb1e5
authored
Jul 10, 2019
by
季圣华
Browse files
去掉编号函数
parent
10aa65b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
docs/jsh_erp(后续更新参考这个更新).sql
View file @
fdebb1e5
...
...
@@ -1678,3 +1678,9 @@ CREATE TABLE `jsh_tenant` (
-- 给租户表增加数据
-- ----------------------------
INSERT INTO `jsh_tenant` VALUES ('13', '63', 'jsh', '20', '2000', null);
-- ----------------------------
-- 时间:2019年7月10日
-- 删除函数
-- ----------------------------
DROP FUNCTION IF EXISTS `_nextval`;
\ No newline at end of file
docs/jsh_erp(第一次建库请使用这个).sql
View file @
fdebb1e5
...
...
@@ -1908,29 +1908,3 @@ INSERT INTO `jsh_tenant` VALUES ('17', '126', '123123', '2', '200', null);
INSERT INTO `jsh_tenant` VALUES ('17', '127', '2345123', '2', '200', null);
INSERT INTO `jsh_tenant` VALUES ('17', '128', 'q12341243', '2', '200', null);
INSERT INTO `jsh_tenant` VALUES ('17', '130', 'jsh666', '2', '200', null);
-- ----------------------------
-- Function structure for `_nextval`
-- ----------------------------
DROP
FUNCTION
IF
EXISTS
`_nextval`
;
DELIMITER
;;
CREATE
FUNCTION
`_nextval`
(
name
varchar
(
50
))
RETURNS
mediumtext
CHARSET
utf8
begin
declare
_cur
bigint
;
declare
_maxvalue
bigint
;
-- 接收最大值
declare
_increment
int
;
-- 接收增长步数
set
_increment
=
(
select
increment_val
from
tbl_sequence
where
seq_name
=
name
);
set
_maxvalue
=
(
select
max_value
from
tbl_sequence
where
seq_name
=
name
);
set
_cur
=
(
select
current_val
from
tbl_sequence
where
seq_name
=
name
for
update
);
update
tbl_sequence
-- 更新当前值
set
current_val
=
_cur
+
increment_val
where
seq_name
=
name
;
if
(
_cur
+
_increment
>=
_maxvalue
)
then
-- 判断是都达到最大值
update
tbl_sequence
set
current_val
=
minvalue
where
seq_name
=
name
;
end
if
;
return
_cur
;
end
;;
DELIMITER
;
docs/华夏ERP数据库设计汇总.xlsx
View file @
fdebb1e5
No preview for this file type
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
fdebb1e5
...
...
@@ -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
[]);
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
fdebb1e5
...
...
@@ -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
());
...
...
src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
fdebb1e5
...
...
@@ -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"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment