Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz企业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz企业套件
iBiz企业中心
提交
78873fec
提交
78873fec
编写于
6月 28, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chitanda 发布系统代码
上级
4a66b0e7
变更
9
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
1053 行增加
和
433 行删除
+1053
-433
view-tool.ts
app_CRM/src/utils/view-tool/view-tool.ts
+38
-34
ProductServiceImpl.java
...central/core/product/service/impl/ProductServiceImpl.java
+3
-0
Inventory.java
.../ibizlab/businesscentral/core/stock/domain/Inventory.java
+128
-0
InventorySearchContext.java
...nesscentral/core/stock/filter/InventorySearchContext.java
+61
-0
InventoryMapper.java
...ab/businesscentral/core/stock/mapper/InventoryMapper.java
+67
-0
IInventoryService.java
...businesscentral/core/stock/service/IInventoryService.java
+63
-0
InventoryServiceImpl.java
...central/core/stock/service/impl/InventoryServiceImpl.java
+219
-0
h2_table.xml
...esscentral-core/src/main/resources/liquibase/h2_table.xml
+425
-399
InventoryMapper.xml
...main/resources/mapper/stock/inventory/InventoryMapper.xml
+49
-0
未找到文件。
app_CRM/src/utils/view-tool/view-tool.ts
浏览文件 @
78873fec
...
@@ -43,7 +43,7 @@ export class ViewTool {
...
@@ -43,7 +43,7 @@ export class ViewTool {
// 视图常规参数
// 视图常规参数
Object
.
assign
(
viewdata
,
data
);
Object
.
assign
(
viewdata
,
data
);
// 传入父视图的srfsessionid
// 传入父视图的srfsessionid
Object
.
assign
(
viewdata
,
{
srfsessionid
:
viewParam
[
'srfsessionid'
]
});
Object
.
assign
(
viewdata
,
{
srfsessionid
:
viewParam
[
'srfsessionid'
]
});
return
viewdata
;
return
viewdata
;
}
}
...
@@ -63,7 +63,7 @@ export class ViewTool {
...
@@ -63,7 +63,7 @@ export class ViewTool {
public
static
buildUpRoutePath
(
route
:
Route
,
viewParam
:
any
=
{},
deResParameters
:
any
[],
parameters
:
any
[],
args
:
any
[],
data
:
any
):
string
{
public
static
buildUpRoutePath
(
route
:
Route
,
viewParam
:
any
=
{},
deResParameters
:
any
[],
parameters
:
any
[],
args
:
any
[],
data
:
any
):
string
{
const
indexRoutePath
=
this
.
getIndexRoutePath
(
route
);
const
indexRoutePath
=
this
.
getIndexRoutePath
(
route
);
const
deResRoutePath
=
this
.
getDeResRoutePath
(
viewParam
,
deResParameters
,
args
);
const
deResRoutePath
=
this
.
getDeResRoutePath
(
viewParam
,
deResParameters
,
args
);
const
deRoutePath
=
this
.
getActiveRoutePath
(
parameters
,
args
,
data
);
const
deRoutePath
=
this
.
getActiveRoutePath
(
parameters
,
args
,
data
,
viewParam
);
return
`
${
indexRoutePath
}${
deResRoutePath
}${
deRoutePath
}
`
;
return
`
${
indexRoutePath
}${
deResRoutePath
}${
deRoutePath
}
`
;
}
}
...
@@ -99,15 +99,17 @@ export class ViewTool {
...
@@ -99,15 +99,17 @@ export class ViewTool {
let
routePath
:
string
=
''
;
let
routePath
:
string
=
''
;
let
[
arg
]
=
args
;
let
[
arg
]
=
args
;
arg
=
arg
?
arg
:
{};
arg
=
arg
?
arg
:
{};
deResParameters
.
forEach
(({
pathName
,
parameterName
}:
{
pathName
:
string
,
parameterName
:
string
})
=>
{
if
(
deResParameters
&&
deResParameters
.
length
>
0
)
{
let
value
:
any
=
null
;
deResParameters
.
forEach
(({
pathName
,
parameterName
}:
{
pathName
:
string
,
parameterName
:
string
})
=>
{
if
(
viewParam
[
parameterName
]
&&
!
Object
.
is
(
viewParam
[
parameterName
],
''
)
&&
!
Object
.
is
(
viewParam
[
parameterName
],
'null'
))
{
let
value
:
any
=
null
;
value
=
viewParam
[
parameterName
];
if
(
viewParam
[
parameterName
]
&&
!
Object
.
is
(
viewParam
[
parameterName
],
''
)
&&
!
Object
.
is
(
viewParam
[
parameterName
],
'null'
))
{
}
else
if
(
arg
[
parameterName
]
&&
!
Object
.
is
(
arg
[
parameterName
],
''
)
&&
!
Object
.
is
(
arg
[
parameterName
],
'null'
))
{
value
=
viewParam
[
parameterName
];
value
=
arg
[
parameterName
];
}
else
if
(
arg
[
parameterName
]
&&
!
Object
.
is
(
arg
[
parameterName
],
''
)
&&
!
Object
.
is
(
arg
[
parameterName
],
'null'
))
{
}
value
=
arg
[
parameterName
];
routePath
=
`
${
routePath
}
/
${
pathName
}
`
+
(
value
!==
null
?
`/
${
value
}
`
:
''
);
}
});
routePath
=
`
${
routePath
}
/
${
pathName
}
`
+
(
value
!==
null
?
`/
${
value
}
`
:
''
);
});
}
return
routePath
;
return
routePath
;
}
}
...
@@ -118,27 +120,29 @@ export class ViewTool {
...
@@ -118,27 +120,29 @@ export class ViewTool {
* @param {any[]} parameters 当前应用视图参数对象
* @param {any[]} parameters 当前应用视图参数对象
* @param {any[]} args 多项数据
* @param {any[]} args 多项数据
* @param {*} data 行为参数
* @param {*} data 行为参数
* @param {*} [viewParam={}] 上下文数据
* @returns {string}
* @returns {string}
* @memberof ViewTool
* @memberof ViewTool
*/
*/
public
static
getActiveRoutePath
(
parameters
:
any
[],
args
:
any
[],
data
:
any
):
string
{
public
static
getActiveRoutePath
(
parameters
:
any
[],
args
:
any
[],
data
:
any
,
viewParam
:
any
=
{}
):
string
{
let
routePath
:
string
=
''
;
let
routePath
:
string
=
''
;
// 不存在应用实体
// 不存在应用实体
if
(
parameters
.
length
===
1
)
{
if
(
parameters
&&
parameters
.
length
>
0
)
{
const
[{
pathName
,
parameterName
}]
=
parameters
;
if
(
parameters
.
length
===
1
)
{
routePath
=
`/
${
pathName
}
`
;
const
[{
pathName
,
parameterName
}]
=
parameters
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
routePath
=
`/
${
pathName
}
`
;
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
data
,
{
delimiter
:
';'
})}
`
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
}
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
data
,
{
delimiter
:
';'
})}
`
;
}
else
if
(
parameters
.
length
===
2
)
{
}
let
[
arg
]
=
args
;
}
else
if
(
parameters
.
length
===
2
)
{
arg
=
arg
?
arg
:
{};
let
[
arg
]
=
args
;
const
[{
pathName
:
_pathName
,
parameterName
:
_parameterName
},
{
pathName
:
_pathName2
,
parameterName
:
_parameterName2
}]
=
parameters
;
arg
=
arg
?
arg
:
{};
const
_value
:
any
=
arg
[
_parameterName
]
&&
!
Object
.
is
(
arg
[
_parameterName
],
''
)
?
const
[{
pathName
:
_pathName
,
parameterName
:
_parameterName
},
{
pathName
:
_pathName2
,
parameterName
:
_parameterName2
}]
=
parameters
;
arg
[
_parameterName
]
:
null
;
const
_value
:
any
=
arg
[
_parameterName
]
||
viewParam
[
_parameterName
]
||
null
;
routePath
=
`/
${
_pathName
}
/
${
_value
}
/
${
_pathName2
}
`
;
routePath
=
`/
${
_pathName
}${((
_value
!==
null
&&
!
Object
.
is
(
_value
,
''
))
?
`/
${
_value
}
`
:
''
)}
/
${
_pathName2
}
`
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
if
(
Object
.
keys
(
data
).
length
>
0
)
{
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
data
,
{
delimiter
:
';'
})}
`
;
routePath
=
`
${
routePath
}
?
${
qs
.
stringify
(
data
,
{
delimiter
:
';'
})}
`
;
}
}
}
}
}
return
routePath
;
return
routePath
;
...
@@ -152,8 +156,8 @@ export class ViewTool {
...
@@ -152,8 +156,8 @@ export class ViewTool {
* @returns {*}
* @returns {*}
* @memberof ViewTool
* @memberof ViewTool
*/
*/
public
static
formatRouteParams
(
params
:
any
,
route
:
any
,
context
:
any
,
viewparams
:
any
):
void
{
public
static
formatRouteParams
(
params
:
any
,
route
:
any
,
context
:
any
,
viewparams
:
any
):
void
{
Object
.
keys
(
params
).
forEach
((
key
:
string
,
index
:
number
)
=>
{
Object
.
keys
(
params
).
forEach
((
key
:
string
,
index
:
number
)
=>
{
const
param
:
string
|
null
|
undefined
=
params
[
key
];
const
param
:
string
|
null
|
undefined
=
params
[
key
];
if
(
!
param
||
Object
.
is
(
param
,
''
)
||
Object
.
is
(
param
,
'null'
))
{
if
(
!
param
||
Object
.
is
(
param
,
''
)
||
Object
.
is
(
param
,
'null'
))
{
return
;
return
;
...
@@ -165,11 +169,11 @@ export class ViewTool {
...
@@ -165,11 +169,11 @@ export class ViewTool {
Object
.
assign
(
context
,
{
[
key
]:
param
});
Object
.
assign
(
context
,
{
[
key
]:
param
});
}
}
});
});
if
(
route
&&
route
.
fullPath
&&
route
.
fullPath
.
indexOf
(
"?"
)
>
-
1
)
{
if
(
route
&&
route
.
fullPath
&&
route
.
fullPath
.
indexOf
(
"?"
)
>
-
1
)
{
const
_viewparams
:
any
=
route
.
fullPath
.
slice
(
route
.
fullPath
.
indexOf
(
"?"
)
+
1
);
const
_viewparams
:
any
=
route
.
fullPath
.
slice
(
route
.
fullPath
.
indexOf
(
"?"
)
+
1
);
const
_viewparamArray
:
Array
<
string
>
=
decodeURIComponent
(
_viewparams
).
split
(
";"
)
const
_viewparamArray
:
Array
<
string
>
=
decodeURIComponent
(
_viewparams
).
split
(
";"
)
if
(
_viewparamArray
.
length
>
0
)
{
if
(
_viewparamArray
.
length
>
0
)
{
_viewparamArray
.
forEach
((
item
:
any
)
=>
{
_viewparamArray
.
forEach
((
item
:
any
)
=>
{
Object
.
assign
(
viewparams
,
qs
.
parse
(
item
));
Object
.
assign
(
viewparams
,
qs
.
parse
(
item
));
})
})
}
}
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/product/service/impl/ProductServiceImpl.java
浏览文件 @
78873fec
...
@@ -52,6 +52,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
...
@@ -52,6 +52,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
private
cn
.
ibizlab
.
businesscentral
.
core
.
service
.
service
.
IIncidentService
incidentService
;
private
cn
.
ibizlab
.
businesscentral
.
core
.
service
.
service
.
IIncidentService
incidentService
;
@Autowired
@Autowired
@Lazy
@Lazy
private
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
service
.
IInventoryService
inventoryService
;
@Autowired
@Lazy
private
cn
.
ibizlab
.
businesscentral
.
core
.
finance
.
service
.
IInvoiceDetailService
invoicedetailService
;
private
cn
.
ibizlab
.
businesscentral
.
core
.
finance
.
service
.
IInvoiceDetailService
invoicedetailService
;
@Autowired
@Autowired
@Lazy
@Lazy
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/stock/domain/Inventory.java
0 → 100644
浏览文件 @
78873fec
package
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
domain
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.DigestUtils
;
import
cn.ibizlab.businesscentral.util.domain.EntityBase
;
import
cn.ibizlab.businesscentral.util.annotation.DEField
;
import
cn.ibizlab.businesscentral.util.enums.DEPredefinedFieldType
;
import
cn.ibizlab.businesscentral.util.enums.DEFieldDefaultValueType
;
import
java.io.Serializable
;
import
lombok.*
;
import
org.springframework.data.annotation.Transient
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.ibizlab.businesscentral.util.domain.EntityMP
;
/**
* 实体[库存]
*/
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties
(
value
=
"handler"
)
@TableName
(
value
=
"T_INVENTORY"
,
resultMap
=
"InventoryResultMap"
)
public
class
Inventory
extends
EntityMP
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 库存标识
*/
@DEField
(
isKeyField
=
true
)
@TableId
(
value
=
"inventoryid"
,
type
=
IdType
.
ASSIGN_UUID
)
@JSONField
(
name
=
"inventoryid"
)
@JsonProperty
(
"inventoryid"
)
private
String
inventoryid
;
/**
* 库存名称
*/
@TableField
(
value
=
"inventoryname"
)
@JSONField
(
name
=
"inventoryname"
)
@JsonProperty
(
"inventoryname"
)
private
String
inventoryname
;
/**
* 建立人
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEMAN
)
@TableField
(
value
=
"createman"
,
fill
=
FieldFill
.
INSERT
)
@JSONField
(
name
=
"createman"
)
@JsonProperty
(
"createman"
)
private
String
createman
;
/**
* 更新人
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEMAN
)
@TableField
(
value
=
"updateman"
)
@JSONField
(
name
=
"updateman"
)
@JsonProperty
(
"updateman"
)
private
String
updateman
;
/**
* 建立时间
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEDATE
)
@TableField
(
value
=
"createdate"
,
fill
=
FieldFill
.
INSERT
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"createdate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"createdate"
)
private
Timestamp
createdate
;
/**
* 更新时间
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEDATE
)
@TableField
(
value
=
"updatedate"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
/**
* 产品
*/
@TableField
(
value
=
"productid"
)
@JSONField
(
name
=
"productid"
)
@JsonProperty
(
"productid"
)
private
String
productid
;
/**
* 产品
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
@TableField
(
exist
=
false
)
private
cn
.
ibizlab
.
businesscentral
.
core
.
product
.
domain
.
Product
product
;
/**
* 设置 [库存名称]
*/
public
void
setInventoryname
(
String
inventoryname
){
this
.
inventoryname
=
inventoryname
;
this
.
modify
(
"inventoryname"
,
inventoryname
);
}
/**
* 设置 [产品]
*/
public
void
setProductid
(
String
productid
){
this
.
productid
=
productid
;
this
.
modify
(
"productid"
,
productid
);
}
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/stock/filter/InventorySearchContext.java
0 → 100644
浏览文件 @
78873fec
package
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
filter
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.HashMap
;
import
lombok.*
;
import
lombok.extern.slf4j.Slf4j
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
cn.ibizlab.businesscentral.util.filter.QueryWrapperContext
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.ibizlab.businesscentral.core.stock.domain.Inventory
;
/**
* 关系型数据实体[Inventory] 查询条件对象
*/
@Slf4j
@Data
public
class
InventorySearchContext
extends
QueryWrapperContext
<
Inventory
>
{
private
String
n_inventoryname_like
;
//[库存名称]
public
void
setN_inventoryname_like
(
String
n_inventoryname_like
)
{
this
.
n_inventoryname_like
=
n_inventoryname_like
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_inventoryname_like
)){
this
.
getSearchCond
().
like
(
"inventoryname"
,
n_inventoryname_like
);
}
}
private
String
n_productid_eq
;
//[产品]
public
void
setN_productid_eq
(
String
n_productid_eq
)
{
this
.
n_productid_eq
=
n_productid_eq
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_productid_eq
)){
this
.
getSearchCond
().
eq
(
"productid"
,
n_productid_eq
);
}
}
/**
* 启用快速搜索
*/
public
void
setQuery
(
String
query
)
{
this
.
query
=
query
;
if
(!
StringUtils
.
isEmpty
(
query
)){
this
.
getSearchCond
().
and
(
wrapper
->
wrapper
.
like
(
"inventoryname"
,
query
)
);
}
}
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/stock/mapper/InventoryMapper.java
0 → 100644
浏览文件 @
78873fec
package
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.*
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
java.util.HashMap
;
import
org.apache.ibatis.annotations.Select
;
import
cn.ibizlab.businesscentral.core.stock.domain.Inventory
;
import
cn.ibizlab.businesscentral.core.stock.filter.InventorySearchContext
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
java.io.Serializable
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.alibaba.fastjson.JSONObject
;
public
interface
InventoryMapper
extends
BaseMapper
<
Inventory
>{
Page
<
Inventory
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
InventorySearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
Inventory
>
wrapper
)
;
@Override
Inventory
selectById
(
Serializable
id
);
@Override
int
insert
(
Inventory
entity
);
@Override
int
updateById
(
@Param
(
Constants
.
ENTITY
)
Inventory
entity
);
@Override
int
update
(
@Param
(
Constants
.
ENTITY
)
Inventory
entity
,
@Param
(
"ew"
)
Wrapper
<
Inventory
>
updateWrapper
);
@Override
int
deleteById
(
Serializable
id
);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select
(
"${sql}"
)
List
<
JSONObject
>
selectBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update
(
"${sql}"
)
boolean
updateBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert
(
"${sql}"
)
boolean
insertBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete
(
"${sql}"
)
boolean
deleteBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
List
<
Inventory
>
selectByProductid
(
@Param
(
"productid"
)
Serializable
productid
)
;
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/stock/service/IInventoryService.java
0 → 100644
浏览文件 @
78873fec
package
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
service
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.util.Collection
;
import
java.math.BigInteger
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cache.annotation.CacheEvict
;
import
cn.ibizlab.businesscentral.core.stock.domain.Inventory
;
import
cn.ibizlab.businesscentral.core.stock.filter.InventorySearchContext
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* 实体[Inventory] 服务对象接口
*/
public
interface
IInventoryService
extends
IService
<
Inventory
>{
boolean
remove
(
String
key
)
;
void
removeBatch
(
Collection
<
String
>
idList
)
;
Inventory
getDraft
(
Inventory
et
)
;
boolean
checkKey
(
Inventory
et
)
;
boolean
update
(
Inventory
et
)
;
void
updateBatch
(
List
<
Inventory
>
list
)
;
boolean
save
(
Inventory
et
)
;
void
saveBatch
(
List
<
Inventory
>
list
)
;
Inventory
get
(
String
key
)
;
boolean
create
(
Inventory
et
)
;
void
createBatch
(
List
<
Inventory
>
list
)
;
Page
<
Inventory
>
searchDefault
(
InventorySearchContext
context
)
;
List
<
Inventory
>
selectByProductid
(
String
productid
)
;
void
removeByProductid
(
String
productid
)
;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return select * from table where id = '1'
*/
List
<
JSONObject
>
select
(
String
sql
,
Map
param
);
/**
*自定义SQL
* @param sql update table set name ='test' where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return update table set name ='test' where id = '1'
*/
boolean
execute
(
String
sql
,
Map
param
);
List
<
Inventory
>
getInventoryByIds
(
List
<
String
>
ids
)
;
List
<
Inventory
>
getInventoryByEntities
(
List
<
Inventory
>
entities
)
;
}
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/stock/service/impl/InventoryServiceImpl.java
0 → 100644
浏览文件 @
78873fec
package
cn
.
ibizlab
.
businesscentral
.
core
.
stock
.
service
.
impl
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Map
;
import
java.util.HashSet
;
import
java.util.HashMap
;
import
java.util.Collection
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.math.BigInteger
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.context.annotation.Lazy
;
import
cn.ibizlab.businesscentral.core.stock.domain.Inventory
;
import
cn.ibizlab.businesscentral.core.stock.filter.InventorySearchContext
;
import
cn.ibizlab.businesscentral.core.stock.service.IInventoryService
;
import
cn.ibizlab.businesscentral.util.helper.CachedBeanCopier
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.businesscentral.core.stock.mapper.InventoryMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.util.StringUtils
;
/**
* 实体[库存] 服务对象接口实现
*/
@Slf4j
@Service
(
"InventoryServiceImpl"
)
public
class
InventoryServiceImpl
extends
ServiceImpl
<
InventoryMapper
,
Inventory
>
implements
IInventoryService
{
@Autowired
@Lazy
private
cn
.
ibizlab
.
businesscentral
.
core
.
product
.
service
.
IProductService
productService
;
private
int
batchSize
=
500
;
@Override
@Transactional
public
boolean
remove
(
String
key
)
{
boolean
result
=
removeById
(
key
);
return
result
;
}
@Override
public
void
removeBatch
(
Collection
<
String
>
idList
)
{
removeByIds
(
idList
);
}
@Override
public
Inventory
getDraft
(
Inventory
et
)
{
return
et
;
}
@Override
public
boolean
checkKey
(
Inventory
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getInventoryid
()))&&(!
Objects
.
isNull
(
this
.
getById
(
et
.
getInventoryid
())));
}
@Override
@Transactional
public
boolean
update
(
Inventory
et
)
{
if
(!
update
(
et
,(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"inventoryid"
,
et
.
getInventoryid
())))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getInventoryid
()),
et
);
return
true
;
}
@Override
public
void
updateBatch
(
List
<
Inventory
>
list
)
{
updateBatchById
(
list
,
batchSize
);
}
@Override
@Transactional
public
boolean
save
(
Inventory
et
)
{
if
(!
saveOrUpdate
(
et
))
return
false
;
return
true
;
}
@Override
@Transactional
(
rollbackFor
=
{
Exception
.
class
}
)
public
boolean
saveOrUpdate
(
Inventory
et
)
{
if
(
null
==
et
)
{
return
false
;
}
else
{
return
checkKey
(
et
)
?
this
.
update
(
et
)
:
this
.
create
(
et
);
}
}
@Override
public
boolean
saveBatch
(
Collection
<
Inventory
>
list
)
{
saveOrUpdateBatch
(
list
,
batchSize
);
return
true
;
}
@Override
public
void
saveBatch
(
List
<
Inventory
>
list
)
{
saveOrUpdateBatch
(
list
,
batchSize
);
}
@Override
@Transactional
public
Inventory
get
(
String
key
)
{
Inventory
et
=
getById
(
key
);
if
(
et
==
null
){
et
=
new
Inventory
();
et
.
setInventoryid
(
key
);
}
else
{
}
return
et
;
}
@Override
@Transactional
public
boolean
create
(
Inventory
et
)
{
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getInventoryid
()),
et
);
return
true
;
}
@Override
public
void
createBatch
(
List
<
Inventory
>
list
)
{
this
.
saveBatch
(
list
,
batchSize
);
}
@Override
public
List
<
Inventory
>
selectByProductid
(
String
productid
)
{
return
baseMapper
.
selectByProductid
(
productid
);
}
@Override
public
void
removeByProductid
(
String
productid
)
{
this
.
remove
(
new
QueryWrapper
<
Inventory
>().
eq
(
"productid"
,
productid
));
}
/**
* 查询集合 DEFAULT
*/
@Override
public
Page
<
Inventory
>
searchDefault
(
InventorySearchContext
context
)
{
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
<
Inventory
>
pages
=
baseMapper
.
searchDefault
(
context
.
getPages
(),
context
,
context
.
getSelectCond
());
return
new
PageImpl
<
Inventory
>(
pages
.
getRecords
(),
context
.
getPageable
(),
pages
.
getTotal
());
}
@Override
public
List
<
JSONObject
>
select
(
String
sql
,
Map
param
){
return
this
.
baseMapper
.
selectBySQL
(
sql
,
param
);
}
@Override
@Transactional
public
boolean
execute
(
String
sql
,
Map
param
){
if
(
sql
==
null
||
sql
.
isEmpty
())
{
return
false
;
}
if
(
sql
.
toLowerCase
().
trim
().
startsWith
(
"insert"
))
{
return
this
.
baseMapper
.
insertBySQL
(
sql
,
param
);
}
if
(
sql
.
toLowerCase
().
trim
().
startsWith
(
"update"
))
{
return
this
.
baseMapper
.
updateBySQL
(
sql
,
param
);
}
if
(
sql
.
toLowerCase
().
trim
().
startsWith
(
"delete"
))
{
return
this
.
baseMapper
.
deleteBySQL
(
sql
,
param
);
}
log
.
warn
(
"暂未支持的SQL语法"
);
return
true
;
}
@Override
public
List
<
Inventory
>
getInventoryByIds
(
List
<
String
>
ids
)
{
return
this
.
listByIds
(
ids
);
}
@Override
public
List
<
Inventory
>
getInventoryByEntities
(
List
<
Inventory
>
entities
)
{
List
ids
=
new
ArrayList
();
for
(
Inventory
entity
:
entities
){
Serializable
id
=
entity
.
getInventoryid
();
if
(!
ObjectUtils
.
isEmpty
(
id
)){
ids
.
add
(
id
);
}
}
if
(
ids
.
size
()>
0
)
return
this
.
listByIds
(
ids
);
else
return
entities
;
}
}
businesscentral-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
78873fec
因为 它太大了无法显示 源差异 。您可以改为
查看blob
。
businesscentral-core/src/main/resources/mapper/stock/inventory/InventoryMapper.xml
0 → 100644
浏览文件 @
78873fec
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.ibizlab.businesscentral.core.stock.mapper.InventoryMapper"
>
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select
id=
"selectById"
resultMap=
"InventoryResultMap"
databaseId=
"mysql"
>
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`INVENTORYID`, t1.`INVENTORYNAME`, t1.`PRODUCTID`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_INVENTORY` t1 ) t1 where inventoryid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap
id=
"InventoryResultMap"
type=
"cn.ibizlab.businesscentral.core.stock.domain.Inventory"
autoMapping=
"true"
>
<id
property=
"inventoryid"
column=
"inventoryid"
/>
<!--主键字段映射-->
<result
property=
"productid"
column=
"productid"
/>
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association
property=
"product"
javaType=
"cn.ibizlab.businesscentral.core.product.domain.Product"
column=
"productid"
select=
"cn.ibizlab.businesscentral.core.product.mapper.ProductMapper.selectById"
fetchType=
"lazy"
></association>
</resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_INVENTORY_PRODUCT_PRODUCTID] -->
<select
id=
"selectByProductid"
resultMap=
"InventoryResultMap"
>
select t1.* from (
<include
refid=
"Default"
/>
) t1
where productid=#{productid}
</select>
<!--数据集合[Default]-->
<select
id=
"searchDefault"
parameterType=
"cn.ibizlab.businesscentral.core.stock.filter.InventorySearchContext"
resultMap=
"InventoryResultMap"
>
select t1.* from (
<include
refid=
"Default"
/>
)t1
<where><if
test=
"ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere"
>
${ew.sqlSegment}
</if></where>
<if
test=
"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere"
>
${ew.sqlSegment}
</if>
</select>
<!--数据查询[Default]-->
<sql
id=
"Default"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`INVENTORYID`, t1.`INVENTORYNAME`, t1.`PRODUCTID`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_INVENTORY` t1
]]>
</sql>
<!--数据查询[View]-->
<sql
id=
"View"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`INVENTORYID`, t1.`INVENTORYNAME`, t1.`PRODUCTID`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_INVENTORY` t1
]]>
</sql>
</mapper>
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录