提交代码

dev_xd
姜玉琦 2024-08-25 21:25:51 +08:00
parent 589f8e7132
commit 77fa7476d8
37 changed files with 971 additions and 411 deletions

View File

@ -34,6 +34,7 @@
<jjwt.version>0.9.1</jjwt.version> <jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version> <minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<pinyin4j.version>2.5.1</pinyin4j.version>
<transmittable-thread-local.version>2.14.2</transmittable-thread-local.version> <transmittable-thread-local.version>2.14.2</transmittable-thread-local.version>
</properties> </properties>
@ -143,6 +144,13 @@
<version>${transmittable-thread-local.version}</version> <version>${transmittable-thread-local.version}</version>
</dependency> </dependency>
<!-- Belerweb Pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
<!-- 核心模块 --> <!-- 核心模块 -->
<dependency> <dependency>
<groupId>com.yanzhu</groupId> <groupId>com.yanzhu</groupId>

View File

@ -31,6 +31,18 @@ public class SysDept extends BaseEntity
/** 部门名称 */ /** 部门名称 */
private String deptName; private String deptName;
/** 部门简称 */
private String deptShortName;
/** 部门简称 */
private String deptCode;
/** 部门详情 */
private String deptType;
/** 部门详情 */
private String deptInfos;
/** 显示顺序 */ /** 显示顺序 */
private Integer orderNum; private Integer orderNum;
@ -181,6 +193,38 @@ public class SysDept extends BaseEntity
this.children = children; this.children = children;
} }
public String getDeptShortName() {
return deptShortName;
}
public void setDeptShortName(String deptShortName) {
this.deptShortName = deptShortName;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public String getDeptType() {
return deptType;
}
public void setDeptType(String deptType) {
this.deptType = deptType;
}
public String getDeptInfos() {
return deptInfos;
}
public void setDeptInfos(String deptInfos) {
this.deptInfos = deptInfos;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -188,6 +232,10 @@ public class SysDept extends BaseEntity
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("ancestors", getAncestors()) .append("ancestors", getAncestors())
.append("deptName", getDeptName()) .append("deptName", getDeptName())
.append("deptShortName", getDeptShortName())
.append("deptCode", getDeptCode())
.append("deptType", getDeptType())
.append("deptInfos", getDeptInfos())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("leader", getLeader()) .append("leader", getLeader())
.append("phone", getPhone()) .append("phone", getPhone())

View File

@ -1,5 +1,6 @@
package com.yanzhu.system.api.domain; package com.yanzhu.system.api.domain;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -58,12 +59,17 @@ public class SysRole extends BaseEntity
/** 菜单组 */ /** 菜单组 */
private Long[] menuIds; private Long[] menuIds;
/** 部门主键 */
private Long deptId;
/** 部门组(数据权限) */ /** 部门组(数据权限) */
private Long[] deptIds; private Long[] deptIds;
/** 角色菜单权限 */ /** 角色菜单权限 */
private Set<String> permissions; private Set<String> permissions;
private List<SysRoleDept> roleDeptList;
public SysRole() public SysRole()
{ {
@ -219,6 +225,22 @@ public class SysRole extends BaseEntity
this.permissions = permissions; this.permissions = permissions;
} }
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public List<SysRoleDept> getRoleDeptList() {
return roleDeptList;
}
public void setRoleDeptList(List<SysRoleDept> roleDeptList) {
this.roleDeptList = roleDeptList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,4 +1,4 @@
package com.yanzhu.system.domain; package com.yanzhu.system.api.domain;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -16,6 +16,9 @@ public class SysRoleDept
/** 部门ID */ /** 部门ID */
private Long deptId; private Long deptId;
/** 部门名称 */
private String deptName;
public Long getRoleId() public Long getRoleId()
{ {
return roleId; return roleId;
@ -36,6 +39,14 @@ public class SysRoleDept
this.deptId = deptId; this.deptId = deptId;
} }
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -37,6 +37,22 @@ public class SysUser extends BaseEntity
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** 用户类型 */
@Excel(name = "用户类型")
private String userType;
/** 证件类型 */
@Excel(name = "证件类型")
private String cardType;
/** 证件号码 */
@Excel(name = "证件号码")
private String cardCode;
/** 用户详情 */
@Excel(name = "用户详情")
private String userInfos;
/** 用户邮箱 */ /** 用户邮箱 */
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; private String email;
@ -129,6 +145,19 @@ public class SysUser extends BaseEntity
this.deptId = deptId; this.deptId = deptId;
} }
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
@Xss(message = "用户昵称不能包含脚本字符") @Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() public String getNickName()
@ -141,17 +170,36 @@ public class SysUser extends BaseEntity
this.nickName = nickName; this.nickName = nickName;
} }
@Xss(message = "用户账号不能包含脚本字符") public String getUserType() {
@NotBlank(message = "用户账号不能为空") return userType;
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
return userName;
} }
public void setUserName(String userName) public void setUserType(String userType) {
{ this.userType = userType;
this.userName = userName; }
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getCardCode() {
return cardCode;
}
public void setCardCode(String cardCode) {
this.cardCode = cardCode;
}
public String getUserInfos() {
return userInfos;
}
public void setUserInfos(String userInfos) {
this.userInfos = userInfos;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@ -296,6 +344,7 @@ public class SysUser extends BaseEntity
{ {
this.roleId = roleId; this.roleId = roleId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -303,6 +352,10 @@ public class SysUser extends BaseEntity
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("userName", getUserName()) .append("userName", getUserName())
.append("nickName", getNickName()) .append("nickName", getNickName())
.append("userType", getUserType())
.append("cardType", getCardType())
.append("cardCode", getCardCode())
.append("userInfos", getUserInfos())
.append("email", getEmail()) .append("email", getEmail())
.append("phonenumber", getPhonenumber()) .append("phonenumber", getPhonenumber())
.append("sex", getSex()) .append("sex", getSex())

View File

@ -41,6 +41,9 @@ public class BaseEntity implements Serializable
/** 选中页签 */ /** 选中页签 */
private String activeName; private String activeName;
/** 所属单位 */
private Long activeDeptId;
/** 请求参数 */ /** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params; private Map<String, Object> params;
@ -126,4 +129,12 @@ public class BaseEntity implements Serializable
public void setActiveName(String activeName) { public void setActiveName(String activeName) {
this.activeName = activeName; this.activeName = activeName;
} }
public Long getActiveDeptId() {
return activeDeptId;
}
public void setActiveDeptId(Long activeDeptId) {
this.activeDeptId = activeDeptId;
}
} }

View File

@ -22,6 +22,10 @@ public class ProProjectInfo extends BaseEntity
@Excel(name = "所属单位") @Excel(name = "所属单位")
private Long deptId; private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 部门主键 */ /** 部门主键 */
@Excel(name = "部门主键") @Excel(name = "部门主键")
private Long visDeptId; private Long visDeptId;
@ -48,7 +52,7 @@ public class ProProjectInfo extends BaseEntity
/** 项目等级 */ /** 项目等级 */
@Excel(name = "项目等级") @Excel(name = "项目等级")
private String projiectLevel; private String projectLevel;
/** 项目区县 */ /** 项目区县 */
@Excel(name = "项目区县") @Excel(name = "项目区县")
@ -222,14 +226,14 @@ public class ProProjectInfo extends BaseEntity
{ {
return projectType; return projectType;
} }
public void setProjiectLevel(String projiectLevel) public void setprojectLevel(String projectLevel)
{ {
this.projiectLevel = projiectLevel; this.projectLevel = projectLevel;
} }
public String getProjiectLevel() public String getprojectLevel()
{ {
return projiectLevel; return projectLevel;
} }
public void setProjectRegional(String projectRegional) public void setProjectRegional(String projectRegional)
{ {
@ -457,6 +461,14 @@ public class ProProjectInfo extends BaseEntity
return isDel; return isDel;
} }
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -468,7 +480,7 @@ public class ProProjectInfo extends BaseEntity
.append("projectCode", getProjectCode()) .append("projectCode", getProjectCode())
.append("simpleName", getSimpleName()) .append("simpleName", getSimpleName())
.append("projectType", getProjectType()) .append("projectType", getProjectType())
.append("projiectLevel", getProjiectLevel()) .append("projectLevel", getprojectLevel())
.append("projectRegional", getProjectRegional()) .append("projectRegional", getProjectRegional())
.append("projectAddress", getProjectAddress()) .append("projectAddress", getProjectAddress())
.append("projectNature", getProjectNature()) .append("projectNature", getProjectNature())

View File

@ -22,10 +22,18 @@ public class ProProjectInfoSubdepts extends BaseEntity
@Excel(name = "单位主键") @Excel(name = "单位主键")
private Long deptId; private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 项目主键 */ /** 项目主键 */
@Excel(name = "项目主键") @Excel(name = "项目主键")
private Long projectId; private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */ /** 分包单位 */
@Excel(name = "分包单位") @Excel(name = "分包单位")
private Long subDeptId; private Long subDeptId;
@ -210,6 +218,22 @@ public class ProProjectInfoSubdepts extends BaseEntity
return isDel; return isDel;
} }
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,6 +22,10 @@ public class ProProjectInfoSubdeptsGroup extends BaseEntity
@Excel(name = "项目主键") @Excel(name = "项目主键")
private Long projectId; private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */ /** 分包单位 */
@Excel(name = "分包单位") @Excel(name = "分包单位")
private Long subDeptId; private Long subDeptId;
@ -236,6 +240,14 @@ public class ProProjectInfoSubdeptsGroup extends BaseEntity
return isDel; return isDel;
} }
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -25,6 +25,10 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity
@Excel(name = "项目主键") @Excel(name = "项目主键")
private Long projectId; private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */ /** 分包单位 */
@Excel(name = "分包单位") @Excel(name = "分包单位")
private Long subDeptId; private Long subDeptId;
@ -253,6 +257,14 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity
return isDel; return isDel;
} }
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,10 +22,18 @@ public class ProProjectInfoUsers extends BaseEntity
@Excel(name = "单位主键") @Excel(name = "单位主键")
private Long deptId; private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 项目主键 */ /** 项目主键 */
@Excel(name = "项目主键") @Excel(name = "项目主键")
private Long projectId; private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 用户主键 */ /** 用户主键 */
@Excel(name = "用户主键") @Excel(name = "用户主键")
private Long userId; private Long userId;
@ -132,6 +140,22 @@ public class ProProjectInfoUsers extends BaseEntity
return isDel; return isDel;
} }
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,15 +22,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectProProjectInfoDeptsVo"> <sql id="selectProProjectInfoDeptsVo">
select pd.id, pd.project_id, pi.project_name, pd.dept_type, pd.dept_name, pd.dept_code, pd.is_del, pd.create_by, pd.create_time, pd.update_by, pd.update_time, pd.remark from pro_project_info_depts pd select pd.id, pd.project_id, pi.project_name, pd.dept_type, pd.dept_name, pd.dept_code, pd.is_del, pd.create_by, pd.create_time, pd.update_by, pd.update_time, pd.remark from pro_project_info_depts pd
left join pro_project_info pi on pi.id = pd.project_id left join pro_project_info pi on pi.id = pd.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoDeptsList" parameterType="ProProjectInfoDepts" resultMap="ProProjectInfoDeptsResult"> <select id="selectProProjectInfoDeptsList" parameterType="ProProjectInfoDepts" resultMap="ProProjectInfoDeptsResult">
<include refid="selectProProjectInfoDeptsVo"/> <include refid="selectProProjectInfoDeptsVo"/>
<where> <where>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and pd.project_id = #{projectId}</if> <if test="projectId != null "> and pd.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="deptType != null and deptType != ''"> and pd.dept_type = #{deptType}</if> <if test="deptType != null and deptType != ''"> and pd.dept_type = #{deptType}</if>
<if test="deptName != null and deptName != ''"> and pd.dept_name like concat('%', #{deptName}, '%')</if> <if test="deptName != null and deptName != ''"> and pd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="deptCode != null and deptCode != ''"> and pd.dept_code = #{deptCode}</if> <if test="deptCode != null and deptCode != ''"> and pd.dept_code = #{deptCode}</if>
<if test="isDel != null "> and pd.is_del = #{isDel}</if> <if test="isDel != null "> and pd.is_del = #{isDel}</if>
</where> </where>

View File

@ -7,13 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfo" id="ProProjectInfoResult"> <resultMap type="ProProjectInfo" id="ProProjectInfoResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="visDeptId" column="vis_dept_id" /> <result property="visDeptId" column="vis_dept_id" />
<result property="disDeptId" column="dis_dept_id" /> <result property="disDeptId" column="dis_dept_id" />
<result property="projectName" column="project_name" /> <result property="projectName" column="project_name" />
<result property="projectCode" column="project_code" /> <result property="projectCode" column="project_code" />
<result property="simpleName" column="simple_name" /> <result property="simpleName" column="simple_name" />
<result property="projectType" column="project_type" /> <result property="projectType" column="project_type" />
<result property="projiectLevel" column="projiect_level" /> <result property="projectLevel" column="project_level" />
<result property="projectRegional" column="project_regional" /> <result property="projectRegional" column="project_regional" />
<result property="projectAddress" column="project_address" /> <result property="projectAddress" column="project_address" />
<result property="projectNature" column="project_nature" /> <result property="projectNature" column="project_nature" />
@ -47,30 +48,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProProjectInfoVo"> <sql id="selectProProjectInfoVo">
select id, dept_id, vis_dept_id, dis_dept_id, project_name, project_code, simple_name, project_type, projiect_level, project_regional, project_address, project_nature, licence_number, project_person, project_person_phone, longitude, latitude, project_time_limit, total_investment, floor_area, total_output_value, planned_completion_time, scheduled_start_time, actual_operating_time, actual_completion_time, contract_amount, paid_amount, on_account_amount, project_schedule, project_summarize, project_qr_code, project_status, project_sort, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info select pi.id, pi.dept_id, sd.dept_name, pi.vis_dept_id, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark from pro_project_info pi
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult"> <select id="selectProProjectInfoList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult">
<include refid="selectProProjectInfoVo"/> <include refid="selectProProjectInfoVo"/>
<where> <where>
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="deptId != null "> and pi.dept_id = #{deptId}</if>
<if test="visDeptId != null "> and vis_dept_id = #{visDeptId}</if> <if test="visDeptId != null "> and pi.vis_dept_id = #{visDeptId}</if>
<if test="disDeptId != null "> and dis_dept_id = #{disDeptId}</if> <if test="disDeptId != null "> and pi.dis_dept_id = #{disDeptId}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if> <if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode}</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="simpleName != null and simpleName != ''"> and simple_name like concat('%', #{simpleName}, '%')</if> <if test="projectCode != null and projectCode != ''"> and pi.project_code = #{projectCode}</if>
<if test="projectType != null and projectType != ''"> and project_type = #{projectType}</if> <if test="simpleName != null and simpleName != ''"> and pi.simple_name like concat('%', #{simpleName}, '%')</if>
<if test="projiectLevel != null and projiectLevel != ''"> and projiect_level = #{projiectLevel}</if> <if test="projectType != null and projectType != ''"> and pi.project_type = #{projectType}</if>
<if test="projectPerson != null and projectPerson != ''"> and project_person = #{projectPerson}</if> <if test="projectLevel != null and projectLevel != ''"> and pi.project_level = #{projectLevel}</if>
<if test="projectPersonPhone != null and projectPersonPhone != ''"> and project_person_phone = #{projectPersonPhone}</if> <if test="projectPerson != null and projectPerson != ''"> and pi.project_person = #{projectPerson}</if>
<if test="projectStatus != null and projectStatus != ''"> and project_status = #{projectStatus}</if> <if test="projectPersonPhone != null and projectPersonPhone != ''"> and pi.project_person_phone = #{projectPersonPhone}</if>
<if test="isDel != null "> and is_del = #{isDel}</if> <if test="projectStatus != null and projectStatus != ''"> and pi.project_status = #{projectStatus}</if>
<if test="isDel != null "> and pi.is_del = #{isDel}</if>
</where> </where>
order by id project_sort, id desc
</select> </select>
<select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult"> <select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult">
<include refid="selectProProjectInfoVo"/> <include refid="selectProProjectInfoVo"/>
where id = #{id} where pi.id = #{id}
</select> </select>
<insert id="insertProProjectInfo" parameterType="ProProjectInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProProjectInfo" parameterType="ProProjectInfo" useGeneratedKeys="true" keyProperty="id">
@ -83,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">project_code,</if> <if test="projectCode != null">project_code,</if>
<if test="simpleName != null">simple_name,</if> <if test="simpleName != null">simple_name,</if>
<if test="projectType != null">project_type,</if> <if test="projectType != null">project_type,</if>
<if test="projiectLevel != null">projiect_level,</if> <if test="projectLevel != null">project_level,</if>
<if test="projectRegional != null">project_regional,</if> <if test="projectRegional != null">project_regional,</if>
<if test="projectAddress != null">project_address,</if> <if test="projectAddress != null">project_address,</if>
<if test="projectNature != null">project_nature,</if> <if test="projectNature != null">project_nature,</if>
@ -123,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">#{projectCode},</if> <if test="projectCode != null">#{projectCode},</if>
<if test="simpleName != null">#{simpleName},</if> <if test="simpleName != null">#{simpleName},</if>
<if test="projectType != null">#{projectType},</if> <if test="projectType != null">#{projectType},</if>
<if test="projiectLevel != null">#{projiectLevel},</if> <if test="projectLevel != null">#{projectLevel},</if>
<if test="projectRegional != null">#{projectRegional},</if> <if test="projectRegional != null">#{projectRegional},</if>
<if test="projectAddress != null">#{projectAddress},</if> <if test="projectAddress != null">#{projectAddress},</if>
<if test="projectNature != null">#{projectNature},</if> <if test="projectNature != null">#{projectNature},</if>
@ -167,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">project_code = #{projectCode},</if> <if test="projectCode != null">project_code = #{projectCode},</if>
<if test="simpleName != null">simple_name = #{simpleName},</if> <if test="simpleName != null">simple_name = #{simpleName},</if>
<if test="projectType != null">project_type = #{projectType},</if> <if test="projectType != null">project_type = #{projectType},</if>
<if test="projiectLevel != null">projiect_level = #{projiectLevel},</if> <if test="projectLevel != null">project_level = #{projectLevel},</if>
<if test="projectRegional != null">project_regional = #{projectRegional},</if> <if test="projectRegional != null">project_regional = #{projectRegional},</if>
<if test="projectAddress != null">project_address = #{projectAddress},</if> <if test="projectAddress != null">project_address = #{projectAddress},</if>
<if test="projectNature != null">project_nature = #{projectNature},</if> <if test="projectNature != null">project_nature = #{projectNature},</if>

View File

@ -24,14 +24,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectProProjectInfoSettingVo"> <sql id="selectProProjectInfoSettingVo">
select ps.id, ps.project_id, pi.project_name, ps.org_name, ps.org_logo, ps.org_image, ps.org_video, ps.org_plane, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_setting ps select ps.id, ps.project_id, pi.project_name, ps.org_name, ps.org_logo, ps.org_image, ps.org_video, ps.org_plane, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_setting ps
left join pro_project_info pi on pi.id = ps.project_id left join pro_project_info pi on pi.id = ps.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoSettingList" parameterType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult"> <select id="selectProProjectInfoSettingList" parameterType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult">
<include refid="selectProProjectInfoSettingVo"/> <include refid="selectProProjectInfoSettingVo"/>
<where> <where>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and ps.project_id = #{projectId}</if> <if test="projectId != null "> and ps.project_id = #{projectId}</if>
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
<if test="isDel != null "> and ps.is_del = #{isDel}</if> <if test="isDel != null "> and ps.is_del = #{isDel}</if>
</where> </where>
</select> </select>

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdeptsGroup" id="ProProjectInfoSubdeptsGroupResult"> <resultMap type="ProProjectInfoSubdeptsGroup" id="ProProjectInfoSubdeptsGroupResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" /> <result property="subDeptId" column="sub_dept_id" />
<result property="subDeptType" column="sub_dept_type" /> <result property="subDeptType" column="sub_dept_type" />
<result property="subDeptName" column="sub_dept_name" /> <result property="subDeptName" column="sub_dept_name" />
@ -30,34 +31,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProProjectInfoSubdeptsGroupVo"> <sql id="selectProProjectInfoSubdeptsGroupVo">
select id, project_id, sub_dept_id, sub_dept_type, sub_dept_name, sub_dept_code, group_name, group_code, craft_type, craft_post, group_leader_name, group_leader_code, group_leader_phone, use_status, approve_status, qr_code, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts_group select psg.id, psg.project_id, pi.project_name, psg.sub_dept_id, psg.sub_dept_type, psg.sub_dept_name, psg.sub_dept_code, psg.group_name, psg.group_code, psg.craft_type, psg.craft_post, psg.group_leader_name, psg.group_leader_code, psg.group_leader_phone, psg.use_status, psg.approve_status, psg.qr_code, psg.is_del, psg.create_by, psg.create_time, psg.update_by, psg.update_time, psg.remark from pro_project_info_subdepts_group psg
left join pro_project_info pi on pi.id = psg.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoSubdeptsGroupList" parameterType="ProProjectInfoSubdeptsGroup" resultMap="ProProjectInfoSubdeptsGroupResult"> <select id="selectProProjectInfoSubdeptsGroupList" parameterType="ProProjectInfoSubdeptsGroup" resultMap="ProProjectInfoSubdeptsGroupResult">
<include refid="selectProProjectInfoSubdeptsGroupVo"/> <include refid="selectProProjectInfoSubdeptsGroupVo"/>
<where> <where>
<if test="projectId != null "> and project_id = #{projectId}</if> <if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if> <if test="projectId != null "> and psg.project_id = #{projectId}</if>
<if test="subDeptType != null and subDeptType != ''"> and sub_dept_type = #{subDeptType}</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if> <if test="subDeptId != null "> and psg.sub_dept_id = #{subDeptId}</if>
<if test="subDeptCode != null and subDeptCode != ''"> and sub_dept_code = #{subDeptCode}</if> <if test="subDeptType != null and subDeptType != ''"> and psg.sub_dept_type = #{subDeptType}</if>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if> <if test="subDeptName != null and subDeptName != ''"> and psg.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="groupCode != null and groupCode != ''"> and group_code = #{groupCode}</if> <if test="subDeptCode != null and subDeptCode != ''"> and psg.sub_dept_code = #{subDeptCode}</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if> <if test="groupName != null and groupName != ''"> and psg.group_name like concat('%', #{groupName}, '%')</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if> <if test="groupCode != null and groupCode != ''"> and psg.group_code = #{groupCode}</if>
<if test="groupLeaderName != null and groupLeaderName != ''"> and group_leader_name like concat('%', #{groupLeaderName}, '%')</if> <if test="craftType != null and craftType != ''"> and psg.craft_type = #{craftType}</if>
<if test="groupLeaderCode != null and groupLeaderCode != ''"> and group_leader_code = #{groupLeaderCode}</if> <if test="craftPost != null and craftPost != ''"> and psg.craft_post = #{craftPost}</if>
<if test="groupLeaderPhone != null and groupLeaderPhone != ''"> and group_leader_phone = #{groupLeaderPhone}</if> <if test="groupLeaderName != null and groupLeaderName != ''"> and psg.group_leader_name like concat('%', #{groupLeaderName}, '%')</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="groupLeaderCode != null and groupLeaderCode != ''"> and psg.group_leader_code = #{groupLeaderCode}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if> <if test="groupLeaderPhone != null and groupLeaderPhone != ''"> and psg.group_leader_phone = #{groupLeaderPhone}</if>
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if> <if test="useStatus != null and useStatus != ''"> and psg.use_status = #{useStatus}</if>
<if test="isDel != null "> and is_del = #{isDel}</if> <if test="approveStatus != null "> and psg.approve_status = #{approveStatus}</if>
<if test="isDel != null "> and psg.is_del = #{isDel}</if>
</where> </where>
</select> </select>
<select id="selectProProjectInfoSubdeptsGroupById" parameterType="Long" resultMap="ProProjectInfoSubdeptsGroupResult"> <select id="selectProProjectInfoSubdeptsGroupById" parameterType="Long" resultMap="ProProjectInfoSubdeptsGroupResult">
<include refid="selectProProjectInfoSubdeptsGroupVo"/> <include refid="selectProProjectInfoSubdeptsGroupVo"/>
where id = #{id} where psg.id = #{id}
</select> </select>
<insert id="insertProProjectInfoSubdeptsGroup" parameterType="ProProjectInfoSubdeptsGroup" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProProjectInfoSubdeptsGroup" parameterType="ProProjectInfoSubdeptsGroup" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,7 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdepts" id="ProProjectInfoSubdeptsResult"> <resultMap type="ProProjectInfoSubdepts" id="ProProjectInfoSubdeptsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" /> <result property="subDeptId" column="sub_dept_id" />
<result property="subDeptType" column="sub_dept_type" /> <result property="subDeptType" column="sub_dept_type" />
<result property="subDeptName" column="sub_dept_name" /> <result property="subDeptName" column="sub_dept_name" />
@ -28,32 +30,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProProjectInfoSubdeptsVo"> <sql id="selectProProjectInfoSubdeptsVo">
select id, dept_id, project_id, sub_dept_id, sub_dept_type, sub_dept_name, sub_dept_code, sub_dept_leader_id, sub_dept_leader_name, sub_dept_leader_code, sub_dept_leader_phone, use_status, approve_status, qr_code, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts select ps.id, dept_id, sd.dept_name, ps.project_id, pi.project_name, ps.sub_dept_id, ps.sub_dept_type, ps.sub_dept_name, ps.sub_dept_code, ps.sub_dept_leader_id, ps.sub_dept_leader_name, ps.sub_dept_leader_code, ps.sub_dept_leader_phone, ps.use_status, ps.approve_status, ps.qr_code, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_subdepts ps
left join pro_project_info pi on pi.id = ps.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoSubdeptsList" parameterType="ProProjectInfoSubdepts" resultMap="ProProjectInfoSubdeptsResult"> <select id="selectProProjectInfoSubdeptsList" parameterType="ProProjectInfoSubdepts" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/> <include refid="selectProProjectInfoSubdeptsVo"/>
<where> <where>
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="deptId != null "> and ps.dept_id = #{deptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if> <if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if> <if test="projectId != null "> and ps.project_id = #{projectId}</if>
<if test="subDeptType != null and subDeptType != ''"> and sub_dept_type = #{subDeptType}</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if> <if test="subDeptId != null "> and ps.sub_dept_id = #{subDeptId}</if>
<if test="subDeptCode != null and subDeptCode != ''"> and sub_dept_code = #{subDeptCode}</if> <if test="subDeptType != null and subDeptType != ''"> and ps.sub_dept_type = #{subDeptType}</if>
<if test="subDeptLeaderId != null "> and sub_dept_leader_id = #{subDeptLeaderId}</if> <if test="subDeptName != null and subDeptName != ''"> and ps.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptLeaderName != null and subDeptLeaderName != ''"> and sub_dept_leader_name like concat('%', #{subDeptLeaderName}, '%')</if> <if test="subDeptCode != null and subDeptCode != ''"> and ps.sub_dept_code = #{subDeptCode}</if>
<if test="subDeptLeaderCode != null and subDeptLeaderCode != ''"> and sub_dept_leader_code = #{subDeptLeaderCode}</if> <if test="subDeptLeaderId != null "> and ps.sub_dept_leader_id = #{subDeptLeaderId}</if>
<if test="subDeptLeaderPhone != null and subDeptLeaderPhone != ''"> and sub_dept_leader_phone = #{subDeptLeaderPhone}</if> <if test="subDeptLeaderName != null and subDeptLeaderName != ''"> and ps.sub_dept_leader_name like concat('%', #{subDeptLeaderName}, '%')</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="subDeptLeaderCode != null and subDeptLeaderCode != ''"> and ps.sub_dept_leader_code = #{subDeptLeaderCode}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if> <if test="subDeptLeaderPhone != null and subDeptLeaderPhone != ''"> and ps.sub_dept_leader_phone = #{subDeptLeaderPhone}</if>
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if> <if test="useStatus != null and useStatus != ''"> and ps.use_status = #{useStatus}</if>
<if test="isDel != null "> and is_del = #{isDel}</if> <if test="approveStatus != null "> and ps.approve_status = #{approveStatus}</if>
<if test="isDel != null "> and ps.is_del = #{isDel}</if>
</where> </where>
order by ps.id desc
</select> </select>
<select id="selectProProjectInfoSubdeptsById" parameterType="Long" resultMap="ProProjectInfoSubdeptsResult"> <select id="selectProProjectInfoSubdeptsById" parameterType="Long" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/> <include refid="selectProProjectInfoSubdeptsVo"/>
where id = #{id} where ps.id = #{id}
</select> </select>
<insert id="insertProProjectInfoSubdepts" parameterType="ProProjectInfoSubdepts" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProProjectInfoSubdepts" parameterType="ProProjectInfoSubdepts" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdeptsUsers" id="ProProjectInfoSubdeptsUsersResult"> <resultMap type="ProProjectInfoSubdeptsUsers" id="ProProjectInfoSubdeptsUsersResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" /> <result property="subDeptId" column="sub_dept_id" />
<result property="subDeptName" column="sub_dept_name" /> <result property="subDeptName" column="sub_dept_name" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
@ -31,35 +32,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProProjectInfoSubdeptsUsersVo"> <sql id="selectProProjectInfoSubdeptsUsersVo">
select id, project_id, sub_dept_id, sub_dept_name, user_id, user_name, craft_type, craft_post, edu_status, edu_file_path, edu_sign_path, edu_date, approve_status, use_status, sub_step, illness_status, sup_illness_status, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts_users select psu.id, psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_name, psu.user_id, psu.user_name, psu.craft_type, psu.craft_post, psu.edu_status, psu.edu_file_path, psu.edu_sign_path, psu.edu_date, psu.approve_status, psu.use_status, psu.sub_step, psu.illness_status, psu.sup_illness_status, psu.is_del, psu.create_by, psu.create_time, psu.update_by, psu.update_time, psu.remark from pro_project_info_subdepts_users psu
left join pro_project_info pi on pi.id = psu.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoSubdeptsUsersList" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult"> <select id="selectProProjectInfoSubdeptsUsersList" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/> <include refid="selectProProjectInfoSubdeptsUsersVo"/>
<where> <where>
<if test="projectId != null "> and project_id = #{projectId}</if> <if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if> <if test="projectId != null "> and psu.project_id = #{projectId}</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if> <if test="subDeptId != null "> and psu.sub_dept_id = #{subDeptId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="subDeptName != null and subDeptName != ''"> and psu.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if> <if test="userId != null "> and psu.user_id = #{userId}</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if> <if test="userName != null and userName != ''"> and psu.user_name like concat('%', #{userName}, '%')</if>
<if test="eduStatus != null and eduStatus != ''"> and edu_status = #{eduStatus}</if> <if test="craftType != null and craftType != ''"> and psu.craft_type = #{craftType}</if>
<if test="eduFilePath != null and eduFilePath != ''"> and edu_file_path = #{eduFilePath}</if> <if test="craftPost != null and craftPost != ''"> and psu.craft_post = #{craftPost}</if>
<if test="eduSignPath != null and eduSignPath != ''"> and edu_sign_path = #{eduSignPath}</if> <if test="eduStatus != null and eduStatus != ''"> and psu.edu_status = #{eduStatus}</if>
<if test="eduDate != null "> and edu_date = #{eduDate}</if> <if test="approveStatus != null "> and psu.approve_status = #{approveStatus}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if> <if test="useStatus != null and useStatus != ''"> and psu.use_status = #{useStatus}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="subStep != null "> and psu.sub_step = #{subStep}</if>
<if test="subStep != null "> and sub_step = #{subStep}</if> <if test="illnessStatus != null "> and psu.illness_status = #{illnessStatus}</if>
<if test="illnessStatus != null "> and illness_status = #{illnessStatus}</if> <if test="supIllnessStatus != null "> and psu.sup_illness_status = #{supIllnessStatus}</if>
<if test="supIllnessStatus != null "> and sup_illness_status = #{supIllnessStatus}</if> <if test="isDel != null "> and psu.is_del = #{isDel}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where> </where>
order by psu.id desc
</select> </select>
<select id="selectProProjectInfoSubdeptsUsersById" parameterType="Long" resultMap="ProProjectInfoSubdeptsUsersResult"> <select id="selectProProjectInfoSubdeptsUsersById" parameterType="Long" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/> <include refid="selectProProjectInfoSubdeptsUsersVo"/>
where id = #{id} where psu.id = #{id}
</select> </select>
<insert id="insertProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoUsers" id="ProProjectInfoUsersResult"> <resultMap type="ProProjectInfoUsers" id="ProProjectInfoUsersResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
@ -22,26 +23,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProProjectInfoUsersVo"> <sql id="selectProProjectInfoUsersVo">
select id, dept_id, project_id, user_id, user_name, user_code, user_phone, use_status, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_users select pu.id, pu.dept_id, sd.dept_name, pu.project_id, pi.project_name, pu.user_id, pu.user_name, pu.user_code, pu.user_phone, pu.use_status, pu.is_del, pu.create_by, pu.create_time, pu.update_by, pu.update_time, pu.remark from pro_project_info_users pu
left join pro_project_info pi on pi.id = pu.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql> </sql>
<select id="selectProProjectInfoUsersList" parameterType="ProProjectInfoUsers" resultMap="ProProjectInfoUsersResult"> <select id="selectProProjectInfoUsersList" parameterType="ProProjectInfoUsers" resultMap="ProProjectInfoUsersResult">
<include refid="selectProProjectInfoUsersVo"/> <include refid="selectProProjectInfoUsersVo"/>
<where> <where>
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if> <if test="deptId != null "> and pu.dept_id = #{deptId}</if>
<if test="userId != null "> and user_id = #{userId}</if> <if test="projectId != null "> and pu.project_id = #{projectId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="userCode != null and userCode != ''"> and user_code = #{userCode}</if> <if test="userId != null "> and pu.user_id = #{userId}</if>
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if> <if test="userName != null and userName != ''"> and pu.user_name like concat('%', #{userName}, '%')</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="userCode != null and userCode != ''"> and pu.user_code = #{userCode}</if>
<if test="isDel != null "> and is_del = #{isDel}</if> <if test="userPhone != null and userPhone != ''"> and pu.user_phone = #{userPhone}</if>
<if test="useStatus != null and useStatus != ''"> and pu.use_status = #{useStatus}</if>
<if test="isDel != null "> and pu.is_del = #{isDel}</if>
</where> </where>
order by pu.id desc
</select> </select>
<select id="selectProProjectInfoUsersById" parameterType="Long" resultMap="ProProjectInfoUsersResult"> <select id="selectProProjectInfoUsersById" parameterType="Long" resultMap="ProProjectInfoUsersResult">
<include refid="selectProProjectInfoUsersVo"/> <include refid="selectProProjectInfoUsersVo"/>
where id = #{id} where pu.id = #{id}
</select> </select>
<insert id="insertProProjectInfoUsers" parameterType="ProProjectInfoUsers" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProProjectInfoUsers" parameterType="ProProjectInfoUsers" useGeneratedKeys="true" keyProperty="id">

View File

@ -78,11 +78,19 @@
<groupId>com.yanzhu</groupId> <groupId>com.yanzhu</groupId>
<artifactId>yanzhu-common-swagger</artifactId> <artifactId>yanzhu-common-swagger</artifactId>
</dependency> </dependency>
<!-- YanZhu Common Datascope -->
<dependency> <dependency>
<groupId>com.yanzhu</groupId> <groupId>com.yanzhu</groupId>
<artifactId>yanzhu-common-datascope</artifactId> <artifactId>yanzhu-common-datascope</artifactId>
</dependency> </dependency>
<!-- Belerweb Pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -245,10 +245,26 @@ public class SysRoleController extends BaseController
return ajax; return ajax;
} }
/**
*
*/
@ApiOperation(value = "指定流程办理组列表") @ApiOperation(value = "指定流程办理组列表")
@GetMapping("/roleList") @GetMapping("/roleList")
public AjaxResult roleList(SysRole role) { public AjaxResult roleList(SysRole role) {
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/**
* ID
* @param deptId
* @return
*/
@GetMapping("/deptRole/{deptId}")
public AjaxResult list(@PathVariable("roleId") Long deptId)
{
List<SysRole> list = roleService.findDeptRoleList(deptId);
return success(list);
}
} }

View File

@ -224,7 +224,7 @@ public class SysUserController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) public AjaxResult add(@Validated @RequestBody SysUser user)
{ {
if (!userService.checkUserNameUnique(user)) if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user))
{ {
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
@ -251,7 +251,7 @@ public class SysUserController extends BaseController
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user)) if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user))
{ {
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
@ -320,7 +320,7 @@ public class SysUserController extends BaseController
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId); SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.findDeptRoleList(user.getDeptId());
ajax.put("user", user); ajax.put("user", user);
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax; return ajax;

View File

@ -1,7 +1,7 @@
package com.yanzhu.system.mapper; package com.yanzhu.system.mapper;
import java.util.List; import java.util.List;
import com.yanzhu.system.domain.SysRoleDept; import com.yanzhu.system.api.domain.SysRoleDept;
/** /**
* *

View File

@ -104,4 +104,12 @@ public interface SysRoleMapper
* @return * @return
*/ */
public int deleteRoleByIds(Long[] roleIds); public int deleteRoleByIds(Long[] roleIds);
/**
* ID
*
* @param deptId ID
* @return
*/
public List<SysRole> findDeptRoleList(Long deptId);
} }

