Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
d8384bbe
由
张雷
编写于
2025-01-06 15:43:23 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改厂站人员接口
1 个父辈
131938af
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
107 行增加
和
18 行删除
sk-module-system/src/main/java/com/skua/modules/system/controller/SysFactoryUserInfoController.java
sk-module-system/src/main/java/com/skua/modules/system/entity/SysFactoryUserInfo.java
sk-module-system/src/main/java/com/skua/modules/system/mapper/SysFactoryUserInfoMapper.java
sk-module-system/src/main/java/com/skua/modules/system/mapper/xml/SysFactoryUserInfoMapper.xml
sk-module-system/src/main/java/com/skua/modules/system/service/ISysFactoryUserInfoService.java
sk-module-system/src/main/java/com/skua/modules/system/service/impl/SysFactoryUserInfoServiceImpl.java
sk-module-system/src/main/java/com/skua/modules/system/controller/SysFactoryUserInfoController.java
查看文件 @
d8384bb
...
...
@@ -11,6 +11,8 @@ import java.util.Map;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.skua.modules.system.entity.SysUser
;
import
com.skua.modules.system.service.ISysUserService
;
import
org.apache.commons.lang.StringUtils
;
import
org.jeecgframework.poi.excel.ExcelImportUtil
;
import
org.jeecgframework.poi.excel.def.NormalExcelConstants
;
...
...
@@ -63,6 +65,8 @@ public class SysFactoryUserInfoController {
@Autowired
private
ISysFactoryUserInfoService
sysFactoryUserInfoService
;
@Autowired
private
ISysUserService
sysUserService
;
@Autowired
private
ISequenceService
sequenceService
;
/**
* 分页列表查询
...
...
@@ -80,15 +84,16 @@ public class SysFactoryUserInfoController {
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
{
Result
<
IPage
<
SysFactoryUserInfo
>>
result
=
new
Result
<
IPage
<
SysFactoryUserInfo
>>();
QueryWrapper
<
SysFactoryUserInfo
>
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
sysFactoryUserInfo
,
req
.
getParameterMap
());
String
departIds
=
BaseContextHandler
.
getDeparts
();
String
[]
departIdArray
=
departIds
.
split
(
","
);
if
(
StringUtils
.
isEmpty
(
sysFactoryUserInfo
.
getDepartId
())&&
StringUtils
.
isNotBlank
(
departIds
))
{
queryWrapper
.
in
(
"depart_id"
,
departIdArray
);
}
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
sysFactoryUserInfo
.
getDepartId
()),
"depart_id"
,
sysFactoryUserInfo
.
getDepartId
());
Page
<
SysFactoryUserInfo
>
page
=
new
Page
<
SysFactoryUserInfo
>(
pageNo
,
pageSize
);
IPage
<
SysFactoryUserInfo
>
pageList
=
sysFactoryUserInfoService
.
page
(
page
,
queryWrapper
);
// QueryWrapper<SysFactoryUserInfo> queryWrapper = QueryGenerator.initQueryWrapper(sysFactoryUserInfo, req.getParameterMap());
// String departIds = BaseContextHandler.getDeparts();
// String[] departIdArray = departIds.split(",");
// if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
// queryWrapper.in("depart_id", departIdArray);
// }
// queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
// IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.page(page, queryWrapper);
IPage
<
SysFactoryUserInfo
>
pageList
=
sysFactoryUserInfoService
.
getPage
(
page
,
sysFactoryUserInfo
);
result
.
setSuccess
(
true
);
result
.
setResult
(
pageList
);
return
result
;
...
...
@@ -101,14 +106,14 @@ public class SysFactoryUserInfoController {
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
int
female
=
0
;
int
male
=
0
;
QueryWrapper
<
SysFactoryUserInfo
>
queryWrapper
=
new
QueryWrapper
<>();
String
departIds
=
BaseContextHandler
.
getDeparts
();
String
[]
departIdArray
=
departIds
.
split
(
","
);
if
(
StringUtils
.
isEmpty
(
sysFactoryUserInfo
.
getDepartId
())&&
StringUtils
.
isNotBlank
(
departIds
))
{
queryWrapper
.
in
(
"depart_id"
,
departIdArray
);
}
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
sysFactoryUserInfo
.
getDepartId
()),
"depart_id"
,
sysFactoryUserInfo
.
getDepartId
());
List
<
SysFactoryUserInfo
>
list
=
sysFactoryUserInfoService
.
list
(
queryWrapper
);
//
QueryWrapper<SysFactoryUserInfo> queryWrapper = new QueryWrapper<>();
//
String departIds = BaseContextHandler.getDeparts();
//
String[] departIdArray = departIds.split(",");
//
if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
//
queryWrapper.in("depart_id", departIdArray);
//
}
//
queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
List
<
SysFactoryUserInfo
>
list
=
sysFactoryUserInfoService
.
getList
(
sysFactoryUserInfo
);
if
(
list
.
size
()>
0
){
map
.
put
(
"total"
,
list
.
size
());
for
(
SysFactoryUserInfo
factoryUserInfo
:
list
)
{
...
...
@@ -141,6 +146,15 @@ public class SysFactoryUserInfoController {
public
Result
<
SysFactoryUserInfo
>
add
(
@RequestBody
SysFactoryUserInfo
sysFactoryUserInfo
)
{
Result
<
SysFactoryUserInfo
>
result
=
new
Result
<
SysFactoryUserInfo
>();
try
{
if
(
StringUtils
.
isNotEmpty
(
sysFactoryUserInfo
.
getUserId
())){
SysUser
user
=
sysUserService
.
getById
(
sysFactoryUserInfo
.
getUserId
());
if
(
ConvertUtils
.
isNotEmpty
(
user
)){
sysFactoryUserInfo
.
setUserName
(
user
.
getRealname
());
sysFactoryUserInfo
.
setEmail
(
user
.
getEmail
());
sysFactoryUserInfo
.
setTelephone
(
user
.
getPhone
());
sysFactoryUserInfo
.
setSex
(
user
.
getSalt
());
}
}
sysFactoryUserInfo
.
setId
(
String
.
valueOf
(
sequenceService
.
nextId
()));
sysFactoryUserInfoService
.
save
(
sysFactoryUserInfo
);
result
.
success
(
"添加成功!"
);
...
...
@@ -166,7 +180,6 @@ public class SysFactoryUserInfoController {
result
.
error500
(
"未找到对应实体"
);
}
else
{
boolean
ok
=
sysFactoryUserInfoService
.
updateById
(
sysFactoryUserInfo
);
//TODO 返回false说明什么?
if
(
ok
)
{
result
.
success
(
"修改成功!"
);
}
...
...
sk-module-system/src/main/java/com/skua/modules/system/entity/SysFactoryUserInfo.java
查看文件 @
d8384bb
package
com
.
skua
.
modules
.
system
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.skua.core.aspect.annotation.Dict
;
...
...
@@ -43,6 +44,9 @@ public class SysFactoryUserInfo {
/**邮箱*/
@ApiModelProperty
(
value
=
"邮箱"
)
private
java
.
lang
.
String
email
;
/**工号*/
@ApiModelProperty
(
value
=
"工号"
)
private
java
.
lang
.
String
workNo
;
/**学历*/
@ApiModelProperty
(
value
=
"学历"
)
private
java
.
lang
.
String
degree
;
...
...
@@ -74,4 +78,7 @@ public class SysFactoryUserInfo {
/**合同到期时间*/
@ApiModelProperty
(
value
=
"合同到期时间"
)
private
java
.
lang
.
String
contractEnddate
;
/**角色*/
@TableField
(
exist
=
false
)
private
String
roleName
;
}
...
...
sk-module-system/src/main/java/com/skua/modules/system/mapper/SysFactoryUserInfoMapper.java
查看文件 @
d8384bb
...
...
@@ -11,4 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
SysFactoryUserInfoMapper
extends
BaseMapper
<
SysFactoryUserInfo
>
{
List
<
SysFactoryUserInfo
>
getList
(
String
departIds
,
String
userName
);
}
...
...
sk-module-system/src/main/java/com/skua/modules/system/mapper/xml/SysFactoryUserInfoMapper.xml
查看文件 @
d8384bb
...
...
@@ -2,4 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.skua.modules.system.mapper.SysFactoryUserInfoMapper"
>
</mapper>
\ No newline at end of file
<select
id=
"getList"
resultType=
"com.skua.modules.system.entity.SysFactoryUserInfo"
>
SELECT
group_concat( DISTINCT ( SELECT r.role_name FROM sys_role r WHERE r.id = sur.role_id ) ) role_name,
fu.*
FROM
sys_factory_user_info fu
LEFT JOIN sys_user_role sur ON fu.user_id = sur.user_id
where 1 = 1
<if
test=
"departIds!=null and departIds!=''"
>
AND fu.depart_id in
<foreach
item=
"item"
index=
"index"
collection=
"departIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"userName!=null and userName!=''"
>
and fu.user_name like concat('%',#{userName},'%')
</if>
GROUP BY
fu.user_id
</select>
</mapper>
...
...
sk-module-system/src/main/java/com/skua/modules/system/service/ISysFactoryUserInfoService.java
查看文件 @
d8384bb
package
com
.
skua
.
modules
.
system
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.skua.modules.system.entity.SysFactoryUserInfo
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.skua.modules.system.entity.SysUser
;
import
java.util.List
;
/**
* 厂站人员管理
*/
public
interface
ISysFactoryUserInfoService
extends
IService
<
SysFactoryUserInfo
>
{
IPage
<
SysFactoryUserInfo
>
getPage
(
Page
<
SysFactoryUserInfo
>
page
,
SysFactoryUserInfo
sysFactoryUserInfo
);
List
<
SysFactoryUserInfo
>
getList
(
SysFactoryUserInfo
sysFactoryUserInfo
);
SysFactoryUserInfo
saveOrUpdateByUser
(
SysUser
sysUser
);
}
...
...
sk-module-system/src/main/java/com/skua/modules/system/service/impl/SysFactoryUserInfoServiceImpl.java
查看文件 @
d8384bb
package
com
.
skua
.
modules
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.skua.core.context.BaseContextHandler
;
import
com.skua.modules.system.entity.SysFactoryUserInfo
;
import
com.skua.modules.system.entity.SysUser
;
import
com.skua.modules.system.mapper.SysFactoryUserInfoMapper
;
import
com.skua.modules.system.service.ISysFactoryUserInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 厂站人员管理
*/
@Service
public
class
SysFactoryUserInfoServiceImpl
extends
ServiceImpl
<
SysFactoryUserInfoMapper
,
SysFactoryUserInfo
>
implements
ISysFactoryUserInfoService
{
@Autowired
private
SysFactoryUserInfoMapper
sysFactoryUserInfoMapper
;
@Override
public
IPage
<
SysFactoryUserInfo
>
getPage
(
Page
<
SysFactoryUserInfo
>
page
,
SysFactoryUserInfo
sysFactoryUserInfo
)
{
List
<
SysFactoryUserInfo
>
list
=
getList
(
sysFactoryUserInfo
);
page
.
setTotal
(
list
.
size
());
page
.
setRecords
(
list
);
return
page
;
}
@Override
public
List
<
SysFactoryUserInfo
>
getList
(
SysFactoryUserInfo
sysFactoryUserInfo
)
{
List
<
SysFactoryUserInfo
>
list
=
new
ArrayList
<>();
String
departIds
=
BaseContextHandler
.
getDeparts
();
if
(
StringUtils
.
isNotEmpty
(
sysFactoryUserInfo
.
getDepartId
())){
departIds
=
sysFactoryUserInfo
.
getDepartId
();
}
list
=
sysFactoryUserInfoMapper
.
getList
(
departIds
,
sysFactoryUserInfo
.
getUserName
());
return
list
;
}
@Override
public
SysFactoryUserInfo
saveOrUpdateByUser
(
SysUser
sysUser
)
{
return
null
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论