提交 a70a4913 authored 作者: 宋文杰's avatar 宋文杰

feat(attendance): add attendance shift api and attendance members api

上级 9e9ec885
...@@ -10,6 +10,8 @@ import lombok.AllArgsConstructor; ...@@ -10,6 +10,8 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController; import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;
import java.util.List;
/** /**
* 班次表 * 班次表
...@@ -46,6 +48,20 @@ public class AttendanceTemplatesController extends BaseController { ...@@ -46,6 +48,20 @@ public class AttendanceTemplatesController extends BaseController {
return new R<>(attendanceTemplatesService.getById(shiftId)); return new R<>(attendanceTemplatesService.getById(shiftId));
} }
/**
* @Description: 查询值班班次信息(用于下拉列表)
* @Param: []
* @return: com.elephant.framework.galaxy.aroad.response.R
* @Author: songwenjie
* @Date: 2019/4/15
*/
@GetMapping("/shiftselection")
public R getShiftSelection(){
return new R<>(attendanceTemplatesService.getShiftSelection());
}
/** /**
* 新增班次表 * 新增班次表
* @param attendanceTemplates 班次表 * @param attendanceTemplates 班次表
......
...@@ -3,6 +3,8 @@ package com.elephant.framework.galaxy.aroad.module.attendance.mapper; ...@@ -3,6 +3,8 @@ package com.elephant.framework.galaxy.aroad.module.attendance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates; import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates;
import java.util.List;
/** /**
* 班次表 * 班次表
* *
...@@ -11,4 +13,12 @@ import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTe ...@@ -11,4 +13,12 @@ import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTe
*/ */
public interface AttendanceTemplatesMapper extends BaseMapper<AttendanceTemplates> { public interface AttendanceTemplatesMapper extends BaseMapper<AttendanceTemplates> {
/**
* @Description: 查询值班班次信息(用于下拉列表)
* @Param: []
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates>
* @Author: songwenjie
* @Date: 2019/4/15
*/
List<AttendanceTemplates> getShiftSelection();
} }
...@@ -3,6 +3,8 @@ package com.elephant.framework.galaxy.aroad.module.attendance.service; ...@@ -3,6 +3,8 @@ package com.elephant.framework.galaxy.aroad.module.attendance.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates; import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates;
import java.util.List;
/** /**
* 班次表 * 班次表
* *
...@@ -11,4 +13,12 @@ import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTe ...@@ -11,4 +13,12 @@ import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTe
*/ */
public interface AttendanceTemplatesService extends IService<AttendanceTemplates> { public interface AttendanceTemplatesService extends IService<AttendanceTemplates> {
/**
* @Description: 查询值班班次信息(用于下拉列表)
* @Param: []
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates>
* @Author: songwenjie
* @Date: 2019/4/15
*/
List<AttendanceTemplates> getShiftSelection();
} }
...@@ -6,6 +6,8 @@ import com.elephant.framework.galaxy.aroad.module.attendance.mapper.AttendanceTe ...@@ -6,6 +6,8 @@ import com.elephant.framework.galaxy.aroad.module.attendance.mapper.AttendanceTe
import com.elephant.framework.galaxy.aroad.module.attendance.service.AttendanceTemplatesService; import com.elephant.framework.galaxy.aroad.module.attendance.service.AttendanceTemplatesService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 班次表 * 班次表
* *
...@@ -15,4 +17,14 @@ import org.springframework.stereotype.Service; ...@@ -15,4 +17,14 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AttendanceTemplatesServiceImpl extends ServiceImpl<AttendanceTemplatesMapper, AttendanceTemplates> implements AttendanceTemplatesService { public class AttendanceTemplatesServiceImpl extends ServiceImpl<AttendanceTemplatesMapper, AttendanceTemplates> implements AttendanceTemplatesService {
/**
* @Description: 查询值班班次信息(用于下拉列表)
* @Param: []
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates>
* @Author: songwenjie
* @Date: 2019/4/15
*/
public List<AttendanceTemplates> getShiftSelection(){
return baseMapper.getShiftSelection();
}
} }
...@@ -155,5 +155,17 @@ public class UserController extends BaseController { ...@@ -155,5 +155,17 @@ public class UserController extends BaseController {
public R listAncestorUsers(@PathVariable String username) { public R listAncestorUsers(@PathVariable String username) {
return new R(userService.listAncestorUsers(username)); return new R(userService.listAncestorUsers(username));
} }
/**
* @Description: 获取部门下属的员工信息
* @Param: [deptid]
* @return: com.elephant.framework.galaxy.aroad.response.R
* @Author: songwenjie
* @Date: 2019/4/15
*/
@GetMapping("/selfandchild/{deptid}")
public R getSelfAndChildUsers(@PathVariable Integer deptid){
return new R<>(userService.getSelfAndChildUsers(deptid));
}
} }
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
public class TreeNode { public class TreeNode {
protected int id; protected int id;
protected int parentId; protected int parentId;
protected List<TreeNode> children; protected List<TreeNode> children = new ArrayList<TreeNode>();
public void add(TreeNode node) { public void add(TreeNode node) {
children.add(node); children.add(node);
......
...@@ -45,4 +45,13 @@ public interface UserMapper extends BaseMapper<User> { ...@@ -45,4 +45,13 @@ public interface UserMapper extends BaseMapper<User> {
* @return userVo * @return userVo
*/ */
UserVO getUserVoById(Integer id); UserVO getUserVoById(Integer id);
/**
* @Description: 查询部门下属的员工信息
* @Param: [deptIds]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.system.vo.UserVO>
* @Author: songwenjie
* @Date: 2019/4/15
*/
List<UserVO> getSelfAndChildUsers(@Param("deptIds") List<Integer> deptIds);
} }
...@@ -86,4 +86,23 @@ public interface UserService extends IService<User> { ...@@ -86,4 +86,23 @@ public interface UserService extends IService<User> {
*/ */
Boolean saveUser(UserDTO userDto); Boolean saveUser(UserDTO userDto);
/**
* @Description: 获取当前部门及其下级部门id
* @Param: [selfDeptId]
* @return: java.util.List<java.lang.Integer>
* @Author: songwenjie
* @Date: 2019/4/15
*/
List<Integer> getSelfAndChildDeptIds(Integer selfDeptId);
/**
* @Description: 查询部门下属的员工信息
* @Param: [deptIds]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.system.vo.UserVO>
* @Author: songwenjie
* @Date: 2019/4/15
*/
List<UserVO> getSelfAndChildUsers(Integer selfDeptId);
} }
...@@ -228,4 +228,35 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -228,4 +228,35 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* @Description: 获取当前部门及其下级部门id
* @Param: [selfDeptId]
* @return: java.util.List<java.lang.Integer>
* @Author: songwenjie
* @Date: 2019/4/15
*/
public List<Integer> getSelfAndChildDeptIds(Integer selfDeptId) {
//获取当前部门的子部门
List<Integer> childDeptIds = deptRelationService
.list(Wrappers.<DeptRelation>query().lambda()
.eq(DeptRelation::getAncestor, selfDeptId))
.stream()
.map(DeptRelation::getDescendant)
.collect(Collectors.toList());
childDeptIds.add(selfDeptId);
return childDeptIds;
}
/**
* @Description: 查询部门下属的员工信息
* @Param: [deptIds]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.system.vo.UserVO>
* @Author: songwenjie
* @Date: 2019/4/15
*/
public List<UserVO> getSelfAndChildUsers(Integer selfDeptId){
List<Integer> deptIds = getSelfAndChildDeptIds(selfDeptId);
return baseMapper.getSelfAndChildUsers(deptIds);
}
} }
...@@ -5,7 +5,7 @@ spring: ...@@ -5,7 +5,7 @@ spring:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/aroad?useUnicode=true&characterEncoding=utf-8&useSSL=false url: jdbc:mysql://127.0.0.1:3306/aroad?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root username: root
password: root password: 123456
cache: cache:
type: redis type: redis
redis: redis:
......
...@@ -15,4 +15,11 @@ ...@@ -15,4 +15,11 @@
<result property="position" column="position"/> <result property="position" column="position"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<select id="getShiftSelection" resultMap="attendanceTemplatesMap">
select
shift_name,shift_id
from
attendance_templates
</select>
</mapper> </mapper>
...@@ -24,6 +24,13 @@ ...@@ -24,6 +24,13 @@
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="userDeptResultMap" type="com.elephant.framework.galaxy.aroad.module.system.vo.UserVO">
<id column="user_id" property="userId"/>
<result column="username" property="username"/>
<result column="phone" property="phone"/>
<result column="dept_id" property="deptId"/>
<result column="name" property="deptName"/>
</resultMap>
<!-- userVo结果集 --> <!-- userVo结果集 -->
<resultMap id="userVoResultMap" type="com.elephant.framework.galaxy.aroad.module.system.vo.UserVO"> <resultMap id="userVoResultMap" type="com.elephant.framework.galaxy.aroad.module.system.vo.UserVO">
...@@ -152,4 +159,18 @@ ...@@ -152,4 +159,18 @@
</where> </where>
ORDER BY `user`.create_time DESC ORDER BY `user`.create_time DESC
</select> </select>
<select id="getSelfAndChildUsers" resultMap="userDeptResultMap">
select
d.dept_id,d.name,
u.user_id,u.username,u.phone
from sys_dept d
inner join sys_user u
on d.dept_id = u.dept_id
where d.dept_id
in
<foreach collection="deptIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论