公共下拉选

This commit is contained in:
cwchen 2024-02-23 10:02:14 +08:00
parent fd423365dc
commit e90aa05c43
8 changed files with 84 additions and 1 deletions

View File

@ -3,6 +3,8 @@ package com.securitycontrol.entity.system.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @authorcwchen
* @date2024-02-20-15:49
@ -36,6 +38,27 @@ public class UserVo {
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "登录权限")
private String loginType;
@ApiModelProperty(value = "账号类型")
private Integer userType;
@ApiModelProperty(value = "角色ID")
private Integer roleId;
@ApiModelProperty(value = "角色名称")
private String roleName;
@ApiModelProperty(value = "是否超管")
private Integer isAdmin;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "账号状态")
private Integer accountStatus;
@ApiModelProperty(value = "状态")
private int delFlag;

View File

@ -29,4 +29,10 @@ public class SelectController extends BaseController {
return service.getOrgTree();
}
@ApiOperation(value = "角色下拉选")
@PostMapping("getRoleLists")
public AjaxResult getRoleLists(){
return service.getRoleLists();
}
}

View File

@ -1,5 +1,6 @@
package com.securitycontrol.system.base.mapper;
import com.securitycontrol.entity.system.vo.SelectVo;
import com.securitycontrol.entity.system.vo.TreeNode;
import org.springframework.stereotype.Repository;
@ -16,10 +17,20 @@ public interface ISelectMapper {
/**
* 组织机构树
*
* @return List<TreeNode>
* @description 组织机构树
* @author cwchen
* @date 2024/2/22 9:51
*/
List<TreeNode> getOrgTree();
/**
* 角色下拉选
* @return List<SelectVo>
* @description 角色下拉选
* @author cwchen
* @date 2024/2/22 13:28
*/
List<SelectVo> getRoleLists();
}

View File

@ -12,10 +12,20 @@ public interface ISelectService {
/**
* 组织机构树
*
* @return AjaxResult
* @description 组织机构树
* @author cwchen
* @date 2024/2/22 9:44
*/
AjaxResult getOrgTree();
/**
* 角色下拉选
* @return AjaxResult
* @description 角色下拉选
* @author cwchen
* @date 2024/2/22 13:27
*/
AjaxResult getRoleLists();
}

View File

@ -2,6 +2,7 @@ package com.securitycontrol.system.base.service.impl;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.system.TreeBuild;
import com.securitycontrol.entity.system.vo.SelectVo;
import com.securitycontrol.entity.system.vo.TreeNode;
import com.securitycontrol.system.base.mapper.ISelectMapper;
import com.securitycontrol.system.base.service.ISelectService;
@ -43,4 +44,11 @@ public class ISelectServiceImpl implements ISelectService {
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getRoleLists() {
List<SelectVo> list = new ArrayList<>();
list = mapper.getRoleLists();
return AjaxResult.success(list);
}
}

View File

@ -1,7 +1,8 @@
package com.securitycontrol.system.base.service.impl;
import com.securitycontrol.common.core.exception.ServiceException;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.security.utils.SecurityUtils;
import com.securitycontrol.entity.system.dto.UserDto;
import com.securitycontrol.entity.system.vo.UserVo;
import com.securitycontrol.system.base.mapper.IUserMapper;
@ -43,6 +44,8 @@ public class UserServiceImpl implements IUserService {
vo.setType(2);
} else {
vo.setType(1);
vo.setPassword(SecurityUtils.encryptPassword(vo.getPassword()));
vo.setCreateTime(DateTimeHelper.getNowTime());
}
mapper.addOrUpdateUser(vo);
} catch (Exception e) {

View File

@ -10,4 +10,12 @@
FROM sys_dict
WHERE del_flag = '0'
</select>
<!--角色下拉选-->
<select id="getRoleLists" resultType="com.securitycontrol.entity.system.vo.SelectVo">
SELECT role_id AS id,
role_name AS name
FROM sys_role
WHERE del_flag = 0
ORDER BY role_sort
</select>
</mapper>

View File

@ -12,6 +12,13 @@
<if test="orgId != null and orgId!=''">org_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="orgName != null and orgName != ''">org_name,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="loginType != null and loginType != ''">login_type,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="isAdmin != null and isAdmin != ''">is_admin,</if>
<if test="roleId != null and roleId != ''">role_id,</if>
<if test="accountStatus != null and accountStatus != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
@ -20,6 +27,13 @@
<if test="orgId != null and orgId!=''">#{orgId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="orgName != null and orgName != ''">#{orgName},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="loginType != null and loginType != ''">#{loginType},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="isAdmin != null and isAdmin != ''">#{isAdmin},</if>
<if test="roleId != null and roleId != ''">#{roleId},</if>
<if test="accountStatus != null and accountStatus != ''">#{accountStatus},</if>
</trim>
</if>
<if test="type == 2">