Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zrqx-statistics-2.0
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zrqx-statistics-2.0
Commits
b3bead8c
提交
b3bead8c
authored
2月 05, 2021
作者:
chaoyanjun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
4abe65db
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
130 行增加
和
0 行删除
+130
-0
UserLevelController.java
.../statistics/userlevel/controller/UserLevelController.java
+30
-0
UserLevelMapper.java
...com/zrqx/statistics/userlevel/mapper/UserLevelMapper.java
+31
-0
UserLevelService.java
...m/zrqx/statistics/userlevel/service/UserLevelService.java
+13
-0
UserLevelServiceImpl.java
...qx/statistics/userlevel/service/UserLevelServiceImpl.java
+56
-0
没有找到文件。
src/main/java/com/zrqx/statistics/userlevel/controller/UserLevelController.java
0 → 100644
浏览文件 @
b3bead8c
package
com
.
zrqx
.
statistics
.
userlevel
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zrqx.core.form.userlevel.SaveOrUpdateLevelForm
;
import
com.zrqx.core.response.CallBack
;
import
com.zrqx.statistics.userlevel.service.UserLevelService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@RestController
@RequestMapping
(
"/level"
)
@Api
(
"基准工时"
)
public
class
UserLevelController
{
@Autowired
private
UserLevelService
service
;
@ApiOperation
(
value
=
"人员-工时统计修改/添加基础工时"
)
@PostMapping
(
"/saveOrUpdate/level"
)
public
CallBack
<
Boolean
>
saveOrUpdate
(
@RequestBody
SaveOrUpdateLevelForm
form
){
return
CallBack
.
success
(
service
.
saveOrUpdate
(
form
));
}
}
src/main/java/com/zrqx/statistics/userlevel/mapper/UserLevelMapper.java
0 → 100644
浏览文件 @
b3bead8c
package
com
.
zrqx
.
statistics
.
userlevel
.
mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
com.zrqx.core.form.userlevel.QueryLevelForm
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.userlevel.UserLevel
;
@Mapper
public
interface
UserLevelMapper
extends
BaseMapper
<
UserLevel
>{
@Select
(
"<script>"
+
" select id from zt_user where realname = #{name} "
+
"</script>"
)
Integer
selectUserId
(
@Param
(
"name"
)
String
name
);
@Select
(
"<script>"
+
" select sum(level) from user_info where 1=1 "
+
" eq(name,form.name) "
+
"<if test = '"
+
NOTBLANK
+
"(form.startTime)'>"
+
" AND createTime >= concat(#{form.startTime}) "
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.endTime)'>"
+
" AND createTime <= concat(#{form.endTime}) "
+
"</if>"
+
"</script>"
)
Integer
getSumLevel
(
@Param
(
"form"
)
QueryLevelForm
form
);
}
src/main/java/com/zrqx/statistics/userlevel/service/UserLevelService.java
0 → 100644
浏览文件 @
b3bead8c
package
com
.
zrqx
.
statistics
.
userlevel
.
service
;
import
com.zrqx.core.form.userlevel.QueryLevelForm
;
import
com.zrqx.core.form.userlevel.SaveOrUpdateLevelForm
;
import
com.zrqx.core.model.userlevel.UserLevel
;
import
com.zrqx.core.service.BaseService
;
public
interface
UserLevelService
extends
BaseService
<
UserLevel
,
Integer
>{
Boolean
saveOrUpdate
(
SaveOrUpdateLevelForm
form
);
Integer
getSumLevel
(
QueryLevelForm
form
);
}
src/main/java/com/zrqx/statistics/userlevel/service/UserLevelServiceImpl.java
0 → 100644
浏览文件 @
b3bead8c
package
com
.
zrqx
.
statistics
.
userlevel
.
service
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zrqx.core.form.userlevel.QueryLevelForm
;
import
com.zrqx.core.form.userlevel.SaveOrUpdateLevelForm
;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.userlevel.UserLevel
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.core.util.bean.BeanUtils
;
import
com.zrqx.core.util.datatype.ArrayUtils
;
import
com.zrqx.statistics.userlevel.mapper.UserLevelMapper
;
@Service
public
class
UserLevelServiceImpl
extends
BaseServiceImpl
<
UserLevel
,
Integer
>
implements
UserLevelService
{
@Autowired
private
UserLevelMapper
mapper
;
@Override
public
BaseMapper
<
UserLevel
>
getMapper
()
{
return
mapper
;
}
@Override
public
Boolean
saveOrUpdate
(
SaveOrUpdateLevelForm
form
)
{
// 查看该用户在基准工时表中是否存在 添加或修改
UserLevel
userLe
=
new
UserLevel
();
userLe
.
setName
(
form
.
getName
());
userLe
.
setCreateTime
(
form
.
getCreateTime
());
List
<
UserLevel
>
list
=
mapper
.
select
(
userLe
);
if
(
ArrayUtils
.
empty
(
list
))
{
//不存在,添加
Integer
userId
=
mapper
.
selectUserId
(
form
.
getName
());
UserLevel
ul
=
new
UserLevel
();
BeanUtils
.
copyProperties
(
form
,
ul
);
ul
.
setUserId
(
userId
);
mapper
.
insert
(
ul
);
}
else
{
//存在,修改(不考虑同名同姓)
UserLevel
ul
=
new
UserLevel
();
BeanUtils
.
copyProperties
(
form
,
ul
,
"level"
);
UserLevel
level
=
mapper
.
selectOne
(
ul
);
level
.
setLevel
(
form
.
getLevel
());
mapper
.
updateByPrimaryKeySelective
(
level
);
}
return
true
;
}
@Override
public
Integer
getSumLevel
(
QueryLevelForm
form
)
{
return
mapper
.
getSumLevel
(
form
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论