Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhonghong
custom-server
Commits
23988827
Commit
23988827
authored
Jul 14, 2026
by
Lizh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: P1 Step 2.1+2.2 — 部门/岗位/用户岗位 Entity + Mapper + XML
Co-Authored-By: Claude <noreply@anthropic.com>
parent
28b55cc2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
331 additions
and
0 deletions
+331
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysDeptEntity.java
+103
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysPostEntity.java
+79
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysUserPostEntity.java
+31
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysDeptMapper.java
+49
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysPostMapper.java
+14
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysUserPostMapper.java
+14
-0
custom-server-domain/src/main/resources/mapper/SysDeptMapper.xml
+33
-0
custom-server-domain/src/main/resources/mapper/SysPostMapper.xml
+4
-0
custom-server-domain/src/main/resources/mapper/SysUserPostMapper.xml
+4
-0
No files found.
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysDeptEntity.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 部门表 Entity
*
* @author Lizh
*/
@Data
@TableName
(
"sys_dept"
)
public
class
SysDeptEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 部门ID
*/
@TableId
(
value
=
"dept_id"
,
type
=
IdType
.
AUTO
)
private
Long
deptId
;
/**
* 父部门ID
*/
@TableField
(
"parent_id"
)
private
Long
parentId
;
/**
* 祖级列表
*/
@TableField
(
"ancestors"
)
private
String
ancestors
;
/**
* 部门名称
*/
@TableField
(
"dept_name"
)
private
String
deptName
;
/**
* 显示顺序
*/
@TableField
(
"order_num"
)
private
Integer
orderNum
;
/**
* 负责人
*/
@TableField
(
"leader"
)
private
String
leader
;
/**
* 联系电话
*/
@TableField
(
"phone"
)
private
String
phone
;
/**
* 邮箱
*/
@TableField
(
"email"
)
private
String
email
;
/**
* 部门状态(0正常 1停用)
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 删除标志(0代表存在 2代表删除)
*/
@TableField
(
"del_flag"
)
private
String
delFlag
;
/**
* 创建者
*/
@TableField
(
"create_by"
)
private
String
createBy
;
/**
* 创建时间
*/
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@TableField
(
"update_by"
)
private
String
updateBy
;
/**
* 更新时间
*/
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateTime
;
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysPostEntity.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 岗位信息表 Entity
*
* @author Lizh
*/
@Data
@TableName
(
"sys_post"
)
public
class
SysPostEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 岗位ID
*/
@TableId
(
value
=
"post_id"
,
type
=
IdType
.
AUTO
)
private
Long
postId
;
/**
* 岗位编码
*/
@TableField
(
"post_code"
)
private
String
postCode
;
/**
* 岗位名称
*/
@TableField
(
"post_name"
)
private
String
postName
;
/**
* 显示顺序
*/
@TableField
(
"post_sort"
)
private
Integer
postSort
;
/**
* 状态(0正常 1停用)
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 创建者
*/
@TableField
(
"create_by"
)
private
String
createBy
;
/**
* 创建时间
*/
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@TableField
(
"update_by"
)
private
String
updateBy
;
/**
* 更新时间
*/
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateTime
;
/**
* 备注
*/
@TableField
(
"remark"
)
private
String
remark
;
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysUserPostEntity.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
/**
* 用户与岗位关联表 Entity
*
* @author Lizh
*/
@Data
@TableName
(
"sys_user_post"
)
public
class
SysUserPostEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 用户ID
*/
@TableField
(
"user_id"
)
private
Long
userId
;
/**
* 岗位ID
*/
@TableField
(
"post_id"
)
private
Long
postId
;
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysDeptMapper.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
mapper
;
import
com.jomalls.custom.dal.entity.SysDeptEntity
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 部门 Mapper
*
* @author Lizh
*/
@Mapper
public
interface
SysDeptMapper
extends
BaseMapper
<
SysDeptEntity
>
{
/**
* 查询部门列表
*
* @param dept 查询条件
* @return 部门列表
*/
List
<
SysDeptEntity
>
selectDeptList
(
@Param
(
"dept"
)
SysDeptEntity
dept
);
/**
* 查询部门列表(排除指定子部门)
*
* @param deptId 部门ID
* @return 部门列表
*/
List
<
SysDeptEntity
>
selectDeptListExcludeChild
(
@Param
(
"deptId"
)
Long
deptId
);
/**
* 查询是否有子部门
*
* @param deptId 部门ID
* @return 子部门数量
*/
int
hasChildByDeptId
(
@Param
(
"deptId"
)
Long
deptId
);
/**
* 查询部门下是否存在用户
*
* @param deptId 部门ID
* @return 用户数量
*/
int
checkDeptExistUser
(
@Param
(
"deptId"
)
Long
deptId
);
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysPostMapper.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
mapper
;
import
com.jomalls.custom.dal.entity.SysPostEntity
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 岗位 Mapper
*
* @author Lizh
*/
@Mapper
public
interface
SysPostMapper
extends
BaseMapper
<
SysPostEntity
>
{
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysUserPostMapper.java
0 → 100644
View file @
23988827
package
com
.
jomalls
.
custom
.
dal
.
mapper
;
import
com.jomalls.custom.dal.entity.SysUserPostEntity
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 用户-岗位关联 Mapper
*
* @author Lizh
*/
@Mapper
public
interface
SysUserPostMapper
extends
BaseMapper
<
SysUserPostEntity
>
{
}
custom-server-domain/src/main/resources/mapper/SysDeptMapper.xml
0 → 100644
View file @
23988827
<?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.jomalls.custom.dal.mapper.SysDeptMapper"
>
<select
id=
"selectDeptList"
resultType=
"com.jomalls.custom.dal.entity.SysDeptEntity"
>
SELECT d.*, p.dept_name AS parentName FROM sys_dept d
LEFT JOIN sys_dept p ON d.parent_id = p.dept_id
WHERE d.del_flag = '0'
<if
test=
"dept.deptName != null and dept.deptName != ''"
>
AND d.dept_name LIKE CONCAT('%', #{dept.deptName}, '%')
</if>
<if
test=
"dept.status != null and dept.status != ''"
>
AND d.status = #{dept.status}
</if>
ORDER BY d.parent_id, d.order_num
</select>
<select
id=
"selectDeptListExcludeChild"
resultType=
"com.jomalls.custom.dal.entity.SysDeptEntity"
>
SELECT d.* FROM sys_dept d
WHERE d.del_flag = '0'
AND d.dept_id != #{deptId}
AND d.ancestors NOT LIKE CONCAT('%', #{deptId}, '%')
ORDER BY d.parent_id, d.order_num
</select>
<select
id=
"hasChildByDeptId"
resultType=
"int"
>
SELECT COUNT(1) FROM sys_dept WHERE parent_id = #{deptId} AND del_flag = '0'
</select>
<select
id=
"checkDeptExistUser"
resultType=
"int"
>
SELECT COUNT(1) FROM sys_user WHERE dept_id = #{deptId} AND del_flag = '0'
</select>
</mapper>
custom-server-domain/src/main/resources/mapper/SysPostMapper.xml
0 → 100644
View file @
23988827
<?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.jomalls.custom.dal.mapper.SysPostMapper"
>
</mapper>
custom-server-domain/src/main/resources/mapper/SysUserPostMapper.xml
0 → 100644
View file @
23988827
<?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.jomalls.custom.dal.mapper.SysUserPostMapper"
>
</mapper>
Write
Preview
Markdown
is supported
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