parent
c2536a297d
commit
ab0258c0d3
36 changed files with 770 additions and 132 deletions
@ -0,0 +1,45 @@ |
||||
package com.daqing.financial.hrms; |
||||
|
||||
import com.daqing.framework.domain.hrms.request.PositionRequest; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
|
||||
/** |
||||
* @Author: gongsj. |
||||
* @Description: 职位信息管理controllerApi定义 |
||||
* @Date:Created in 2020/09/07 11:33. |
||||
* @Modified By: |
||||
*/ |
||||
@Api(value = "职位信息管理相关操作", tags = "提供职位信息增删改查等相关方法") |
||||
public interface PositionControllerApi { |
||||
/** |
||||
* 新增一条职位信息 |
||||
*/ |
||||
@ApiOperation(value = "新增一条职位信息", notes = "新增一条职位信息") |
||||
ResponseResult save(PositionRequest positionRequest); |
||||
|
||||
/** |
||||
* 分页加条件查询职位信息 |
||||
*/ |
||||
@ApiOperation(value = "分页加条件查询职位信息", notes = "分页加条件查询职位信息") |
||||
ResponseResult list(Integer page, Integer size, String queryMsg); |
||||
|
||||
/** |
||||
* 修改职位信息 |
||||
*/ |
||||
@ApiOperation(value = "修改职位信息", notes = "修改职位信息") |
||||
ResponseResult update(PositionRequest positionRequest); |
||||
|
||||
/** |
||||
* 根据职位id查询职位信息详情 |
||||
*/ |
||||
@ApiOperation(value = "修改职位信息", notes = "修改职位信息") |
||||
ResponseResult info(Long id); |
||||
|
||||
/** |
||||
* 删除职位信息 |
||||
*/ |
||||
@ApiOperation(value = "删除职位信息", notes = "删除职位信息") |
||||
ResponseResult delete(Long[] ids); |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.daqing.financial.hrms.config; |
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
@Configuration |
||||
public class IPageConfig { |
||||
@Bean |
||||
public PaginationInterceptor paginationInterceptor() { |
||||
return new PaginationInterceptor(); |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
package com.daqing.financial.hrms.dao; |
||||
|
||||
import com.daqing.framework.domain.hrms.DeptPositionEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-14 09:35:05 |
||||
*/ |
||||
@Mapper |
||||
public interface DeptPositionDao extends BaseMapper<DeptPositionEntity> { |
||||
int saveBatch(@Param("list") List<DeptPositionEntity> deptPositionList); |
||||
|
||||
int deleteByPositionId(@Param("positionId") Long positionId); |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.daqing.financial.hrms.dao; |
||||
|
||||
import com.daqing.framework.domain.hrms.EmployeeDeptEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 员工—部门中间表 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-14 09:35:05 |
||||
*/ |
||||
@Mapper |
||||
public interface EmployeeDeptDao extends BaseMapper<EmployeeDeptEntity> { |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.daqing.financial.hrms.dao; |
||||
|
||||
import com.daqing.framework.domain.hrms.EmployeePositionEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 员工——职位中间表 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-14 09:35:05 |
||||
*/ |
||||
@Mapper |
||||
public interface EmployeePositionDao extends BaseMapper<EmployeePositionEntity> { |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.daqing.financial.hrms.dao; |
||||
|
||||
import com.daqing.framework.domain.hrms.EmployeeRoleEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-14 09:35:05 |
||||
*/ |
||||
@Mapper |
||||
public interface EmployeeRoleDao extends BaseMapper<EmployeeRoleEntity> { |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.daqing.financial.hrms.dao; |
||||
|
||||
import com.daqing.framework.domain.hrms.RolePermissionEntity; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 角色——权限中间表 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-14 09:35:05 |
||||
*/ |
||||
@Mapper |
||||
public interface RolePermissionDao extends BaseMapper<RolePermissionEntity> { |
||||
|
||||
} |
@ -1,29 +1,30 @@ |
||||
package com.daqing.financial.hrms.service.impl; |
||||
|
||||
import org.springframework.stereotype.Service; |
||||
import java.util.Map; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.daqing.framework.utils.PageUtils; |
||||
import com.daqing.framework.utils.Query; |
||||
|
||||
import com.daqing.financial.hrms.dao.PermissionDao; |
||||
import com.daqing.framework.domain.hrms.PermissionEntity; |
||||
import com.daqing.financial.hrms.service.PermissionService; |
||||
import com.daqing.framework.domain.hrms.PermissionEntity; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Comparator; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
@Service("permissionService") |
||||
public class PermissionServiceImpl extends ServiceImpl<PermissionDao, PermissionEntity> implements PermissionService { |
||||
|
||||
@Override |
||||
public PageUtils queryPage(Map<String, Object> params) { |
||||
IPage<PermissionEntity> page = this.page( |
||||
new Query<PermissionEntity>().getPage(params), |
||||
new QueryWrapper<PermissionEntity>() |
||||
); |
||||
public List<PermissionEntity> listWithTree() { |
||||
return getPermissionTreeList(this.list(), 0L); |
||||
} |
||||
|
||||
return new PageUtils(page); |
||||
private List<PermissionEntity> getPermissionTreeList(List<PermissionEntity> list, Long parentId) { |
||||
return list.stream() |
||||
.filter(item -> parentId.equals(item.getParentId())) |
||||
.peek(item -> item.setChildren(getPermissionTreeList(list, item.getId()))) |
||||
.sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) |
||||
.collect(Collectors.toList()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
<?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.daqing.financial.hrms.dao.DeptPositionDao"> |
||||
|
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.DeptPositionEntity" id="deptPositionMap"> |
||||
<result property="id" column="id"/> |
||||
<result property="deptId" column="dept_id"/> |
||||
<result property="positionId" column="position_id"/> |
||||
</resultMap> |
||||
<insert id="saveBatch" parameterType="java.util.List"> |
||||
INSERT INTO hrms_dept_position (id, dept_id, position_id) |
||||
VALUES |
||||
<foreach collection="list" index="index" separator="," item="item"> |
||||
(#{item.id}, #{item.deptId}, #{item.positionId}) |
||||
</foreach> |
||||
</insert> |
||||
|
||||
<delete id="deleteByPositionId"> |
||||
DELETE |
||||
FROM |
||||
hrms_dept_position |
||||
WHERE |
||||
position_id = #{positionId} |
||||
</delete> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
<?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.daqing.financial.hrms.dao.EmployeeDeptDao"> |
||||
|
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.EmployeeDeptEntity" id="employeeDeptMap"> |
||||
<result property="id" column="id"/> |
||||
<result property="employeeId" column="employee_id"/> |
||||
<result property="deptId" column="dept_id"/> |
||||
</resultMap> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
<?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.daqing.financial.hrms.dao.EmployeePositionDao"> |
||||
|
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.EmployeePositionEntity" id="employeePositionMap"> |
||||
<result property="id" column="id"/> |
||||
<result property="empId" column="emp_id"/> |
||||
<result property="positionId" column="position_id"/> |
||||
</resultMap> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
<?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.daqing.financial.hrms.dao.EmployeeRoleDao"> |
||||
|
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.EmployeeRoleEntity" id="employeeRoleMap"> |
||||
<result property="id" column="id"/> |
||||
<result property="userId" column="user_id"/> |
||||
<result property="roleId" column="role_id"/> |
||||
</resultMap> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
<?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.daqing.financial.hrms.dao.RolePermissionDao"> |
||||
|
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.RolePermissionEntity" id="rolePermissionMap"> |
||||
<result property="id" column="id"/> |
||||
<result property="roleId" column="role_id"/> |
||||
<result property="permissionId" column="permission_id"/> |
||||
</resultMap> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,36 @@ |
||||
package com.daqing.framework.domain.hrms; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 16:26:04 |
||||
*/ |
||||
@Data |
||||
@TableName("hrms_dept_position") |
||||
public class DeptPositionEntity implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 主键 |
||||
*/ |
||||
@TableId(value = "id", type = IdType.INPUT) |
||||
private Long id; |
||||
/** |
||||
* 部门id |
||||
*/ |
||||
private Long deptId; |
||||
/** |
||||
* 职位id |
||||
*/ |
||||
private Long positionId; |
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.daqing.framework.domain.hrms.ext; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 记录职位信息 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 16:26:04 |
||||
*/ |
||||
@Data |
||||
public class PositionVO implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
/** |
||||
* 职位名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 所属部门 |
||||
*/ |
||||
private String deptNames; |
||||
/** |
||||
* 创建人 |
||||
*/ |
||||
private String createUserName; |
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
} |
||||
|
@ -0,0 +1,36 @@ |
||||
package com.daqing.framework.domain.hrms.request; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 记录职位信息 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 16:26:04 |
||||
*/ |
||||
@Data |
||||
public class PositionRequest implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
/** |
||||
* 用户id |
||||
*/ |
||||
private Long userId; |
||||
/** |
||||
* 部门id |
||||
*/ |
||||
private Long[] deptIds; |
||||
/** |
||||
* 职位名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 职位介绍 |
||||
*/ |
||||
private String introduction; |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.daqing.framework.domain.hrms.response; |
||||
|
||||
import com.daqing.framework.domain.hrms.DeptEntity; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 记录职位信息 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 16:26:04 |
||||
*/ |
||||
@Data |
||||
public class PositionResponse implements Serializable { |
||||
|
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
/** |
||||
* 职位名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 职位介绍 |
||||
*/ |
||||
private String introduction; |
||||
/** |
||||
* 部门列表 |
||||
*/ |
||||
private List<DeptEntity> deptList; |
||||
} |
Loading…
Reference in new issue