| | |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "账号密码登录",notes = "账号密码登录") |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | @PostMapping("/login") |
| | | public AjaxResult<Map<String,Object>> login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | map.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return AjaxResult.error("请关联角色!"); |
| | |
| | | |
| | | List<SysMenu> menus = roleService.roleInfoFromUserId(loginUser.getUserId()); |
| | | |
| | | ajax.put("menus",menus); |
| | | ajax.put("roleName",roles.get(0).getRoleName()); |
| | | ajax.put("userInfo",loginUser); |
| | | return ajax; |
| | | map.put("menus",menus); |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("userInfo",loginUser); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:好莱坞管理系统_接口文档") |
| | | .title("标题:绵阳收银管理系统_接口文档") |
| | | // 描述 |
| | | .description("好莱坞接口文档") |
| | | .description("绵阳收银接口文档") |
| | | // 作者信息 |
| | | .contact(new Contact(ruoyiConfig.getName(), null, null)) |
| | | // 版本 |
| | |
| | | |
| | | @ApiModelProperty(value = "店铺样式") |
| | | @TableField("shopStyle") |
| | | private String shopStyle; |
| | | private Integer shopStyle; |
| | | |
| | | @ApiModelProperty(value = "系统名称") |
| | | @TableField("systemName") |
| | |
| | | @TableField("account") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Long userId; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "账号状态 0=正常,1=停用") |
| | | private String accountStatus; |
| | | |
| | | } |
| | |
| | | @Override |
| | | public void insertLogininfor(SysLogininfor logininfor) |
| | | { |
| | | logininforMapper.insertLogininfor(logininfor); |
| | | // logininforMapper.insertLogininfor(logininfor); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public void updateAccount(TShopDTO dto) { |
| | | SysUser sysUser = this.selectUserByUserName(dto.getAccount()); |
| | | // SysUser sysUser = this.selectUserByUserName(dto.getAccount()); |
| | | SysUser sysUser = this.selectUserById(dto.getUserId()); |
| | | if(Objects.isNull(sysUser)){ |
| | | throw new ServiceException("未查询到该账号"); |
| | | } |
| | |
| | | }else { |
| | | sysUser.setRoleType(3); |
| | | } |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | if(Objects.nonNull(dto.getPassword())){ |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | } |
| | | sysUser.setStatus(dto.getAccountStatus()); |
| | | this.updateUser(sysUser); |
| | | } |
| | | |
| | |
| | | </resultMap> |
| | | |
| | | <insert id="insertLogininfor" parameterType="SysLogininfor"> |
| | | insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) |
| | | values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) |
| | | insert into sys_logininfor (user_name, status, ipaddr, os, msg, login_time) |
| | | values (#{userName}, #{status}, #{ipaddr}, #{os}, #{msg}, sysdate()) |
| | | </insert> |
| | | |
| | | <select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult"> |
| | |
| | | <select id="selectRoleByUserId" resultType="com.ruoyi.common.core.domain.entity.SysRole"> |
| | | select distinct r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS roleSort, r.data_scope AS dataScope, |
| | | r.menu_check_strictly AS menuCheckStrictly, r.dept_check_strictly AS deptCheckStrictly,r.status AS status, |
| | | r.del_flag AS delFlag, r.create_time AS createTime,r.create_by AS createBy,r.postType AS postType,r.removeDays AS removeDays |
| | | r.del_flag AS delFlag, r.create_time AS createTime,r.create_by AS createBy |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | where ur.user_id = #{userId} |
| | |
| | | <select id="selectUserById" parameterType="Long" resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | | select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS nickName, u.email AS email, u.avatar AS avatar, |
| | | u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp, |
| | | u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark,u.ifBlack AS ifBlack, u.districtId AS districtId, |
| | | ur.role_id AS roleId,sr.role_name AS roleName,u.deptName as deptName |
| | | u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark, |
| | | ur.role_id AS roleId,sr.role_name AS roleName |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role sr on ur.role_id = sr.role_id |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="ifBlack != null">ifBlack,</if> |
| | | <if test="districtId != null">districtId,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="ifBlack != null">#{ifBlack},</if> |
| | | <if test="districtId != null">#{districtId},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <result column="disabled" property="disabled" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="userId" property="userId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, shopType, shopName,shopHead, shopStyle, systemName, systemLogo, businessLicense,status,account, createTime, updateTime, disabled, createBy, updateBy |
| | | id, shopType, shopName,shopHead, shopStyle, systemName, systemLogo, businessLicense,status,account, createTime, updateTime, disabled, createBy, updateBy,userId |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TShopVO"> |
| | | select id, shopType, shopName,shopHead, shopStyle, systemName, systemLogo, businessLicense, |
| | | status,account, createTime, updateTime, disabled, createBy, updateBy |
| | | status,account, createTime, updateTime, disabled, createBy, updateBy,userId |
| | | from t_shop ts |
| | | <where> |
| | | <if test="query.shopType != null"> |