View File

@ -170,4 +170,12 @@ public interface ISysRoleService
* @return * @return
*/ */
public int insertAuthUsers(Long roleId, Long[] userIds); public int insertAuthUsers(Long roleId, Long[] userIds);
/**
* ID
*
* @param deptId ID
* @return
*/
public List<SysRole> findDeptRoleList(Long deptId);
} }

View File

@ -7,7 +7,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import com.yanzhu.common.datascope.annotation.DataScope; import com.yanzhu.common.datascope.annotation.DataScope;
import com.yanzhu.system.domain.SysRoleDept; import com.yanzhu.system.api.domain.SysRoleDept;
import com.yanzhu.system.domain.SysRoleMenu; import com.yanzhu.system.domain.SysRoleMenu;
import com.yanzhu.system.domain.SysUserRole; import com.yanzhu.system.domain.SysUserRole;
import com.yanzhu.system.mapper.SysRoleDeptMapper; import com.yanzhu.system.mapper.SysRoleDeptMapper;
@ -234,7 +234,12 @@ public class SysRoleServiceImpl implements ISysRoleService
{ {
// 新增角色信息 // 新增角色信息
roleMapper.insertRole(role); roleMapper.insertRole(role);
return insertRoleMenu(role); int res = insertRoleMenu(role);
// 角色和部门信息
if(res>0 && role.getDeptId()!=null){
insertRoleDept(role);
}
return res;
} }
/** /**
@ -248,10 +253,15 @@ public class SysRoleServiceImpl implements ISysRoleService
public int updateRole(SysRole role) public int updateRole(SysRole role)
{ {
// 修改角色信息 // 修改角色信息
roleMapper.updateRole(role); int res = roleMapper.updateRole(role);
// 删除角色与菜单关联 // 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
return insertRoleMenu(role); insertRoleMenu(role);
// 角色和部门信息
if(res>0 && role.getDeptId()!=null){
insertRoleDept(role);
}
return res;
} }
/** /**
@ -281,7 +291,7 @@ public class SysRoleServiceImpl implements ISysRoleService
// 删除角色与部门关联 // 删除角色与部门关联
roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
// 新增角色和部门信息(数据权限) // 新增角色和部门信息(数据权限)
return insertRoleDept(role); return insertRoleDeptList(role);
} }
/** /**
@ -314,6 +324,27 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param role * @param role
*/ */
public int insertRoleDept(SysRole role) public int insertRoleDept(SysRole role)
{
int rows = 1;
// 新增角色与部门(数据权限)管理
List<SysRoleDept> list = new ArrayList<SysRoleDept>();
SysRoleDept rd = new SysRoleDept();
rd.setRoleId(role.getRoleId());
rd.setDeptId(role.getDeptId());
list.add(rd);
if (list.size() > 0)
{
rows = roleDeptMapper.batchRoleDept(list);
}
return rows;
}
/**
* ()
*
* @param role
*/
public int insertRoleDeptList(SysRole role)
{ {
int rows = 1; int rows = 1;
// 新增角色与部门(数据权限)管理 // 新增角色与部门(数据权限)管理
@ -422,4 +453,15 @@ public class SysRoleServiceImpl implements ISysRoleService
} }
return userRoleMapper.batchUserRole(list); return userRoleMapper.batchUserRole(list);
} }
/**
* ID
*
* @param deptId ID
* @return
*/
@Override
public List<SysRole> findDeptRoleList(Long deptId){
return roleMapper.findDeptRoleList(deptId);
}
} }

