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
2539f768
Commit
2539f768
authored
Jan 23, 2019
by
季圣华
Browse files
!20 添加新增序列号功能
Merge pull request !20 from 乾坤平台/master
parents
dd6f7d8a
e5262b09
Changes
34
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
0 → 100644
View file @
2539f768
package
com.jsh.erp.exception
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
javax.servlet.http.HttpServletRequest
;
@Slf4j
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
(
value
=
Exception
.
class
)
@ResponseBody
public
Object
handleException
(
Exception
e
,
HttpServletRequest
request
)
{
JSONObject
status
=
new
JSONObject
();
// 针对业务参数异常的处理
if
(
e
instanceof
BusinessParamCheckingException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessParamCheckingException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
((
BusinessParamCheckingException
)
e
).
getReason
());
return
status
;
}
//针对业务运行时异常的处理
if
(
e
instanceof
BusinessRunTimeException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessRunTimeException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
((
BusinessRunTimeException
)
e
).
getReason
());
return
status
;
}
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_CODE
);
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_MSG
);
log
.
error
(
"Global Exception Occured => url : {}, msg : {}"
,
request
.
getRequestURL
(),
e
.
getMessage
());
e
.
printStackTrace
();
return
status
;
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
2539f768
...
...
@@ -5,6 +5,7 @@ import com.jsh.erp.datasource.entities.Material;
import
com.jsh.erp.datasource.entities.MaterialExample
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
...
...
@@ -25,6 +26,8 @@ public class MaterialService {
@Resource
private
MaterialMapper
materialMapper
;
@Resource
private
MaterialMapperEx
materialMapperEx
;
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -38,7 +41,7 @@ public class MaterialService {
public
List
<
MaterialVo4Unit
>
select
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
,
int
offset
,
int
rows
)
{
String
[]
mpArr
=
mpList
.
split
(
","
);
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapper
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
List
<
MaterialVo4Unit
>
list
=
materialMapper
Ex
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
//扩展信息
...
...
@@ -71,7 +74,7 @@ public class MaterialService {
}
public
int
countMaterial
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
)
{
return
materialMapper
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
return
materialMapper
Ex
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
...
...
@@ -88,9 +91,9 @@ public class MaterialService {
int
res
=
materialMapper
.
updateByPrimaryKeySelective
(
material
);
Long
unitId
=
material
.
getUnitid
();
if
(
unitId
!=
null
)
{
materialMapper
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
materialMapper
Ex
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
}
else
{
materialMapper
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
materialMapper
Ex
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
}
return
res
;
}
...
...
@@ -146,15 +149,15 @@ public class MaterialService {
}
public
String
findUnitName
(
Long
mId
){
return
materialMapper
.
findUnitName
(
mId
);
return
materialMapper
Ex
.
findUnitName
(
mId
);
}
public
List
<
MaterialVo4Unit
>
findById
(
Long
id
){
return
materialMapper
.
findById
(
id
);
return
materialMapper
Ex
.
findById
(
id
);
}
public
List
<
MaterialVo4Unit
>
findBySelect
(){
return
materialMapper
.
findBySelect
();
return
materialMapper
Ex
.
findBySelect
();
}
public
List
<
Material
>
findByOrder
(){
...
...
@@ -165,7 +168,7 @@ public class MaterialService {
public
List
<
MaterialVo4Unit
>
findByAll
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
)
{
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapper
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
List
<
MaterialVo4Unit
>
list
=
materialMapper
Ex
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
resList
.
add
(
m
);
...
...
src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java
0 → 100644
View file @
2539f768
package
com.jsh.erp.service.serialNumber
;
import
com.jsh.erp.service.ICommonQuery
;
import
com.jsh.erp.service.material.MaterialResource
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.utils.Constants
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 16:33
*/
@Service
(
value
=
"serialNumber_component"
)
@SerialNumberResource
public
class
SerialNumberComponent
implements
ICommonQuery
{
@Resource
private
SerialNumberService
serialNumberService
;
@Override
public
Object
selectOne
(
String
condition
)
{
return
null
;
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
return
getSerialNumberList
(
map
);
}
private
List
<?>
getSerialNumberList
(
Map
<
String
,
String
>
map
)
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
serialNumber
=
StringUtil
.
getInfo
(
search
,
"serialNumber"
);
String
materialName
=
StringUtil
.
getInfo
(
search
,
"materialName"
);
return
serialNumberService
.
select
(
serialNumber
,
materialName
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
@Override
public
int
counts
(
Map
<
String
,
String
>
map
)
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
serialNumber
=
StringUtil
.
getInfo
(
search
,
"serialNumber"
);
String
materialName
=
StringUtil
.
getInfo
(
search
,
"materialName"
);
return
serialNumberService
.
countSerialNumber
(
serialNumber
,
materialName
);
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
return
serialNumberService
.
insertSerialNumber
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
return
serialNumberService
.
updateSerialNumber
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
return
serialNumberService
.
deleteSerialNumber
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
return
serialNumberService
.
batchDeleteSerialNumber
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
serialNumber
)
{
return
serialNumberService
.
checkIsNameExist
(
id
,
serialNumber
);
}
}
src/main/java/com/jsh/erp/service/serialNumber/SerialNumberResource.java
0 → 100644
View file @
2539f768
package
com.jsh.erp.service.serialNumber
;
import
com.jsh.erp.service.ResourceInfo
;
import
java.lang.annotation.*
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 16:33
*/
@ResourceInfo
(
value
=
"serialNumber"
,
type
=
105
)
@Inherited
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
SerialNumberResource
{
}
src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
0 → 100644
View file @
2539f768
package
com.jsh.erp.service.serialNumber
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.datasource.mappers.SerialNumberMapper
;
import
com.jsh.erp.datasource.mappers.SerialNumberMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 16:33
*/
@Service
public
class
SerialNumberService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
MaterialService
.
class
);
@Resource
private
SerialNumberMapper
serialNumberMapper
;
@Resource
private
SerialNumberMapperEx
serialNumberMapperEx
;
@Resource
private
MaterialMapperEx
materialMapperEx
;
public
SerialNumber
getSerialNumber
(
long
id
)
{
return
serialNumberMapper
.
selectByPrimaryKey
(
id
);
}
public
List
<
SerialNumber
>
getSerialNumber
()
{
SerialNumberExample
example
=
new
SerialNumberExample
();
return
serialNumberMapper
.
selectByExample
(
example
);
}
public
List
<
SerialNumberEx
>
select
(
String
serialNumber
,
String
materialName
,
Integer
offset
,
Integer
rows
)
{
return
serialNumberMapperEx
.
selectByConditionSerialNumber
(
serialNumber
,
materialName
,
offset
,
rows
);
}
public
int
countSerialNumber
(
String
serialNumber
,
String
materialName
)
{
return
serialNumberMapperEx
.
countSerialNumber
(
serialNumber
,
materialName
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertSerialNumber
(
String
beanJson
,
HttpServletRequest
request
)
{
SerialNumber
serialNumber
=
JSONObject
.
parseObject
(
beanJson
,
SerialNumber
.
class
);
return
serialNumberMapper
.
insertSelective
(
serialNumber
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateSerialNumber
(
String
beanJson
,
Long
id
)
{
SerialNumber
serialNumber
=
JSONObject
.
parseObject
(
beanJson
,
SerialNumber
.
class
);
serialNumber
.
setId
(
id
);
int
res
=
serialNumberMapper
.
updateByPrimaryKeySelective
(
serialNumber
);
return
res
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteSerialNumber
(
Long
id
)
{
return
serialNumberMapper
.
deleteByPrimaryKey
(
id
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteSerialNumber
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
SerialNumberExample
example
=
new
SerialNumberExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
serialNumberMapper
.
deleteByExample
(
example
);
}
public
int
checkIsNameExist
(
Long
id
,
String
serialNumber
)
{
SerialNumberExample
example
=
new
SerialNumberExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andSerialNumberEqualTo
(
serialNumber
);
List
<
SerialNumber
>
list
=
serialNumberMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetEnable
(
Boolean
enabled
,
String
materialIDs
)
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
materialIDs
);
SerialNumber
serialNumber
=
new
SerialNumber
();
SerialNumberExample
example
=
new
SerialNumberExample
();
example
.
createCriteria
().
andIdIn
(
ids
);
return
serialNumberMapper
.
updateByExampleSelective
(
serialNumber
,
example
);
}
public
List
<
SerialNumberEx
>
findById
(
Long
id
){
return
serialNumberMapperEx
.
findById
(
id
);
}
public
void
checkIsExist
(
Long
id
,
String
materialName
,
String
serialNumber
)
{
/**
* 商品名称不为空时,检查商品名称是否存在
* */
if
(
StringUtil
.
isNotEmpty
(
materialName
)){
List
<
Material
>
mlist
=
materialMapperEx
.
findByMaterialName
(
materialName
);
if
(
mlist
==
null
||
mlist
.
size
()<
1
){
//商品名称不存在
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_EXISTS_CODE
,
ExceptionConstants
.
MATERIAL_NOT_EXISTS__MSG
);
}
else
if
(
mlist
.
size
()>
1
){
//商品信息不唯一
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_ONLY_CODE
,
ExceptionConstants
.
MATERIAL_NOT_ONLY__MSG
);
}
}
/***
* 判断序列号是否已存在
* */
List
<
SerialNumberEx
>
list
=
serialNumberMapperEx
.
findBySerialNumber
(
serialNumber
);
if
(
list
!=
null
&&
list
.
size
()>
0
){
if
(
list
.
size
()>
1
){
//存在多个同名序列号
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
,
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
);
}
else
{
//存在一个序列号
if
(
id
==
null
){
//新增,存在要添加的序列号
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
,
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
);
}
if
(
id
.
equals
(
list
.
get
(
0
).
getId
())){
//修改的是同一条数据
}
else
{
//存在一条不同的序列号信息
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
,
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
);
}
}
}
}
/**
* 新增序列号信息
* */
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
SerialNumberEx
addSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
if
(
serialNumberEx
==
null
){
return
null
;
}
/**处理商品id*/
if
(
serialNumberEx
.
getMaterialId
()==
null
){
if
(
StringUtil
.
isNotEmpty
(
serialNumberEx
.
getMaterialName
())){
List
<
Material
>
mlist
=
materialMapperEx
.
findByMaterialName
(
serialNumberEx
.
getMaterialName
());
if
(
mlist
==
null
||
mlist
.
size
()<
1
){
//商品名称不存在
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_EXISTS_CODE
,
ExceptionConstants
.
MATERIAL_NOT_EXISTS__MSG
);
}
else
if
(
mlist
.
size
()>
1
){
//商品信息不唯一
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_ONLY_CODE
,
ExceptionConstants
.
MATERIAL_NOT_ONLY__MSG
);
}
else
{
serialNumberEx
.
setMaterialId
(
mlist
.
get
(
0
).
getId
());
}
}
}
//删除标记,默认未删除
serialNumberEx
.
setDeleteFlag
(
false
);
//已卖出,默认未否
serialNumberEx
.
setIsSell
(
false
);
Date
date
=
new
Date
();
serialNumberEx
.
setCreateTime
(
date
);
serialNumberEx
.
setUpdateTime
(
date
);
HttpServletRequest
request
=
((
ServletRequestAttributes
)
Objects
.
requireNonNull
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
User
userInfo
=(
User
)
request
.
getSession
().
getAttribute
(
"user"
);
serialNumberEx
.
setCreator
(
userInfo
==
null
?
null
:
userInfo
.
getId
());
serialNumberEx
.
setUpdater
(
userInfo
==
null
?
null
:
userInfo
.
getId
());
int
result
=
serialNumberMapperEx
.
addSerialNumber
(
serialNumberEx
);
if
(
result
==
1
){
return
serialNumberEx
;
}
return
null
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
SerialNumberEx
updateSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
if
(
serialNumberEx
==
null
){
return
null
;
}
/**处理商品id*/
if
(
StringUtil
.
isNotEmpty
(
serialNumberEx
.
getMaterialName
())){
List
<
Material
>
mlist
=
materialMapperEx
.
findByMaterialName
(
serialNumberEx
.
getMaterialName
());
if
(
mlist
==
null
||
mlist
.
size
()<
1
){
//商品名称不存在
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_EXISTS_CODE
,
ExceptionConstants
.
MATERIAL_NOT_EXISTS__MSG
);
}
else
if
(
mlist
.
size
()>
1
){
//商品信息不唯一
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_NOT_ONLY_CODE
,
ExceptionConstants
.
MATERIAL_NOT_ONLY__MSG
);
}
else
{
serialNumberEx
.
setMaterialId
(
mlist
.
get
(
0
).
getId
());
}
}
Date
date
=
new
Date
();
serialNumberEx
.
setUpdateTime
(
date
);
HttpServletRequest
request
=
((
ServletRequestAttributes
)
Objects
.
requireNonNull
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
User
userInfo
=(
User
)
request
.
getSession
().
getAttribute
(
"user"
);
serialNumberEx
.
setUpdater
(
userInfo
==
null
?
null
:
userInfo
.
getId
());
int
result
=
serialNumberMapperEx
.
updateSerialNumber
(
serialNumberEx
);
if
(
result
==
1
){
return
serialNumberEx
;
}
return
null
;
}
}
src/main/java/com/jsh/erp/utils/JsonUtils.java
View file @
2539f768
package
com.jsh.erp.utils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
/**
* Created by jishenghua 2018-5-11 09:48:08
*
* @author jishenghua
*/
public
class
JsonUtils
{
public
static
JSONObject
ok
(){
JSONObject
obj
=
new
JSONObject
();
JSONObject
tmp
=
new
JSONObject
();
tmp
.
put
(
"message"
,
"成功"
);
obj
.
put
(
"code"
,
200
);
obj
.
put
(
"data"
,
tmp
);
return
obj
;
}
}
package
com.jsh.erp.utils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
/**
* Created by jishenghua 2018-5-11 09:48:08
*
* @author jishenghua
*/
public
class
JsonUtils
{
public
static
JSONObject
ok
(){
JSONObject
obj
=
new
JSONObject
();
JSONObject
tmp
=
new
JSONObject
();
tmp
.
put
(
"message"
,
"成功"
);
obj
.
put
(
"code"
,
200
);
obj
.
put
(
"data"
,
tmp
);
return
obj
;
}
}
src/main/java/com/jsh/erp/utils/ResponseJsonUtil.java
View file @
2539f768
package
com.jsh.erp.utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.ValueFilter
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.TimeZone
;
public
class
ResponseJsonUtil
{
public
static
final
SimpleDateFormat
FORMAT
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
{
FORMAT
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
}
/**
* 响应过滤器
*/
public
static
final
class
ResponseFilter
extends
ExtJsonUtils
.
ExtFilter
implements
ValueFilter
{
@Override
public
Object
process
(
Object
object
,
String
name
,
Object
value
)
{
if
(
name
.
equals
(
"createTime"
)
||
name
.
equals
(
"modifyTime"
))
{
return
value
;
}
else
if
(
value
instanceof
Date
)
{
return
FORMAT
.
format
(
value
);
}
else
{
return
value
;
}
}
}
/**
*
* @param responseCode
* @return
*/
public
static
String
backJson4HttpApi
(
ResponseCode
responseCode
)
{
if
(
responseCode
!=
null
)
{
String
result
=
JSON
.
toJSONString
(
responseCode
,
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
result
=
result
.
replaceFirst
(
"\"data\":\\{"
,
""
);
return
result
.
substring
(
0
,
result
.
length
()
-
1
);
}
return
null
;
}
/**
* 验证失败的json串
* @param code
* @return
*/
public
static
String
backJson4VerifyFailure
(
int
code
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"message"
,
"未通过验证"
);
return
JSON
.
toJSONString
(
new
ResponseCode
(
code
,
map
),
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
}
/**
* 成功的json串
* @param responseCode
* @return
*/
public
static
String
backJson
(
ResponseCode
responseCode
)
{
if
(
responseCode
!=
null
)
{
return
JSON
.
toJSONString
(
responseCode
,
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
}
return
null
;
}
public
static
String
returnJson
(
Map
<
String
,
Object
>
map
,
String
message
,
int
code
)
{
map
.
put
(
"message"
,
message
);
return
backJson
(
new
ResponseCode
(
code
,
map
));
}
}
package
com.jsh.erp.utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.ValueFilter
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.TimeZone
;
public
class
ResponseJsonUtil
{
public
static
final
SimpleDateFormat
FORMAT
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
{
FORMAT
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
}
/**
* 响应过滤器
*/
public
static
final
class
ResponseFilter
extends
ExtJsonUtils
.
ExtFilter
implements
ValueFilter
{
@Override
public
Object
process
(
Object
object
,
String
name
,
Object
value
)
{
if
(
name
.
equals
(
"createTime"
)
||
name
.
equals
(
"modifyTime"
)
||
name
.
equals
(
"updateTime"
)
)
{
return
value
;
}
else
if
(
value
instanceof
Date
)
{
return
FORMAT
.
format
(
value
);
}
else
{
return
value
;
}
}
}
/**
*
* @param responseCode
* @return
*/
public
static
String
backJson4HttpApi
(
ResponseCode
responseCode
)
{
if
(
responseCode
!=
null
)
{
String
result
=
JSON
.
toJSONString
(
responseCode
,
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
result
=
result
.
replaceFirst
(
"\"data\":\\{"
,
""
);
return
result
.
substring
(
0
,
result
.
length
()
-
1
);
}
return
null
;
}
/**
* 验证失败的json串
* @param code
* @return
*/
public
static
String
backJson4VerifyFailure
(
int
code
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"message"
,
"未通过验证"
);
return
JSON
.
toJSONString
(
new
ResponseCode
(
code
,
map
),
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
}
/**
* 成功的json串
* @param responseCode
* @return
*/
public
static
String
backJson
(
ResponseCode
responseCode
)
{
if
(
responseCode
!=
null
)
{
return
JSON
.
toJSONString
(
responseCode
,
new
ResponseFilter
(),
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
WriteNonStringKeyAsString
);
}
return
null
;
}
public
static
String
returnJson
(
Map
<
String
,
Object
>
map
,
String
message
,
int
code
)
{
map
.
put
(
"message"
,
message
);
return
backJson
(
new
ResponseCode
(
code
,
map
));
}
}
src/main/java/com/jsh/erp/utils/StringUtil.java
View file @
2539f768
package
com.jsh.erp.utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
public
class
StringUtil
{
private
StringUtil
()
{
}
private
static
String
DEFAULT_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
filterNull
(
String
str
)
{
if
(
str
==
null
)
{
return
""
;
}
else
{
return
str
.
trim
();
}
}
public
static
boolean
stringEquels
(
String
source
,
String
target
)
{
if
(
isEmpty
(
source
)||
isEmpty
(
target
)){
return
false
;
}
else
{
return
source
.
equals
(
target
);
}
}
public
static
boolean
isEmpty
(
String
str
)
{
return
str
==
null
||
""
.
equals
(
str
.
trim
());
}
public
static
boolean
isNotEmpty
(
String
str
)
{
return
!
isEmpty
(
str
);
}
public
static
String
getSysDate
(
String
format
)
{
if
(
StringUtil
.
isEmpty
(
format
))
{
format
=
DEFAULT_FORMAT
;
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
format
);
return
df
.
format
(
new
Date
());
}
public
static
Date
getDateByString
(
String
date
,
String
format
)
{
if
(
StringUtil
.
isEmpty
(
format
))
{
format
=
DEFAULT_FORMAT
;
}
if
(
StringUtil
.
isNotEmpty
(
date
))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
try
{
return
sdf
.
parse
(
date
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
"转换为日期类型错误:DATE:"
+
date
+
" FORMAT:"
+
format
);
}
}
else
{
return
null
;
}
}
public
static
Date
getDateByLongDate
(
Long
millis
)
{
if
(
millis
==
null
)
{
return
new
Date
();
}
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTimeInMillis
(
millis
);
return
cal
.
getTime
();
}
public
static
UUID
stringToUUID
(
String
id
)
{
if
(
StringUtil
.
isNotEmpty
(
id
))
{
return
UUID
.
fromString
(
id
);
}
else
{
return
null
;
}
}
public
static
Integer
parseInteger
(
String
str
)
{
if
(
StringUtil
.
isNotEmpty
(
str
))
{
return
Integer
.
parseInt
(
str
);
}
else
{
return
null
;
}
}
public
static
List
<
UUID
>
listToUUID
(
List
<
String
>
listStrs
)
{
if
(
listStrs
!=
null
&&
listStrs
.
size
()
>
0
)
{
List
<
UUID
>
uuidList
=
new
ArrayList
<
UUID
>();
for
(
String
str
:
listStrs
)
{
uuidList
.
add
(
UUID
.
fromString
(
str
));
}
return
uuidList
;
}
else
{
return
null
;
}
}
public
static
List
<
UUID
>
arrayToUUIDList
(
String
[]
uuids
)
{
if
(
uuids
!=
null
&&
uuids
.
length
>
0
)
{
List
<
UUID
>
uuidList
=
new
ArrayList
<
UUID
>();
for
(
String
str
:
uuids
)
{
uuidList
.
add
(
UUID
.
fromString
(
str
));
}
return
uuidList
;
}
else
{
return
null
;
}
}
//是否是JSON
public
static
boolean
containsAny
(
String
str
,
String
...
flag
)
{
if
(
str
!=
null
)
{
if
(
flag
==
null
||
flag
.
length
==
0
)
{
flag
=
"[-{-}-]-,"
.
split
(
"-"
);
}
for
(
String
s
:
flag
)
{
if
(
str
.
contains
(
s
))
{
return
true
;
}
}
}
return
false
;
}
public
static
String
getModifyOrgOperateData
(
UUID
resourceId
,
UUID
orgId
)
{
if
(
resourceId
!=
null
&&
orgId
!=
null
)
{
Map
<
UUID
,
UUID
>
map
=
new
HashMap
<
UUID
,
UUID
>();
map
.
put
(
resourceId
,
orgId
);
return
JSON
.
toJSONString
(
map
);
}
return
""
;
}
public
static
String
[]
listToStringArray
(
List
<
String
>
list
)
{
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
return
list
.
toArray
(
new
String
[
list
.
size
()]);
}
return
new
String
[
0
];
}
public
static
List
<
String
>
stringToListArray
(
String
[]
strings
)
{
if
(
strings
!=
null
&&
strings
.
length
>
0
)
{
return
Arrays
.
asList
(
strings
);
}
return
new
ArrayList
<
String
>();
}
/**
* String字符串转成List<Long>数据格式
* String str = "1,2,3,4,5,6" -> List<Long> listLong [1,2,3,4,5,6];
*
* @param strArr
* @return
*/
public
static
List
<
Long
>
strToLongList
(
String
strArr
)
{
List
<
Long
>
idList
=
new
ArrayList
<
Long
>();
String
[]
d
=
strArr
.
split
(
","
);
for
(
int
i
=
0
,
size
=
d
.
length
;
i
<
size
;
i
++)
{
if
(
d
[
i
]!=
null
)
{
idList
.
add
(
Long
.
parseLong
(
d
[
i
]));
}
}
return
idList
;
}
/**
* String字符串转成List<String>数据格式
* String str = "1,2,3,4,5,6" -> List<Long> listLong [1,2,3,4,5,6];
*
* @param strArr
* @return
*/
public
static
List
<
String
>
strToStringList
(
String
strArr
)
{
List
<
String
>
idList
=
new
ArrayList
<
String
>();
String
[]
d
=
strArr
.
split
(
","
);
for
(
int
i
=
0
,
size
=
d
.
length
;
i
<
size
;
i
++)
{
if
(
d
[
i
]!=
null
)
{
idList
.
add
(
d
[
i
].
toString
());
}
}
return
idList
;
}
public
static
List
<
String
>
searchCondition
(
String
search
)
{
if
(
isEmpty
(
search
))
{
return
new
ArrayList
<
String
>();
}
else
{
//String[] split = search.split(" ");
String
[]
split
=
search
.
split
(
"#"
);
return
stringToListArray
(
split
);
}
}
public
static
String
getInfo
(
String
search
,
String
key
){
String
value
=
""
;
if
(
search
!=
null
)
{
JSONObject
obj
=
JSONObject
.
parseObject
(
search
);
value
=
obj
.
getString
(
key
);
if
(
value
.
equals
(
""
))
{
value
=
null
;
}
}
return
value
;
}
}
package
com.jsh.erp.utils
;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
public
class
StringUtil
{
private
StringUtil
()
{
}
private
static
String
DEFAULT_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
filterNull
(
String
str
)
{
if
(
str
==
null
)
{
return
""
;
}
else
{
return
str
.
trim
();
}
}
public
static
boolean
stringEquels
(
String
source
,
String
target
)
{
if
(
isEmpty
(
source
)||
isEmpty
(
target
)){
return
false
;
}
else
{
return
source
.
equals
(
target
);
}
}
public
static
boolean
isEmpty
(
String
str
)
{
return
str
==
null
||
""
.
equals
(
str
.
trim
());
}
public
static
boolean
isNotEmpty
(
String
str
)
{
return
!
isEmpty
(
str
);
}
public
static
String
getSysDate
(
String
format
)
{
if
(
StringUtil
.
isEmpty
(
format
))
{
format
=
DEFAULT_FORMAT
;
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
format
);
return
df
.
format
(
new
Date
());
}
public
static
Date
getDateByString
(
String
date
,
String
format
)
{
if
(
StringUtil
.
isEmpty
(
format
))
{
format
=
DEFAULT_FORMAT
;
}
if
(
StringUtil
.
isNotEmpty
(
date
))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
try
{
return
sdf
.
parse
(
date
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
"转换为日期类型错误:DATE:"
+
date
+
" FORMAT:"
+
format
);
}
}
else
{
return
null
;
}
}
public
static
Date
getDateByLongDate
(
Long
millis
)
{
if
(
millis
==
null
)
{
return
new
Date
();
}
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTimeInMillis
(
millis
);
return
cal
.
getTime
();
}
public
static
UUID
stringToUUID
(
String
id
)
{
if
(
StringUtil
.
isNotEmpty
(
id
))
{
return
UUID
.
fromString
(
id
);
}
else
{
return
null
;
}
}
public
static
Integer
parseInteger
(
String
str
)
{
if
(
StringUtil
.
isNotEmpty
(
str
))
{
return
Integer
.
parseInt
(
str
);
}
else
{
return
null
;
}
}
public
static
List
<
UUID
>
listToUUID
(
List
<
String
>
listStrs
)
{
if
(
listStrs
!=
null
&&
listStrs
.
size
()
>
0
)
{
List
<
UUID
>
uuidList
=
new
ArrayList
<
UUID
>();
for
(
String
str
:
listStrs
)
{
uuidList
.
add
(
UUID
.
fromString
(
str
));
}
return
uuidList
;
}
else
{
return
null
;
}
}
public
static
List
<
UUID
>
arrayToUUIDList
(
String
[]
uuids
)
{
if
(
uuids
!=
null
&&
uuids
.
length
>
0
)
{
List
<
UUID
>
uuidList
=
new
ArrayList
<
UUID
>();
for
(
String
str
:
uuids
)
{
uuidList
.
add
(
UUID
.
fromString
(
str
));
}
return
uuidList
;
}
else
{
return
null
;
}
}
//是否是JSON
public
static
boolean
containsAny
(
String
str
,
String
...
flag
)
{
if
(
str
!=
null
)
{
if
(
flag
==
null
||
flag
.
length
==
0
)
{
flag
=
"[-{-}-]-,"
.
split
(
"-"
);
}
for
(
String
s
:
flag
)
{
if
(
str
.
contains
(
s
))
{
return
true
;
}
}
}
return
false
;
}
public
static
String
getModifyOrgOperateData
(
UUID
resourceId
,
UUID
orgId
)
{
if
(
resourceId
!=
null
&&
orgId
!=
null
)
{
Map
<
UUID
,
UUID
>
map
=
new
HashMap
<
UUID
,
UUID
>();
map
.
put
(
resourceId
,
orgId
);
return
JSON
.
toJSONString
(
map
);
}
return
""
;
}
public
static
String
[]
listToStringArray
(
List
<
String
>
list
)
{
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
return
list
.
toArray
(
new
String
[
list
.
size
()]);
}
return
new
String
[
0
];
}
public
static
List
<
String
>
stringToListArray
(
String
[]
strings
)
{
if
(
strings
!=
null
&&
strings
.
length
>
0
)
{
return
Arrays
.
asList
(
strings
);
}
return
new
ArrayList
<
String
>();
}
/**
* String字符串转成List<Long>数据格式
* String str = "1,2,3,4,5,6" -> List<Long> listLong [1,2,3,4,5,6];
*
* @param strArr
* @return
*/
public
static
List
<
Long
>
strToLongList
(
String
strArr
)
{
List
<
Long
>
idList
=
new
ArrayList
<
Long
>();
String
[]
d
=
strArr
.
split
(
","
);
for
(
int
i
=
0
,
size
=
d
.
length
;
i
<
size
;
i
++)
{
if
(
d
[
i
]!=
null
)
{
idList
.
add
(
Long
.
parseLong
(
d
[
i
]));
}
}
return
idList
;
}
/**
* String字符串转成List<String>数据格式
* String str = "1,2,3,4,5,6" -> List<Long> listLong [1,2,3,4,5,6];
*
* @param strArr
* @return
*/
public
static
List
<
String
>
strToStringList
(
String
strArr
)
{
if
(
StringUtils
.
isEmpty
(
strArr
)){
return
null
;
}
List
<
String
>
idList
=
new
ArrayList
<
String
>();
String
[]
d
=
strArr
.
split
(
","
);
for
(
int
i
=
0
,
size
=
d
.
length
;
i
<
size
;
i
++)
{
if
(
d
[
i
]!=
null
)
{
idList
.
add
(
d
[
i
].
toString
());
}
}
return
idList
;
}
public
static
List
<
String
>
searchCondition
(
String
search
)
{
if
(
isEmpty
(
search
))
{
return
new
ArrayList
<
String
>();
}
else
{
//String[] split = search.split(" ");
String
[]
split
=
search
.
split
(
"#"
);
return
stringToListArray
(
split
);
}
}
public
static
String
getInfo
(
String
search
,
String
key
){
String
value
=
""
;
if
(
search
!=
null
)
{
JSONObject
obj
=
JSONObject
.
parseObject
(
search
);
value
=
obj
.
getString
(
key
);
if
(
value
.
equals
(
""
))
{
value
=
null
;
}
}
return
value
;
}
}
src/main/resources/application.properties
View file @
2539f768
...
...
@@ -6,6 +6,8 @@ resource=src/main/resources
web.front.baseDir
=
erp_web
mybatis.type-aliases-package
=
com.chinamobile.model.*
mybatis.mapper-locations
=
classpath:./mapper_xml/*.xml
#开启sql打印
logging.level.com.jsh.erp.datasource.mappers
=
DEBUG
...
...
src/main/resources/mapper_xml/MaterialMapper.xml
View file @
2539f768
...
...
@@ -29,6 +29,7 @@
<result
column=
"OtherField1"
jdbcType=
"VARCHAR"
property=
"otherfield1"
/>
<result
column=
"OtherField2"
jdbcType=
"VARCHAR"
property=
"otherfield2"
/>
<result
column=
"OtherField3"
jdbcType=
"VARCHAR"
property=
"otherfield3"
/>
<result
column=
"enableSerialNumber"
jdbcType=
"BIT"
property=
"enableSerialNumber"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
...
...
@@ -103,7 +104,7 @@
-->
Id, CategoryId, Name, Mfrs, Packing, SafetyStock, Model, Standard, Color, Unit, Remark,
RetailPrice, LowPrice, PresetPriceOne, PresetPriceTwo, UnitId, FirstOutUnit, FirstInUnit,
PriceStrategy, Enabled, OtherField1, OtherField2, OtherField3
PriceStrategy, Enabled, OtherField1, OtherField2, OtherField3
,enableSerialNumber
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.MaterialExample"
resultMap=
"BaseResultMap"
>
<!--
...
...
@@ -163,7 +164,7 @@
LowPrice, PresetPriceOne, PresetPriceTwo,
UnitId, FirstOutUnit, FirstInUnit,
PriceStrategy, Enabled, OtherField1,
OtherField2, OtherField3)
OtherField2, OtherField3
,enableSerialNumber
)
values (#{id,jdbcType=BIGINT}, #{categoryid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{mfrs,jdbcType=VARCHAR}, #{packing,jdbcType=DECIMAL}, #{safetystock,jdbcType=DECIMAL},
#{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR},
...
...
@@ -171,7 +172,7 @@
#{lowprice,jdbcType=DECIMAL}, #{presetpriceone,jdbcType=DECIMAL}, #{presetpricetwo,jdbcType=DECIMAL},
#{unitid,jdbcType=BIGINT}, #{firstoutunit,jdbcType=VARCHAR}, #{firstinunit,jdbcType=VARCHAR},
#{pricestrategy,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT}, #{otherfield1,jdbcType=VARCHAR},
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR})
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR}
,#{enableSerialNumber,jdbcType=BIT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.Material"
>
<!--
...
...
@@ -249,6 +250,9 @@
<if
test=
"otherfield3 != null"
>
OtherField3,
</if>
<if
test=
"enableSerialNumber != null"
>
enableSerialNumber,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
...
...
@@ -320,6 +324,9 @@
<if
test=
"otherfield3 != null"
>
#{otherfield3,jdbcType=VARCHAR},
</if>
<if
test=
"enableSerialNumber != null"
>
#{enableSerialNumber,jdbcType=BIT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.jsh.erp.datasource.entities.MaterialExample"
resultType=
"java.lang.Integer"
>
...
...
@@ -408,6 +415,9 @@
<if
test=
"record.otherfield3 != null"
>
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
</if>
<if
test=
"record.enableSerialNumber != null"
>
enableSerialNumber = #{record.enableSerialNumber,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -442,6 +452,7 @@
OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR}
enableSerialNumber = #{record.enableSerialNumber,jdbcType=BIT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -519,6 +530,9 @@
<if
test=
"otherfield3 != null"
>
OtherField3 = #{otherfield3,jdbcType=VARCHAR},
</if>
<if
test=
"enableSerialNumber != null"
>
enableSerialNumber = #{enableSerialNumber,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
...
...
@@ -550,6 +564,7 @@
OtherField1 = #{otherfield1,jdbcType=VARCHAR},
OtherField2 = #{otherfield2,jdbcType=VARCHAR},
OtherField3 = #{otherfield3,jdbcType=VARCHAR}
enableSerialNumber = #{enableSerialNumber,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
2539f768
<?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=
"com.jsh.erp.datasource.mappers.MaterialMapper"
>
<mapper
namespace=
"com.jsh.erp.datasource.mappers.MaterialMapperEx"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.Material"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id
column=
"Id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"CategoryId"
jdbcType=
"BIGINT"
property=
"categoryid"
/>
<result
column=
"Name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"Mfrs"
jdbcType=
"VARCHAR"
property=
"mfrs"
/>
<result
column=
"Packing"
jdbcType=
"DECIMAL"
property=
"packing"
/>
<result
column=
"SafetyStock"
jdbcType=
"DECIMAL"
property=
"safetystock"
/>
<result
column=
"Model"
jdbcType=
"VARCHAR"
property=
"model"
/>
<result
column=
"Standard"
jdbcType=
"VARCHAR"
property=
"standard"
/>
<result
column=
"Color"
jdbcType=
"VARCHAR"
property=
"color"
/>
<result
column=
"Unit"
jdbcType=
"VARCHAR"
property=
"unit"
/>
<result
column=
"Remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"RetailPrice"
jdbcType=
"DECIMAL"
property=
"retailprice"
/>
<result
column=
"LowPrice"
jdbcType=
"DECIMAL"
property=
"lowprice"
/>
<result
column=
"PresetPriceOne"
jdbcType=
"DECIMAL"
property=
"presetpriceone"
/>
<result
column=
"PresetPriceTwo"
jdbcType=
"DECIMAL"
property=
"presetpricetwo"
/>
<result
column=
"UnitId"
jdbcType=
"BIGINT"
property=
"unitid"
/>
<result
column=
"FirstOutUnit"
jdbcType=
"VARCHAR"
property=
"firstoutunit"
/>
<result
column=
"FirstInUnit"
jdbcType=
"VARCHAR"
property=
"firstinunit"
/>
<result
column=
"PriceStrategy"
jdbcType=
"VARCHAR"
property=
"pricestrategy"
/>
<result
column=
"Enabled"
jdbcType=
"BIT"
property=
"enabled"
/>
<result
column=
"OtherField1"
jdbcType=
"VARCHAR"
property=
"otherfield1"
/>
<result
column=
"OtherField2"
jdbcType=
"VARCHAR"
property=
"otherfield2"
/>
<result
column=
"OtherField3"
jdbcType=
"VARCHAR"
property=
"otherfield3"
/>
<result
column=
"enableSerialNumber"
jdbcType=
"BIT"
property=
"enableSerialNumber"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapList"
type=
"com.jsh.erp.datasource.entities.MaterialVo4Unit"
>
<result
column=
"unitName"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
<result
column=
"categoryName"
jdbcType=
"VARCHAR"
property=
"categoryName"
/>
...
...
@@ -95,4 +125,15 @@
</if>
order by m.id asc
</select>
<select
id=
"findByMaterialName"
resultType=
"com.jsh.erp.datasource.entities.Material"
>
select m.*
FROM jsh_material m
where 1=1
<if
test=
"name != null"
>
and m.name =#{name}
</if>
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/SerialNumberMapper.xml
0 → 100644
View file @
2539f768
<?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=
"com.jsh.erp.datasource.mappers.SerialNumberMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.SerialNumber"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"material_Id"
jdbcType=
"BIGINT"
property=
"materialId"
/>
<result
column=
"serial_Number"
jdbcType=
"VARCHAR"
property=
"serialNumber"
/>
<result
column=
"is_Sell"
jdbcType=
"BIT"
property=
"isSell"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"delete_Flag"
jdbcType=
"BIT"
property=
"deleteFlag"
/>
<result
column=
"create_Time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"creator"
jdbcType=
"BIGINT"
property=
"creator"
/>
<result
column=
"update_Time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"updater"
jdbcType=
"BIGINT"
property=
"updater"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, material_Id, serial_Number, is_Sell, remark, delete_Flag, create_Time, creator,
update_Time, updater
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumberExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from jsh_serial_number
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include
refid=
"Base_Column_List"
/>
from jsh_serial_number
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_serial_number
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumberExample"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_serial_number
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumber"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_serial_number (id, material_Id, serial_Number,
is_Sell, remark, delete_Flag,
create_Time, creator, update_Time,
updater)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{serialNumber,jdbcType=VARCHAR},
#{isSell,jdbcType=BIT}, #{remark,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=BIT},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=BIGINT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumber"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_serial_number
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"materialId != null"
>
material_Id,
</if>
<if
test=
"serialNumber != null"
>
serial_Number,
</if>
<if
test=
"isSell != null"
>
is_Sell,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"deleteFlag != null"
>
delete_Flag,
</if>
<if
test=
"createTime != null"
>
create_Time,
</if>
<if
test=
"creator != null"
>
creator,
</if>
<if
test=
"updateTime != null"
>
update_Time,
</if>
<if
test=
"updater != null"
>
updater,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"materialId != null"
>
#{materialId,jdbcType=BIGINT},
</if>
<if
test=
"serialNumber != null"
>
#{serialNumber,jdbcType=VARCHAR},
</if>
<if
test=
"isSell != null"
>
#{isSell,jdbcType=BIT},
</if>
<if
test=
"remark != null"
>
#{remark,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=BIT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"creator != null"
>
#{creator,jdbcType=BIGINT},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updater != null"
>
#{updater,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumberExample"
resultType=
"java.lang.Integer"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_serial_number
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_serial_number
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.materialId != null"
>
material_Id = #{record.materialId,jdbcType=BIGINT},
</if>
<if
test=
"record.serialNumber != null"
>
serial_Number = #{record.serialNumber,jdbcType=VARCHAR},
</if>
<if
test=
"record.isSell != null"
>
is_Sell = #{record.isSell,jdbcType=BIT},
</if>
<if
test=
"record.remark != null"
>
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if
test=
"record.deleteFlag != null"
>
delete_Flag = #{record.deleteFlag,jdbcType=BIT},
</if>
<if
test=
"record.createTime != null"
>
create_Time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.creator != null"
>
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if
test=
"record.updateTime != null"
>
update_Time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.updater != null"
>
updater = #{record.updater,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_serial_number
set id = #{record.id,jdbcType=BIGINT},
material_Id = #{record.materialId,jdbcType=BIGINT},
serial_Number = #{record.serialNumber,jdbcType=VARCHAR},
is_Sell = #{record.isSell,jdbcType=BIT},
remark = #{record.remark,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=BIT},
create_Time = #{record.createTime,jdbcType=TIMESTAMP},
creator = #{record.creator,jdbcType=BIGINT},
update_Time = #{record.updateTime,jdbcType=TIMESTAMP},
updater = #{record.updater,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumber"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_serial_number
<set>
<if
test=
"materialId != null"
>
material_Id = #{materialId,jdbcType=BIGINT},
</if>
<if
test=
"serialNumber != null"
>
serial_Number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if
test=
"isSell != null"
>
is_Sell = #{isSell,jdbcType=BIT},
</if>
<if
test=
"remark != null"
>
remark = #{remark,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_Flag = #{deleteFlag,jdbcType=BIT},
</if>
<if
test=
"createTime != null"
>
create_Time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"creator != null"
>
creator = #{creator,jdbcType=BIGINT},
</if>
<if
test=
"updateTime != null"
>
update_Time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updater != null"
>
updater = #{updater,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumber"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_serial_number
set material_Id = #{materialId,jdbcType=BIGINT},
serial_Number = #{serialNumber,jdbcType=VARCHAR},
is_Sell = #{isSell,jdbcType=BIT},
remark = #{remark,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=BIT},
create_Time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=BIGINT},
update_Time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/SerialNumberMapperEx.xml
0 → 100644
View file @
2539f768
<?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=
"com.jsh.erp.datasource.mappers.SerialNumberMapperEx"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.SerialNumberEx"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"material_Id"
jdbcType=
"BIGINT"
property=
"materialId"
/>
<result
column=
"materialName"
jdbcType=
"VARCHAR"
property=
"materialName"
/>
<result
column=
"serial_Number"
jdbcType=
"VARCHAR"
property=
"serialNumber"
/>
<result
column=
"is_Sell"
jdbcType=
"BIT"
property=
"isSell"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"delete_Flag"
jdbcType=
"BIT"
property=
"deleteFlag"
/>
<result
column=
"create_Time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_Time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"creator"
jdbcType=
"BIGINT"
property=
"creator"
/>
<result
column=
"updater"
jdbcType=
"BIGINT"
property=
"updater"
/>
<result
column=
"creatorName"
jdbcType=
"VARCHAR"
property=
"creatorName"
/>
<result
column=
"updaterName"
jdbcType=
"VARCHAR"
property=
"updaterName"
/>
</resultMap>
<select
id=
"selectByConditionSerialNumber"
resultMap=
"BaseResultMap"
>
select
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,mat.name as materialName,null as creator,null as updater,null as creatorName, null as updaterName
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
where 1=1
<if
test=
"serialNumber != null"
>
<bind
name=
"serialNumber"
value=
"'%' + _parameter.serialNumber + '%'"
/>
and ser.serial_Number like #{serialNumber}
</if>
<if
test=
"materialName != null"
>
<bind
name=
"materialName"
value=
"'%' + _parameter.materialName + '%'"
/>
and mat.name like #{materialName}
</if>
order by ser.id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
</select>
<select
id=
"countSerialNumber"
resultType=
"java.lang.Integer"
>
SELECT
COUNT(ser.id)
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
where 1=1
<if
test=
"serialNumber != null"
>
<bind
name=
"serialNumber"
value=
"'%' + _parameter.serialNumber + '%'"
/>
and ser.serial_Number like #{serialNumber}
</if>
<if
test=
"materialName != null"
>
<bind
name=
"materialName"
value=
"'%' + _parameter.materialName + '%'"
/>
and mat.name like #{materialName}
</if>
order by ser.id desc
</select>
<select
id=
"findById"
resultMap=
"BaseResultMap"
>
SELECT
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,ser.creator,ser.updater,mat.name as materialName,cr.username as creatorName,
ur.username as updaterName
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
left join jsh_user cr on ser.creator=cr.id
left join jsh_user ur on ser.updater=ur.id
where 1=1
and ser.id=#{id}
order by ser.id desc
</select>
<select
id=
"findBySerialNumber"
resultMap=
"BaseResultMap"
>
SELECT
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,ser.creator,ser.updater
FROM jsh_serial_number ser
where 1=1
<if
test=
"serialNumber != null"
>
and ser.serial_Number=#{serialNumber}
</if>
order by ser.id desc
</select>
<insert
id=
"addSerialNumber"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumberEx"
useGeneratedKeys=
"true"
keyProperty=
"id"
keyColumn=
"id"
>
insert into jsh_serial_number
(material_Id, serial_Number, is_Sell, remark,delete_Flag,
create_Time, creator,update_Time, updater)
values
(#{materialId},#{serialNumber},#{isSell},#{remark},#{deleteFlag},
#{createTime},#{creator},#{updateTime},#{updater}
)
</insert>
<update
id=
"updateSerialNumber"
parameterType=
"com.jsh.erp.datasource.entities.SerialNumberEx"
>
update jsh_serial_number
<set>
<if
test=
"materialId != null"
>
material_Id = #{materialId,jdbcType=BIGINT},
</if>
<if
test=
"serialNumber != null"
>
serial_Number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if
test=
"isSell != null"
>
is_Sell = #{isSell,jdbcType=BIT},
</if>
<if
test=
"remark != null"
>
remark = #{remark,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_Flag = #{deleteFlag,jdbcType=BIT},
</if>
<if
test=
"updateTime != null"
>
update_Time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updater != null"
>
updater = #{updater,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/test/resources/generatorConfig.xml
View file @
2539f768
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry
location=
"E:/maven-repository/mysql/mysql-connector-java/5.1.28/mysql-connector-java-5.1.28.jar"
/>
<context
id=
"DB2Tables"
targetRuntime=
"MyBatis3"
defaultModelType=
"flat"
>
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"false"
/>
<property
name=
"suppressDate"
value=
"true"
/>
</commentGenerator>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/jsh_erp?generateSimpleParameterMetadata=true"
userId=
"root"
password=
"1234"
>
</jdbcConnection>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- generate Model -->
<javaModelGenerator
targetPackage=
"com.jsh.erp.datasource.entities"
targetProject=
"src\main\java"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- generate xml -->
<sqlMapGenerator
targetPackage=
"mapper_xml"
targetProject=
"src\main\resources"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</sqlMapGenerator>
<!-- generate Mapper -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.jsh.erp.datasource.mappers"
targetProject=
"src\main\java"
implementationPackage=
""
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"exampleMethodVisibility"
value=
"public"
/>
</javaClientGenerator>
<table
tableName=
"jsh_account"
domainObjectName=
"Account"
></table>
<table
tableName=
"jsh_accounthead"
domainObjectName=
"AccountHead"
></table>
<table
tableName=
"jsh_accountitem"
domainObjectName=
"AccountItem"
></table>
<table
tableName=
"jsh_app"
domainObjectName=
"App"
></table>
<table
tableName=
"jsh_asset"
domainObjectName=
"Asset"
></table>
<table
tableName=
"jsh_assetcategory"
domainObjectName=
"AssetCategory"
></table>
<table
tableName=
"jsh_assetname"
domainObjectName=
"AssetName"
></table>
<table
tableName=
"jsh_depot"
domainObjectName=
"Depot"
></table>
<table
tableName=
"jsh_depothead"
domainObjectName=
"DepotHead"
></table>
<table
tableName=
"jsh_depotitem"
domainObjectName=
"DepotItem"
></table>
<table
tableName=
"jsh_functions"
domainObjectName=
"Functions"
></table>
<table
tableName=
"jsh_inoutitem"
domainObjectName=
"InOutItem"
></table>
<table
tableName=
"jsh_log"
domainObjectName=
"Log"
></table>
<table
tableName=
"jsh_material"
domainObjectName=
"Material"
></table>
<table
tableName=
"jsh_materialcategory"
domainObjectName=
"MaterialCategory"
></table>
<table
tableName=
"jsh_materialproperty"
domainObjectName=
"MaterialProperty"
></table>
<table
tableName=
"jsh_person"
domainObjectName=
"Person"
></table>
<table
tableName=
"jsh_role"
domainObjectName=
"Role"
></table>
<table
tableName=
"jsh_supplier"
domainObjectName=
"Supplier"
></table>
<table
tableName=
"jsh_systemconfig"
domainObjectName=
"SystemConfig"
></table>
<table
tableName=
"jsh_unit"
domainObjectName=
"Unit"
></table>
<table
tableName=
"jsh_user"
domainObjectName=
"User"
></table>
<table
tableName=
"jsh_userbusiness"
domainObjectName=
"UserBusiness"
></table>
</context>
</generatorConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry
location=
"C:\Users\cjl\.m2\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar"
/>
<context
id=
"DB2Tables"
targetRuntime=
"MyBatis3"
defaultModelType=
"flat"
>
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"false"
/>
<property
name=
"suppressDate"
value=
"true"
/>
</commentGenerator>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/jsh_erp?generateSimpleParameterMetadata=true"
userId=
"root"
password=
"123456"
>
</jdbcConnection>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- generate Model -->
<javaModelGenerator
targetPackage=
"com.jsh.erp.datasource.entities"
targetProject=
"src\main\java"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- generate xml -->
<sqlMapGenerator
targetPackage=
"mapper_xml"
targetProject=
"src\main\resources"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</sqlMapGenerator>
<!-- generate Mapper -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.jsh.erp.datasource.mappers"
targetProject=
"src\main\java"
implementationPackage=
""
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"exampleMethodVisibility"
value=
"public"
/>
</javaClientGenerator>
<!-- <table tableName="jsh_account" domainObjectName="Account"></table>
<table tableName="jsh_accounthead" domainObjectName="AccountHead"></table>
<table tableName="jsh_accountitem" domainObjectName="AccountItem"></table>
<table tableName="jsh_app" domainObjectName="App"></table>
<table tableName="jsh_asset" domainObjectName="Asset"></table>
<table tableName="jsh_assetcategory" domainObjectName="AssetCategory"></table>
<table tableName="jsh_assetname" domainObjectName="AssetName"></table>
<table tableName="jsh_depot" domainObjectName="Depot"></table>
<table tableName="jsh_depothead" domainObjectName="DepotHead"></table>
<table tableName="jsh_depotitem" domainObjectName="DepotItem"></table>
<table tableName="jsh_functions" domainObjectName="Functions"></table>
<table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table>
<table tableName="jsh_log" domainObjectName="Log"></table>
<table tableName="jsh_material" domainObjectName="Material"></table>
<table tableName="jsh_materialcategory" domainObjectName="MaterialCategory"></table>
<table tableName="jsh_materialproperty" domainObjectName="MaterialProperty"></table>
<table tableName="jsh_person" domainObjectName="Person"></table>
<table tableName="jsh_role" domainObjectName="Role"></table>
<table tableName="jsh_supplier" domainObjectName="Supplier"></table>
<table tableName="jsh_systemconfig" domainObjectName="SystemConfig"></table>
<table tableName="jsh_unit" domainObjectName="Unit"></table>
<table tableName="jsh_user" domainObjectName="User"></table>
<table tableName="jsh_userbusiness" domainObjectName="UserBusiness"></table>-->
<table
tableName=
"jsh_serial_number"
domainObjectName=
"SerialNumber"
></table>
</context>
</generatorConfiguration>
Prev
1
2
Next
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