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
f8e542cb
Commit
f8e542cb
authored
Aug 26, 2022
by
季圣华
Browse files
给部分表增加启用状态和排序字段,完善对应接口
parent
8906294c
Changes
21
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java
View file @
f8e542cb
...
...
@@ -170,6 +170,7 @@ public class BusinessConstants {
public
static
final
String
LOG_OPERATION_TYPE_DELETE
=
"删除"
;
public
static
final
String
LOG_OPERATION_TYPE_LOGIN
=
"登录"
;
public
static
final
String
LOG_OPERATION_TYPE_IMPORT
=
"导入"
;
public
static
final
String
LOG_OPERATION_TYPE_ENABLED
=
"更新状态"
;
/**
* 数据数量单位
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/AccountController.java
View file @
f8e542cb
...
...
@@ -182,4 +182,25 @@ public class AccountController {
}
return
res
;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
accountService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java
View file @
f8e542cb
...
...
@@ -202,4 +202,25 @@ public class DepotController {
}
return
res
;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
depotService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/controller/InOutItemController.java
View file @
f8e542cb
...
...
@@ -2,12 +2,9 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.InOutItem
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.inOutItem.InOutItemService
;
import
com.jsh.erp.utils.
BaseResponse
Info
;
import
com.jsh.erp.utils.
Erp
Info
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
...
...
@@ -20,6 +17,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
/**
* @author jishenghua jshERP 2018年12月25日14:38:08
*/
...
...
@@ -61,4 +60,25 @@ public class InOutItemController {
}
return
res
;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
inOutItemService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/controller/PersonController.java
View file @
f8e542cb
...
...
@@ -2,12 +2,10 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.person.PersonService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.ErpInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
...
...
@@ -20,6 +18,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
/**
* @author ji|sheng|hua 华夏erp
*/
...
...
@@ -141,4 +141,25 @@ public class PersonController {
}
return
dataArray
;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
personService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/controller/RoleController.java
View file @
f8e542cb
...
...
@@ -8,6 +8,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import
com.jsh.erp.service.role.RoleService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.ErpInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
...
...
@@ -16,7 +17,11 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
/**
* @author ji sheng hua jshERP
...
...
@@ -70,4 +75,25 @@ public class RoleController {
public
List
<
Role
>
allList
(
HttpServletRequest
request
)
throws
Exception
{
return
roleService
.
allList
();
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
roleService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/controller/UnitController.java
View file @
f8e542cb
package
com.jsh.erp.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.datasource.entities.Unit
;
import
com.jsh.erp.service.unit.UnitService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.ErpInfo
;
import
io.swagger.annotations.Api
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
/**
* Description
...
...
@@ -26,4 +28,49 @@ import javax.annotation.Resource;
@Api
(
tags
=
{
"单位管理"
})
public
class
UnitController
{
@Resource
private
UnitService
unitService
;
/**
* 单位列表
* @param request
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/getAllList"
)
@ApiOperation
(
value
=
"单位列表"
)
public
BaseResponseInfo
getAllList
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
List
<
Unit
>
unitList
=
unitService
.
getUnit
();
res
.
code
=
200
;
res
.
data
=
unitList
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping
(
value
=
"/batchSetStatus"
)
@ApiOperation
(
value
=
"批量设置状态"
)
public
String
batchSetStatus
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Boolean
status
=
jsonObject
.
getBoolean
(
"status"
);
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
unitService
.
batchSetStatus
(
status
,
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
f8e542cb
package
com.jsh.erp.service.account
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
...
...
@@ -76,7 +75,7 @@ public class AccountService {
public
List
<
Account
>
getAccount
()
throws
Exception
{
AccountExample
example
=
new
AccountExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Account
>
list
=
null
;
try
{
list
=
accountMapper
.
selectByExample
(
example
);
...
...
@@ -139,6 +138,7 @@ public class AccountService {
account
.
setInitialAmount
(
BigDecimal
.
ZERO
);
}
account
.
setIsDefault
(
false
);
account
.
setEnabled
(
true
);
int
result
=
0
;
try
{
result
=
accountMapper
.
insertSelective
(
account
);
...
...
@@ -250,7 +250,7 @@ public class AccountService {
public
List
<
Account
>
findBySelect
()
throws
Exception
{
AccountExample
example
=
new
AccountExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"id desc"
);
List
<
Account
>
list
=
null
;
try
{
...
...
@@ -573,4 +573,23 @@ public class AccountService {
}
return
priceFmt
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"账户"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
accountIds
=
StringUtil
.
strToLongList
(
ids
);
Account
account
=
new
Account
();
account
.
setEnabled
(
status
);
AccountExample
example
=
new
AccountExample
();
example
.
createCriteria
().
andIdIn
(
accountIds
);
int
result
=
0
;
try
{
result
=
accountMapper
.
updateByExampleSelective
(
account
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
f8e542cb
...
...
@@ -18,7 +18,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
...
...
@@ -89,7 +88,7 @@ public class DepotService {
public
List
<
Depot
>
getAllList
()
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"sort"
);
List
<
Depot
>
list
=
null
;
try
{
...
...
@@ -127,6 +126,7 @@ public class DepotService {
try
{
depot
.
setType
(
0
);
depot
.
setIsDefault
(
false
);
depot
.
setEnabled
(
true
);
result
=
depotMapper
.
insertSelective
(
depot
);
//新增仓库时给当前用户自动授权
Long
userId
=
userService
.
getUserId
(
request
);
...
...
@@ -230,7 +230,8 @@ public class DepotService {
public
List
<
Depot
>
findUserDepot
()
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andTypeEqualTo
(
0
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andTypeEqualTo
(
0
).
andEnabledEqualTo
(
true
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"sort"
);
List
<
Depot
>
list
=
null
;
try
{
...
...
@@ -340,4 +341,23 @@ public class DepotService {
}
return
depotStr
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"仓库"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
depotIds
=
StringUtil
.
strToLongList
(
ids
);
Depot
depot
=
new
Depot
();
depot
.
setEnabled
(
status
);
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andIdIn
(
depotIds
);
int
result
=
0
;
try
{
result
=
depotMapper
.
updateByExampleSelective
(
depot
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java
View file @
f8e542cb
package
com.jsh.erp.service.inOutItem
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.InOutItem
;
import
com.jsh.erp.datasource.entities.InOutItemExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.mappers.InOutItemMapper
;
import
com.jsh.erp.datasource.mappers.InOutItemMapperEx
;
...
...
@@ -102,6 +104,7 @@ public class InOutItemService {
InOutItem
inOutItem
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
InOutItem
.
class
);
int
result
=
0
;
try
{
inOutItem
.
setEnabled
(
true
);
result
=
inOutItemMapper
.
insertSelective
(
inOutItem
);
logService
.
insertLog
(
"收支项目"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
inOutItem
.
getName
()).
toString
(),
request
);
...
...
@@ -186,9 +189,11 @@ public class InOutItemService {
public
List
<
InOutItem
>
findBySelect
(
String
type
)
throws
Exception
{
InOutItemExample
example
=
new
InOutItemExample
();
if
(
type
.
equals
(
"in"
))
{
example
.
createCriteria
().
andTypeEqualTo
(
"收入"
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andTypeEqualTo
(
"收入"
).
andEnabledEqualTo
(
true
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
}
else
if
(
type
.
equals
(
"out"
))
{
example
.
createCriteria
().
andTypeEqualTo
(
"支出"
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andTypeEqualTo
(
"支出"
).
andEnabledEqualTo
(
true
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
}
example
.
setOrderByClause
(
"id desc"
);
List
<
InOutItem
>
list
=
null
;
...
...
@@ -199,4 +204,23 @@ public class InOutItemService {
}
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"收支项目"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
inOutItemIds
=
StringUtil
.
strToLongList
(
ids
);
InOutItem
inOutItem
=
new
InOutItem
();
inOutItem
.
setEnabled
(
status
);
InOutItemExample
example
=
new
InOutItemExample
();
example
.
createCriteria
().
andIdIn
(
inOutItemIds
);
int
result
=
0
;
try
{
result
=
inOutItemMapper
.
updateByExampleSelective
(
inOutItem
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
f8e542cb
package
com.jsh.erp.service.person
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.AccountHead
;
import
com.jsh.erp.datasource.entities.DepotHead
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.datasource.entities.PersonExample
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.DepotHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.PersonMapper
;
...
...
@@ -23,7 +25,10 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
PersonService
{
...
...
@@ -68,7 +73,7 @@ public class PersonService {
public
List
<
Person
>
getPerson
()
throws
Exception
{
PersonExample
example
=
new
PersonExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Person
>
list
=
null
;
try
{
list
=
personMapper
.
selectByExample
(
example
);
...
...
@@ -103,6 +108,7 @@ public class PersonService {
Person
person
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
Person
.
class
);
int
result
=
0
;
try
{
person
.
setEnabled
(
true
);
result
=
personMapper
.
insertSelective
(
person
);
logService
.
insertLog
(
"经手人"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
person
.
getName
()).
toString
(),
request
);
...
...
@@ -216,7 +222,8 @@ public class PersonService {
public
List
<
Person
>
getPersonByType
(
String
type
)
throws
Exception
{
PersonExample
example
=
new
PersonExample
();
example
.
createCriteria
().
andTypeEqualTo
(
type
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andTypeEqualTo
(
type
).
andEnabledEqualTo
(
true
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"id asc"
);
List
<
Person
>
list
=
null
;
try
{
...
...
@@ -226,4 +233,23 @@ public class PersonService {
}
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"经手人"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
personIds
=
StringUtil
.
strToLongList
(
ids
);
Person
person
=
new
Person
();
person
.
setEnabled
(
status
);
PersonExample
example
=
new
PersonExample
();
example
.
createCriteria
().
andIdIn
(
personIds
);
int
result
=
0
;
try
{
result
=
personMapper
.
updateByExampleSelective
(
person
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/role/RoleService.java
View file @
f8e542cb
...
...
@@ -2,13 +2,11 @@ package com.jsh.erp.service.role;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Role
;
import
com.jsh.erp.datasource.entities.RoleExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.RoleMapper
;
import
com.jsh.erp.datasource.mappers.RoleMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.JshException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
...
...
@@ -64,7 +62,7 @@ public class RoleService {
public
List
<
Role
>
allList
()
throws
Exception
{
RoleExample
example
=
new
RoleExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Role
>
list
=
null
;
try
{
list
=
roleMapper
.
selectByExample
(
example
);
...
...
@@ -99,6 +97,7 @@ public class RoleService {
Role
role
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
Role
.
class
);
int
result
=
0
;
try
{
role
.
setEnabled
(
true
);
result
=
roleMapper
.
insertSelective
(
role
);
logService
.
insertLog
(
"角色"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
role
.
getName
()).
toString
(),
request
);
...
...
@@ -147,7 +146,7 @@ public class RoleService {
public
List
<
Role
>
findUserRole
()
throws
Exception
{
RoleExample
example
=
new
RoleExample
();
example
.
setOrderByClause
(
"Id"
);
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Role
>
list
=
null
;
try
{
list
=
roleMapper
.
selectByExample
(
example
);
...
...
@@ -187,4 +186,23 @@ public class RoleService {
public
Role
getRoleWithoutTenant
(
Long
roleId
)
{
return
roleMapperEx
.
getRoleWithoutTenant
(
roleId
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"角色"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
roleIds
=
StringUtil
.
strToLongList
(
ids
);
Role
role
=
new
Role
();
role
.
setEnabled
(
status
);
RoleExample
example
=
new
RoleExample
();
example
.
createCriteria
().
andIdIn
(
roleIds
);
int
result
=
0
;
try
{
result
=
roleMapper
.
updateByExampleSelective
(
role
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
View file @
f8e542cb
...
...
@@ -362,7 +362,7 @@ public class SupplierService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"商家"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_E
DIT
).
append
(
ids
).
toString
(),
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_E
NABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
supplierIds
=
StringUtil
.
strToLongList
(
ids
);
Supplier
supplier
=
new
Supplier
();
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/unit/UnitService.java
View file @
f8e542cb
package
com.jsh.erp.service.unit
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.Unit
;
import
com.jsh.erp.datasource.entities.UnitExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.datasource.mappers.UnitMapper
;
import
com.jsh.erp.datasource.mappers.UnitMapperEx
;
...
...
@@ -68,7 +70,7 @@ public class UnitService {
public
List
<
Unit
>
getUnit
()
throws
Exception
{
UnitExample
example
=
new
UnitExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Unit
>
list
=
null
;
try
{
list
=
unitMapper
.
selectByExample
(
example
);
...
...
@@ -104,6 +106,7 @@ public class UnitService {
int
result
=
0
;
try
{
parseNameByUnit
(
unit
);
unit
.
setEnabled
(
true
);
result
=
unitMapper
.
insertSelective
(
unit
);
logService
.
insertLog
(
"计量单位"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
unit
.
getName
()).
toString
(),
request
);
...
...
@@ -245,4 +248,23 @@ public class UnitService {
}
return
stock
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
ids
)
throws
Exception
{
logService
.
insertLog
(
"计量单位"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ENABLED
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
unitIds
=
StringUtil
.
strToLongList
(
ids
);
Unit
unit
=
new
Unit
();
unit
.
setEnabled
(
status
);
UnitExample
example
=
new
UnitExample
();
example
.
createCriteria
().
andIdIn
(
unitIds
);
int
result
=
0
;
try
{
result
=
unitMapper
.
updateByExampleSelective
(
unit
,
example
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
return
result
;
}
}
jshERP-boot/src/main/resources/mapper_xml/AccountMapperEx.xml
View file @
f8e542cb
...
...
@@ -48,6 +48,7 @@
and remark like #{bindRemark}
</if>
and ifnull(delete_flag,'0') !='1'
order by sort asc, id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotMapperEx.xml
View file @
f8e542cb
...
...
@@ -22,7 +22,7 @@
and dep.remark like #{bindRemark}
</if>
and ifnull(dep.delete_Flag,'0') !='1'
order by dep.sort asc
order by dep.sort asc
, dep.id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/InOutItemMapperEx.xml
View file @
f8e542cb
...
...
@@ -17,6 +17,7 @@
and remark like #{bindRemark}
</if>
and ifnull(delete_flag,'0') !='1'
order by sort asc, id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/PersonMapperEx.xml
View file @
f8e542cb
...
...
@@ -13,6 +13,7 @@
and type=#{type}
</if>
and ifnull(delete_flag,'0') !='1'
order by sort asc, id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/RoleMapperEx.xml
View file @
f8e542cb
...
...
@@ -10,9 +10,10 @@
<bind
name=
"bindName"
value=
"'%'+name+'%'"
/>
and name like #{bindName}
</if>
order by sort asc, id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
;
</if>
</select>
<select
id=
"countsByRole"
resultType=
"java.lang.Long"
>
SELECT
...
...
jshERP-boot/src/main/resources/mapper_xml/SupplierMapperEx.xml
View file @
f8e542cb
...
...
@@ -21,7 +21,7 @@
and telephone like #{bindTelephone}
</if>
and ifnull(delete_flag,'0') !='1'
order by id desc
order by
sort asc,
id desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
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