View File

@ -12,6 +12,8 @@ import com.yanzhu.system.domain.SysUserRole;
import com.yanzhu.system.mapper.SysRoleMapper; import com.yanzhu.system.mapper.SysRoleMapper;
import com.yanzhu.system.mapper.SysUserMapper; import com.yanzhu.system.mapper.SysUserMapper;
import com.yanzhu.system.mapper.SysUserPostMapper; import com.yanzhu.system.mapper.SysUserPostMapper;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -270,6 +272,7 @@ public class SysUserServiceImpl implements ISysUserService
public int insertUser(SysUser user) public int insertUser(SysUser user)
{ {
// 新增用户信息 // 新增用户信息
user.setUserName(userNameAndCout(user.getNickName()));
int rows = userMapper.insertUser(user); int rows = userMapper.insertUser(user);
// 新增用户岗位关联 // 新增用户岗位关联
insertUserPost(user); insertUserPost(user);
@ -309,9 +312,43 @@ public class SysUserServiceImpl implements ISysUserService
userPostMapper.deleteUserPostByUserId(userId); userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理 // 新增用户与岗位管理
insertUserPost(user); insertUserPost(user);
//这里不允许修改密码
user.setPassword(null);
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }
/**
*
* @param name
* @return
*/
private String userNameAndCout(String name){
// 设置不带声调的输出选项
HanyuPinyinOutputFormat format = new net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat();
format.setToneType(net.sourceforge.pinyin4j.format.HanyuPinyinToneType.WITHOUT_TONE);
StringBuilder output = new StringBuilder();
for (char c : name.toCharArray()) {
try {
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
if (pinyinArray != null && pinyinArray.length > 0) {
output.append(pinyinArray[0]);
} else {
output.append(c);
}
} catch (Exception e) {
output.append(c);
}
}
SysUser query = new SysUser();
query.setUserName(output.toString());
List<SysUser> cout = userMapper.selectUserList(query);
if(StringUtils.isNotEmpty(cout)){
output.append(String.format("%02d", cout.size()));
}
return output.toString();
}
/** /**
* *
* *

View File

@ -9,6 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="deptShortName" column="dept_short_name" />
<result property="deptCode" column="dept_code" />
<result property="deptType" column="dept_type" />
<result property="deptInfos" column="dept_infos" />
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num" />
<result property="leader" column="leader" /> <result property="leader" column="leader" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
@ -23,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDeptVo"> <sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.dept_infos, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d from sys_dept d
</sql> </sql>
@ -31,16 +35,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where d.del_flag = '0' where d.del_flag = '0'
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND dept_id = #{deptId} AND d.dept_id = #{deptId}
</if> </if>
<if test="parentId != null and parentId != 0"> <if test="parentId != null and parentId != 0">
AND parent_id = #{parentId} AND d.parent_id = #{parentId}
</if> </if>
<if test="deptName != null and deptName != ''"> <if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%') AND d.dept_name like concat('%', #{deptName}, '%')
</if>
<if test="deptShortName != null and deptShortName != ''">
AND d.dept_short_name like concat('%', #{deptShortName}, '%')
</if>
<if test="deptType != null and deptType != ''">
AND d.dept_type = #{deptType}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND d.status = #{status}
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
@ -89,8 +99,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into sys_dept( insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="deptName != null and deptName != ''">dept_name,</if> <if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if> <if test="deptShortName != null and deptName != ''">dept_short_name,</if>
<if test="deptCode != null and deptName != ''">dept_code,</if>
<if test="deptType != null and deptName != ''">dept_type,</if>
<if test="deptInfos != null and deptName != ''">dept_infos,</if>
<if test="orderNum != null">order_num,</if> <if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if> <if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if> <if test="phone != null and phone != ''">phone,</if>
@ -101,8 +115,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if> <if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if> <if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> <if test="deptShortName != null and deptShortName != ''">#{deptShortName},</if>
<if test="deptCode != null and deptCode != ''">#{deptCode},</if>
<if test="deptType != null and deptType != ''">#{deptType},</if>
<if test="deptInfos != null and deptInfos != ''">#{deptInfos},</if>
<if test="orderNum != null">#{orderNum},</if> <if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if> <if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if> <if test="phone != null and phone != ''">#{phone},</if>
@ -117,8 +135,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept update sys_dept
<set> <set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="deptShortName != null and deptShortName != ''">dept_short_name = #{deptShortName},</if>
<if test="deptCode != null and deptCode != ''">dept_code = #{deptCode},</if>
<if test="deptType != null and deptType != ''">dept_type = #{deptType},</if>
<if test="deptInfos != null and deptInfos != ''">dept_infos = #{deptInfos},</if>
<if test="orderNum != null">order_num = #{orderNum},</if> <if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if> <if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>

View File

@ -20,22 +20,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<resultMap id="SysRoleSysRoleDeptResult" type="SysRole" extends="SysRoleResult">
<collection property="roleDeptList" notNullColumn="sub_role_id" javaType="java.util.List" resultMap="SysRoleDeptResult" />
</resultMap>
<resultMap id="SysRoleDeptResult" type="SysRoleDept">
<result property="roleId" column="sub_role_id" />
<result property="deptId" column="sub_dept_id" />
<result property="deptName" column="sub_dept_name" />
</resultMap>
<sql id="selectRoleVo"> <sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark r.status, r.del_flag, r.create_time, r.remark, rd.role_id as sub_role_id, rd.dept_id as sub_dept_id, rdd.dept_name as sub_dept_name
from sys_role r from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_role_dept rd on rd.role_id = r.role_id
left join sys_dept rdd on rd.dept_id = rdd.dept_id
</sql> </sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.del_flag = '0' where r.del_flag = '0'
<if test="roleId != null and roleId != 0"> <if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId} AND r.role_id = #{roleId}
</if> </if>
<if test="deptId != null and deptId != 0">
AND rdd.dept_id = #{deptId}
</if>
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%') AND r.role_name like concat('%', #{roleName}, '%')
</if> </if>
@ -55,13 +70,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope} ${params.dataScope}
order by r.role_sort order by r.role_sort
</select> </select>
<select id="findDeptRoleList" parameterType="Long" resultMap="SysRoleResult">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_role_dept rd on rd.role_id = r.role_id
where r.del_flag = '0' and rd.dept_id = ${deptId}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId} WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select> </select>
<select id="selectRoleAll" resultMap="SysRoleResult"> <select id="selectRoleAll" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
</select> </select>
@ -73,22 +97,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> <select id="selectRoleById" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_id = #{roleId} where r.role_id = #{roleId}
</select> </select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> <select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName} WHERE r.del_flag = '0' and u.user_name = #{userName}
</select> </select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1 where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select> </select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1 where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select> </select>

View File

@ -9,6 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
<result property="nickName" column="nick_name" /> <result property="nickName" column="nick_name" />
<result property="userType" column="user_type" />
<result property="cardType" column="card_type" />
<result property="cardCode" column="card_code" />
<result property="userInfos" column="user_infos" />
<result property="email" column="email" /> <result property="email" column="email" />
<result property="phonenumber" column="phonenumber" /> <result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" /> <result property="sex" column="sex" />
@ -30,8 +34,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="deptResult" type="SysDept"> <resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" /> <id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" /> <result property="deptShortName" column="dept_short_name" />
<result property="deptCode" column="dept_code" />
<result property="deptType" column="dept_type" />
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num" />
<result property="leader" column="leader" /> <result property="leader" column="leader" />
<result property="status" column="dept_status" /> <result property="status" column="dept_status" />
@ -47,8 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, select u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.user_infos, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
@ -57,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.user_type, u.card_type, u.card_code, u.user_infos, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
@ -66,6 +73,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%') AND u.user_name like concat('%', #{userName}, '%')
</if> </if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name = #{nickName}
</if>
<if test="cardCode != null and cardCode != ''">
AND u.card_code like concat('%', #{cardCode}, '%')
</if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND u.status = #{status} AND u.status = #{status}
</if> </if>
@ -86,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@ -103,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@ -152,6 +168,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if> <if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if> <if test="nickName != null and nickName != ''">nick_name,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="cardType != null and cardType != ''">card_type,</if>
<if test="cardCode != null and cardCode != ''">card_code,</if>
<if test="userInfos != null and userInfos != ''">user_infos,</if>
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if> <if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if> <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@ -166,6 +186,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != ''">#{deptId},</if> <if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if> <if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if> <if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="cardType != null and cardType != ''">#{cardType},</if>
<if test="cardCode != null and cardCode != ''">#{cardCode},</if>
<if test="userInfos != null and userInfos != ''">#{userInfos},</if>
<if test="email != null and email != ''">#{email},</if> <if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if> <if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if> <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
@ -184,6 +208,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if> <if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="userType != null and userType != ''">user_type = #{userType},</if>
<if test="cardType != null and cardType != ''">card_type = #{cardType},</if>
<if test="cardCode != null and cardCode != ''">card_code = #{cardCode},</if>
<if test="userInfos != null and userInfos != ''">user_infos = #{userInfos},</if>
<if test="email != null ">email = #{email},</if> <if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if> <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if> <if test="sex != null and sex != ''">sex = #{sex},</if>

View File

@ -117,3 +117,11 @@ export function deptTreeSelect(roleId) {
method: 'get' method: 'get'
}) })
} }
//根据部门选择角色
export function getDeptRole(deptId) {
return request({
url: '/system/role/deptRole/' + deptId,
method: 'get'
})
}

View File

@ -133,3 +133,11 @@ export function deptTreeSelect() {
method: 'get' method: 'get'
}) })
} }
// 查询部门下拉树结构
export function deptFirTreeSelect() {
return request({
url: '/system/user/deptTree',
method: 'get'
})
}

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属单位" prop="deptId"> <el-form-item label="所属单位" prop="deptId" v-hasPermi="['manage:dept:project']">
<el-input <el-input
v-model="queryParams.deptId" v-model="queryParams.deptId"
placeholder="请输入所属单位" placeholder="请输入所属单位"
@ -49,9 +49,9 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="项目等级" prop="projiectLevel"> <el-form-item label="项目等级" prop="projectLevel">
<el-input <el-input
v-model="queryParams.projiectLevel" v-model="queryParams.projectLevel"
placeholder="请输入项目等级" placeholder="请输入项目等级"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
@ -141,7 +141,7 @@
<el-table-column label="项目编号" align="center" prop="projectCode" /> <el-table-column label="项目编号" align="center" prop="projectCode" />
<el-table-column label="项目简称" align="center" prop="simpleName" /> <el-table-column label="项目简称" align="center" prop="simpleName" />
<el-table-column label="项目类型" align="center" prop="projectType" /> <el-table-column label="项目类型" align="center" prop="projectType" />
<el-table-column label="项目等级" align="center" prop="projiectLevel" /> <el-table-column label="项目等级" align="center" prop="projectLevel" />
<el-table-column label="项目区县" align="center" prop="projectRegional" /> <el-table-column label="项目区县" align="center" prop="projectRegional" />
<el-table-column label="项目地址" align="center" prop="projectAddress" /> <el-table-column label="项目地址" align="center" prop="projectAddress" />
<el-table-column label="项目建设属性" align="center" prop="projectNature" /> <el-table-column label="项目建设属性" align="center" prop="projectNature" />
@ -213,8 +213,8 @@
<el-form-item label="项目简称" prop="simpleName"> <el-form-item label="项目简称" prop="simpleName">
<el-input v-model="form.simpleName" placeholder="请输入项目简称" /> <el-input v-model="form.simpleName" placeholder="请输入项目简称" />
</el-form-item> </el-form-item>
<el-form-item label="项目等级" prop="projiectLevel"> <el-form-item label="项目等级" prop="projectLevel">
<el-input v-model="form.projiectLevel" placeholder="请输入项目等级" /> <el-input v-model="form.projectLevel" placeholder="请输入项目等级" />
</el-form-item> </el-form-item>
<el-form-item label="项目区县" prop="projectRegional"> <el-form-item label="项目区县" prop="projectRegional">
<el-input v-model="form.projectRegional" placeholder="请输入项目区县" /> <el-input v-model="form.projectRegional" placeholder="请输入项目区县" />
@ -337,7 +337,7 @@ const data = reactive({
projectCode: null, projectCode: null,
simpleName: null, simpleName: null,
projectType: null, projectType: null,
projiectLevel: null, projectLevel: null,
projectPerson: null, projectPerson: null,
projectPersonPhone: null, projectPersonPhone: null,
projectStatus: null, projectStatus: null,
@ -376,7 +376,7 @@ function reset() {
projectCode: null, projectCode: null,
simpleName: null, simpleName: null,
projectType: null, projectType: null,
projiectLevel: null, projectLevel: null,
projectRegional: null, projectRegional: null,
projectAddress: null, projectAddress: null,
projectNature: null, projectNature: null,

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目主键" prop="projectId"> <el-form-item label="项目名称" prop="projectName">
<el-input <el-input
v-model="queryParams.projectId" v-model="queryParams.projectName"
placeholder="请输入项目主键" placeholder="请输入项目名称"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
@ -27,24 +27,6 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="参建单位编号" prop="deptCode">
<el-input
v-model="queryParams.deptCode"
placeholder="请输入参建单位编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择删除标识" clearable>
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button> <el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button> <el-button icon="Refresh" @click="resetQuery"></el-button>
@ -95,8 +77,7 @@
<el-table v-loading="loading" :data="proProjectInfoDeptsList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="proProjectInfoDeptsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" /> <el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="参建单位类型" align="center" prop="deptType"> <el-table-column label="参建单位类型" align="center" prop="deptType">
<template #default="scope"> <template #default="scope">
<dict-tag :options="pro_dept_type" :value="scope.row.deptType"/> <dict-tag :options="pro_dept_type" :value="scope.row.deptType"/>
@ -104,7 +85,7 @@
</el-table-column> </el-table-column>
<el-table-column label="参建单位名称" align="center" prop="deptName" /> <el-table-column label="参建单位名称" align="center" prop="deptName" />
<el-table-column label="参建单位编号" align="center" prop="deptCode" /> <el-table-column label="参建单位编号" align="center" prop="deptCode" />
<el-table-column label="删除标识" align="center" prop="isDel"> <el-table-column label="数据状态" align="center" prop="isDel">
<template #default="scope"> <template #default="scope">
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/> <dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
</template> </template>
@ -126,10 +107,10 @@
/> />
<!-- 添加或修改参建单位对话框 --> <!-- 添加或修改参建单位对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body> <el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="proProjectInfoDeptsRef" :model="form" :rules="rules" label-width="80px"> <el-form ref="proProjectInfoDeptsRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="项目主键" prop="projectId"> <el-form-item label="项目主键" prop="projectName">
<el-input v-model="form.projectId" placeholder="请输入项目主键" /> <el-input v-model="form.projectName" :disabled="form.id" placeholder="请输入项目主键" />
</el-form-item> </el-form-item>
<el-form-item label="参建单位类型" prop="deptType"> <el-form-item label="参建单位类型" prop="deptType">
<el-select v-model="form.deptType" placeholder="请选择参建单位类型"> <el-select v-model="form.deptType" placeholder="请选择参建单位类型">
@ -147,19 +128,6 @@
<el-form-item label="参建单位编号" prop="deptCode"> <el-form-item label="参建单位编号" prop="deptCode">
<el-input v-model="form.deptCode" placeholder="请输入参建单位编号" /> <el-input v-model="form.deptCode" placeholder="请输入参建单位编号" />
</el-form-item> </el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择删除标识">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -192,11 +160,9 @@ const data = reactive({
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
projectId: null, projectName: null,
deptType: null, deptType: null,
deptName: null, deptName: null,
deptCode: null,
isDel: null,
}, },
rules: { rules: {
} }

View File

@ -56,13 +56,19 @@
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
> >
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column> <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column> <el-table-column prop="deptShortName" label="部门简称"></el-table-column>
<el-table-column prop="sys_dept_type" label="部门类型">
<template #default="scope">
<dict-tag :options="sys_dept_type" :value="scope.row.deptType" />
</template>
</el-table-column>
<el-table-column prop="orderNum" label="排序" width="100"></el-table-column>
<el-table-column prop="status" label="状态" width="100"> <el-table-column prop="status" label="状态" width="100">
<template #default="scope"> <template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" /> <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
@ -77,8 +83,8 @@
</el-table> </el-table>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改部门对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body> <el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="deptRef" :model="form" :rules="rules" label-width="80px"> <el-form ref="deptRef" :model="form" :rules="rules" label-width="88px">
<el-row> <el-row>
<el-col :span="24" v-if="form.parentId !== 0"> <el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId"> <el-form-item label="上级部门" prop="parentId">
@ -89,35 +95,43 @@
value-key="deptId" value-key="deptId"
placeholder="选择上级部门" placeholder="选择上级部门"
check-strictly check-strictly
style="width:100%"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="部门名称" prop="deptName"> <el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入部门名称" /> <el-input v-model="form.deptName" placeholder="请输入部门名称" maxlength="64"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门类型" prop="deptType">
<el-select v-model="form.deptType" placeholder="请选择部门类型" style="width: 100%">
<el-option
v-for="dict in sys_dept_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="显示排序" prop="orderNum"> <el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> <el-input-number v-model="form.orderNum" controls-position="right" :min="0" style="width:100%"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="负责人" prop="leader"> <el-form-item label="部门简称" prop="deptShortName">
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" /> <el-input v-model="form.deptShortName" placeholder="请输入部门简称" maxlength="32"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="联系电话" prop="phone"> <el-form-item label="部门编号" prop="deptCode">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" /> <el-input v-model="form.deptCode" placeholder="请输入部门编号" maxlength="32"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门状态"> <el-form-item label="部门状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
@ -128,6 +142,16 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="部门主管" prop="leader">
<el-input v-model="form.leader" placeholder="请输入部门主管" maxlength="20" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<template #footer> <template #footer>
@ -144,7 +168,7 @@
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const { sys_dept_type, sys_normal_disable } = proxy.useDict("sys_dept_type", "sys_normal_disable");
const deptList = ref([]); const deptList = ref([]);
const open = ref(false); const open = ref(false);
@ -164,6 +188,9 @@ const data = reactive({
rules: { rules: {
parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }], parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }],
deptName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }], deptName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }],
deptType: [{ required: true, message: "部门类型不能为空", trigger: "change" }],
deptShortName: [{ required: false, message: "部门简称不能为空", trigger: "blur" }],
deptCode: [{ required: false, message: "部门编号不能为空", trigger: "blur" }],
orderNum: [{ required: true, message: "显示排序不能为空", trigger: "blur" }], orderNum: [{ required: true, message: "显示排序不能为空", trigger: "blur" }],
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }], email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }] phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
@ -191,6 +218,9 @@ function reset() {
deptId: undefined, deptId: undefined,
parentId: undefined, parentId: undefined,
deptName: undefined, deptName: undefined,
deptShortName: undefined,
deptType: undefined,
deptCode: undefined,
orderNum: 0, orderNum: 0,
leader: undefined, leader: undefined,
phone: undefined, phone: undefined,

View File

@ -1,144 +1,187 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px"> <el-row :gutter="20">
<el-form-item label="角色名称" prop="roleName"> <!--部门数据-->
<el-input <el-col :span="4" :xs="24">
v-model="queryParams.roleName" <div class="head-container">
placeholder="请输入角色名称" <el-input
clearable v-model="deptName"
style="width: 240px" placeholder="请输入部门名称"
@keyup.enter="handleQuery" clearable
/> prefix-icon="Search"
</el-form-item> style="margin-bottom: 20px"
<el-form-item label="权限字符" prop="roleKey">
<el-input
v-model="queryParams.roleKey"
placeholder="请输入权限字符"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="角色状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/> />
</el-select> </div>
</el-form-item> <div class="head-container">
<el-form-item label="创建时间" style="width: 308px"> <el-tree
<el-date-picker :data="deptFirOptions"
v-model="dateRange" :props="{ label: 'label', children: 'children' }"
value-format="YYYY-MM-DD" :expand-on-click-node="false"
type="daterange" :filter-node-method="filterNode"
range-separator="-" ref="deptTreeRef"
start-placeholder="开始日期" node-key="id"
end-placeholder="结束日期" highlight-current
></el-date-picker> accordion
</el-form-item> :default-expanded-keys="defaultEK"
<el-form-item> @node-click="handleNodeClick"
<el-button type="primary" icon="Search" @click="handleQuery"></el-button> />
<el-button icon="Refresh" @click="resetQuery"></el-button> </div>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!--角色数据-->
<el-button <el-col :span="20" :xs="24">
type="success" <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
plain <el-form-item label="角色名称" prop="roleName">
icon="Edit" <el-input
:disabled="single" v-model="queryParams.roleName"
@click="handleUpdate" placeholder="请输入角色名称"
v-hasPermi="['system:role:edit']" clearable
>修改</el-button> style="width: 240px"
</el-col> @keyup.enter="handleQuery"
<el-col :span="1.5"> />
<el-button </el-form-item>
type="danger" <el-form-item label="权限字符" prop="roleKey">
plain <el-input
icon="Delete" v-model="queryParams.roleKey"
:disabled="multiple" placeholder="请输入权限字符"
@click="handleDelete" clearable
v-hasPermi="['system:role:remove']" style="width: 240px"
>删除</el-button> @keyup.enter="handleQuery"
</el-col> />
<el-col :span="1.5"> </el-form-item>
<el-button <el-form-item label="状态" prop="status">
type="warning" <el-select
plain v-model="queryParams.status"
icon="Download" placeholder="角色状态"
@click="handleExport" clearable
v-hasPermi="['system:role:export']" style="width: 240px"
>导出</el-button> >
</el-col> <el-option
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> v-for="dict in sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" style="width: 308px">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:role:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:role:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="所属部门">
<template #default="scope">
<div class="flex gap-2">
<el-tag
v-for="item in scope.row.roleDeptList"
effect="dark"
>
{{ item.deptName }}
</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" />
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
</el-tooltip>
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row> </el-row>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" />
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
</el-tooltip>
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改角色配置对话框 --> <!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body> <el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="roleRef" :model="form" :rules="rules" label-width="100px"> <el-form ref="roleRef" :model="form" :rules="rules" label-width="100px">
@ -214,6 +257,17 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属部门" prop="deptId">
<el-tree-select
v-model="form.deptId"
:data="deptFirOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择所属部门"
check-strictly
style="width:100%"
/>
</el-form-item>
<el-form-item label="数据权限" v-show="form.dataScope == 2"> <el-form-item label="数据权限" v-show="form.dataScope == 2">
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">/</el-checkbox> <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">/</el-checkbox>
<el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">/</el-checkbox> <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">/</el-checkbox>
@ -242,6 +296,7 @@
</template> </template>
<script setup name="Role"> <script setup name="Role">
import { deptFirTreeSelect } from "@/api/system/user";
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role"; import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu"; import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
@ -268,6 +323,10 @@ const deptOptions = ref([]);
const openDataScope = ref(false); const openDataScope = ref(false);
const menuRef = ref(null); const menuRef = ref(null);
const deptRef = ref(null); const deptRef = ref(null);
const deptName = ref("");
const deptFirOptions = ref(undefined);
const defaultEK = ref([100]);
/** 数据范围选项*/ /** 数据范围选项*/
const dataScopeOptions = ref([ const dataScopeOptions = ref([
@ -288,6 +347,7 @@ const data = reactive({
status: undefined status: undefined
}, },
rules: { rules: {
deptId: [{ required: true, message: "所属部门不能为空", trigger: "change" }],
roleName: [{ required: true, message: "角色名称不能为空", trigger: "blur" }], roleName: [{ required: true, message: "角色名称不能为空", trigger: "blur" }],
roleKey: [{ required: true, message: "权限字符不能为空", trigger: "blur" }], roleKey: [{ required: true, message: "权限字符不能为空", trigger: "blur" }],
roleSort: [{ required: true, message: "角色顺序不能为空", trigger: "blur" }] roleSort: [{ required: true, message: "角色顺序不能为空", trigger: "blur" }]
@ -296,6 +356,15 @@ const data = reactive({
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data);
/** 通过条件过滤节点 */
const filterNode = (value, data) => {
if (!value) return true;
return data.label.indexOf(value) !== -1;
};
/** 根据名称筛选部门树 */
watch(deptName, val => {
proxy.$refs["deptTreeRef"].filter(val);
});
/** 查询角色列表 */ /** 查询角色列表 */
function getList() { function getList() {
loading.value = true; loading.value = true;
@ -305,6 +374,11 @@ function getList() {
loading.value = false; loading.value = false;
}); });
} }
/** 节点单击事件 */
function handleNodeClick(data) {
queryParams.value.deptId = data.id;
handleQuery();
};
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
@ -440,8 +514,14 @@ function getRoleMenuTreeselect(roleId) {
return response; return response;
}); });
} }
/** 查询部门下拉树结构 */
function getDeptTree() {
deptFirTreeSelect().then(response => {
deptFirOptions.value = response.data;
});
};
/** 根据角色ID查询部门树结构 */ /** 根据角色ID查询部门树结构 */
function getDeptTree(roleId) { function getDeptRoleTree(roleId) {
return deptTreeSelect(roleId).then(response => { return deptTreeSelect(roleId).then(response => {
deptOptions.value = response.depts; deptOptions.value = response.depts;
return response; return response;
@ -522,7 +602,7 @@ function dataScopeSelectChange(value) {
/** 分配数据权限操作 */ /** 分配数据权限操作 */
function handleDataScope(row) { function handleDataScope(row) {
reset(); reset();
const deptTreeSelect = getDeptTree(row.roleId); const deptTreeSelect = getDeptRoleTree(row.roleId);
getRole(row.roleId).then(response => { getRole(row.roleId).then(response => {
form.value = response.data; form.value = response.data;
openDataScope.value = true; openDataScope.value = true;
@ -556,4 +636,5 @@ function cancelDataScope() {
} }
getList(); getList();
getDeptTree();
</script> </script>

View File

@ -23,7 +23,7 @@
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span> <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column> <el-table-column type="selection" :reserve-selection="true" width="55" />
<el-table-column label="角色编号" align="center" prop="roleId" /> <el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" /> <el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" /> <el-table-column label="权限字符" align="center" prop="roleKey" />

View File

@ -21,7 +21,8 @@
ref="deptTreeRef" ref="deptTreeRef"
node-key="id" node-key="id"
highlight-current highlight-current
default-expand-all accordion
:default-expanded-keys="defaultEK"
@node-click="handleNodeClick" @node-click="handleNodeClick"
/> />
</div> </div>
@ -29,9 +30,9 @@
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="nickName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.nickName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
style="width: 240px" style="width: 240px"
@ -47,7 +48,7 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="用户状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="用户状态" placeholder="用户状态"
@ -132,11 +133,16 @@
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> <el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> <el-table-column label="所属部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> <el-table-column label="用户类型" align="center" v-if="columns[4].visible" >
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> <template #default="scope">
<dict-tag :options="sys_user_type" :value="scope.row.userType" />
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[5].visible" width="120" />
<el-table-column label="用户状态" align="center" key="status" v-if="columns[6].visible">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@ -146,7 +152,7 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160"> <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[7].visible" width="160">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
@ -179,55 +185,53 @@
</el-row> </el-row>
<!-- 添加或修改用户配置对话框 --> <!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body> <el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form :model="form" :rules="rules" ref="userRef" label-width="80px"> <el-form :model="form" :rules="rules" ref="userRef" label-width="88px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="所属部门" prop="deptId">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<el-tree-select <el-tree-select
v-model="form.deptId" v-model="form.deptId"
:data="deptOptions" :data="deptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }" :props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id" value-key="id"
placeholder="请选择属部门" placeholder="请选择属部门"
check-strictly check-strictly
style="width:100%"
@change="handleChangeDept"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> <el-col :span="12">
<el-row> <el-form-item label="用户名称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户类型" prop="userType">
<el-select v-model="form.userType" placeholder="请选择用户类型" style="width: 100%">
<el-option
v-for="dict in sys_user_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" /> <el-input v-model="form.phonenumber" :disabled="form.userId" placeholder="请输入手机号码" maxlength="11" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="邮箱" prop="email"> <el-form-item label="登录密码" prop="password">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> <el-input v-model="form.password" placeholder="请输入登录密码" type="password" maxlength="20" :disabled="form.userId" :show-password="!form.userId" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="用户性别"> <el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择"> <el-select v-model="form.sex" placeholder="请选择用户性别" style="width:100%">
<el-option <el-option
v-for="dict in sys_user_sex" v-for="dict in sys_user_sex"
:key="dict.value" :key="dict.value"
@ -238,7 +242,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态"> <el-form-item label="用户状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
v-for="dict in sys_normal_disable" v-for="dict in sys_normal_disable"
@ -248,11 +252,9 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="岗位"> <el-form-item label="用户岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择"> <el-select v-model="form.postIds" multiple placeholder="请选择用户岗位" style="width:100%">
<el-option <el-option
v-for="item in postOptions" v-for="item in postOptions"
:key="item.postId" :key="item.postId"
@ -264,8 +266,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="角色"> <el-form-item label="用户角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择"> <el-select v-model="form.roleIds" multiple placeholder="请选择用户角色" style="width:100%">
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
:key="item.roleId" :key="item.roleId"
@ -277,13 +279,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -331,11 +326,12 @@
<script setup name="User"> <script setup name="User">
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { getDeptRole } from "@/api/system/role";
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user"; import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
const router = useRouter(); const router = useRouter();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex"); const { sys_user_type, sys_normal_disable, sys_user_sex } = proxy.useDict("sys_user_type", "sys_normal_disable", "sys_user_sex");
const userList = ref([]); const userList = ref([]);
const open = ref(false); const open = ref(false);
@ -352,6 +348,9 @@ const deptOptions = ref(undefined);
const initPassword = ref(undefined); const initPassword = ref(undefined);
const postOptions = ref([]); const postOptions = ref([]);
const roleOptions = ref([]); const roleOptions = ref([]);
const defaultEK = ref([100]);
/*** 用户导入参数 */ /*** 用户导入参数 */
const upload = reactive({ const upload = reactive({
// //
@ -369,13 +368,14 @@ const upload = reactive({
}); });
// //
const columns = ref([ const columns = ref([
{ key: 0, label: `用户编号`, visible: true }, { key: 0, label: `用户编号`, visible: false },
{ key: 1, label: `用户名称`, visible: true }, { key: 1, label: `登录账号`, visible: true },
{ key: 2, label: `用户昵称`, visible: true }, { key: 2, label: `用户名称`, visible: true },
{ key: 3, label: `部门`, visible: true }, { key: 3, label: `所属部门`, visible: true },
{ key: 4, label: `手机号码`, visible: true }, { key: 4, label: `用户类型`, visible: true },
{ key: 5, label: `状态`, visible: true }, { key: 5, label: `手机号码`, visible: true },
{ key: 6, label: `创建时间`, visible: true } { key: 6, label: `用户状态`, visible: true },
{ key: 7, label: `创建时间`, visible: true }
]); ]);
const data = reactive({ const data = reactive({
@ -384,16 +384,18 @@ const data = reactive({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userName: undefined, userName: undefined,
nickName: undefined,
phonenumber: undefined, phonenumber: undefined,
status: undefined, status: undefined,
deptId: undefined deptId: undefined
}, },
rules: { rules: {
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }], userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }], password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }],
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }], phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
} }
}); });
@ -560,7 +562,6 @@ function handleAdd() {
reset(); reset();
getUser().then(response => { getUser().then(response => {
postOptions.value = response.posts; postOptions.value = response.posts;
roleOptions.value = response.roles;
open.value = true; open.value = true;
title.value = "添加用户"; title.value = "添加用户";
form.value.password = initPassword.value; form.value.password = initPassword.value;
@ -573,14 +574,23 @@ function handleUpdate(row) {
getUser(userId).then(response => { getUser(userId).then(response => {
form.value = response.data; form.value = response.data;
postOptions.value = response.posts; postOptions.value = response.posts;
roleOptions.value = response.roles;
form.value.postIds = response.postIds; form.value.postIds = response.postIds;
form.value.roleIds = response.roleIds; form.value.roleIds = response.roleIds;
open.value = true; open.value = true;
title.value = "修改用户"; title.value = "修改用户";
form.password = ""; form.password = "";
}); });
handleChangeDept(row.deptId);
}; };
/** 根据单位选择角色 */
function handleChangeDept(value){
form.roleIds = null;
getDeptRole(value).then(response => {
roleOptions.value = response.data;
});
}
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
proxy.$refs["userRef"].validate(valid => { proxy.$refs["userRef"].validate(valid => {