Commit 6589acc0 by giaogiao

商家: 账户管理,添加职位, 添加是否为管理员

parent f9fc40fc
......@@ -3,7 +3,6 @@ package com.jumeirah.api.merchant.controller;
import com.jumeirah.api.merchant.entity.param.MerchantUserAddParam;
import com.jumeirah.api.merchant.entity.param.MerchantUserUpdateParam;
import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.service.MerchantUserService;
import com.jumeirah.common.vo.MerchantUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
......@@ -45,8 +44,6 @@ public class MerchantUserManagerController extends BaseController {
@Autowired
private MerchantUserService merchantUserService;
@Autowired
private MerchantService merchantService;
/**
* 添加商家用户
......@@ -55,8 +52,11 @@ public class MerchantUserManagerController extends BaseController {
@OperationLog(name = "添加商家用户", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家用户", response = ApiResult.class)
public ApiResult<Boolean> addMerchantUser(@Validated(Add.class) @RequestBody MerchantUserAddParam merchantUserAddParam) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
MerchantUser merchantUser = new MerchantUser();
BeanUtils.copyProperties(merchantUserAddParam, merchantUser);
merchantUser.setMcId(jwtToken.getMcId());
boolean flag = merchantUserService.saveMerchantUser(merchantUser);
return ApiResult.result(flag);
}
......@@ -68,8 +68,11 @@ public class MerchantUserManagerController extends BaseController {
@OperationLog(name = "修改商家用户", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家用户", response = ApiResult.class)
public ApiResult<Boolean> updateMerchantUser(@Validated(Update.class) @RequestBody MerchantUserUpdateParam merchantUserUpdateParam) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
MerchantUser merchantUser = new MerchantUser();
BeanUtils.copyProperties(merchantUserUpdateParam, merchantUser);
boolean flag = merchantUserService.updateMerchantUser(merchantUser);
return ApiResult.result(flag);
}
......@@ -81,6 +84,7 @@ public class MerchantUserManagerController extends BaseController {
@OperationLog(name = "删除商家用户", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家用户", response = ApiResult.class)
public ApiResult<Boolean> deleteMerchantUser(@PathVariable("id") Long id) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
boolean flag = merchantUserService.deleteMerchantUser(id);
return ApiResult.result(flag);
}
......
package com.jumeirah.api.merchant.controller;
import com.jumeirah.common.entity.MerchantUserPermission;
import com.jumeirah.common.param.MerchantUserPermissionPageParam;
import com.jumeirah.common.param.MerchantUserPermissionQueryVo;
import com.jumeirah.common.service.MerchantUserPermissionService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -38,41 +30,9 @@ public class MerchantUserPermissionController extends BaseController {
@Autowired
private MerchantUserPermissionService merchantUserPermissionService;
/**
* 添加商家用户权限关系
*/
@PostMapping("/add")
@OperationLog(name = "添加商家用户权限关系", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家用户权限关系")
public ApiResult<Boolean> addMerchantUserPermission(@Validated(Add.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
boolean flag = merchantUserPermissionService.saveMerchantUserPermission(merchantUserPermission);
return ApiResult.result(flag);
}
/**
* 修改商家用户权限关系
*/
@PostMapping("/update")
@OperationLog(name = "修改商家用户权限关系", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家用户权限关系")
public ApiResult<Boolean> updateMerchantUserPermission(@Validated(Update.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
boolean flag = merchantUserPermissionService.updateMerchantUserPermission(merchantUserPermission);
return ApiResult.result(flag);
}
/**
* 删除商家用户权限关系
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除商家用户权限关系", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家用户权限关系")
public ApiResult<Boolean> deleteMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
boolean flag = merchantUserPermissionService.deleteMerchantUserPermission(id);
return ApiResult.result(flag);
}
/**
* 获取商家用户权限关系详情
*查询商家用户权限详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "商家用户权限关系详情", type = OperationLogType.INFO)
......@@ -82,16 +42,60 @@ public class MerchantUserPermissionController extends BaseController {
return ApiResult.ok(merchantUserPermissionQueryVo);
}
/**
* 商家用户权限关系分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "商家用户权限关系分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家用户权限关系分页列表")
public ApiResult<Paging<MerchantUserPermissionQueryVo>> getMerchantUserPermissionPageList(@Validated @RequestBody MerchantUserPermissionPageParam merchantUserPermissionPageParam) throws Exception {
Paging<MerchantUserPermissionQueryVo> paging = merchantUserPermissionService.getMerchantUserPermissionPageList(merchantUserPermissionPageParam);
return ApiResult.ok(paging);
}
// /**
// * 添加商家用户权限关系
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家用户权限关系", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家用户权限关系")
// public ApiResult<Boolean> addMerchantUserPermission(@Validated(Add.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
// boolean flag = merchantUserPermissionService.saveMerchantUserPermission(merchantUserPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家用户权限关系
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家用户权限关系", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家用户权限关系")
// public ApiResult<Boolean> updateMerchantUserPermission(@Validated(Update.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
// boolean flag = merchantUserPermissionService.updateMerchantUserPermission(merchantUserPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家用户权限关系
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家用户权限关系", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家用户权限关系")
// public ApiResult<Boolean> deleteMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantUserPermissionService.deleteMerchantUserPermission(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家用户权限关系详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家用户权限关系详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家用户权限关系详情")
// public ApiResult<MerchantUserPermissionQueryVo> getMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
// MerchantUserPermissionQueryVo merchantUserPermissionQueryVo = merchantUserPermissionService.getMerchantUserPermissionById(id);
// return ApiResult.ok(merchantUserPermissionQueryVo);
// }
//
// /**
// * 商家用户权限关系分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家用户权限关系分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家用户权限关系分页列表")
// public ApiResult<Paging<MerchantUserPermissionQueryVo>> getMerchantUserPermissionPageList(@Validated @RequestBody MerchantUserPermissionPageParam merchantUserPermissionPageParam) throws Exception {
// Paging<MerchantUserPermissionQueryVo> paging = merchantUserPermissionService.getMerchantUserPermissionPageList(merchantUserPermissionPageParam);
// return ApiResult.ok(paging);
// }
}
......@@ -31,6 +31,6 @@ public class MerchantUserAddParam extends BaseEntity {
private String password;
@ApiModelProperty("职位")
private String remark;
private String position;
}
......@@ -22,18 +22,14 @@ import javax.validation.constraints.NotBlank;
public class MerchantUserUpdateParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("昵称")
private String nickname;
@NotBlank(message = "密码不能为空")
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("职位")
private String position;
}
......@@ -66,8 +66,8 @@ public class MerchantUser extends BaseEntity {
@ApiModelProperty("头像")
private String head;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("职位")
private String position;
@ApiModelProperty("状态,0:禁用,1:启用,2:锁定")
private Integer state;
......
......@@ -187,6 +187,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
LoginMerUserTokenVo loginSysUserTokenVo = new LoginMerUserTokenVo();
loginSysUserTokenVo.setToken(token);
loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo);
loginSysUserTokenVo.setIsAdmin(merchantUser.getIsAdmin());
return ApiResult.ok(loginSysUserTokenVo);
}
......
......@@ -37,6 +37,9 @@ public class LoginMerUserTokenVo implements LoginToken {
@ApiModelProperty("token")
private String token;
@ApiModelProperty("是否为管理员,0:普通,1:超级管理员")
private Integer isAdmin;
/**
* 登录用户对象
*/
......
......@@ -27,53 +27,16 @@ public class MerchantUserQueryVo implements Serializable {
@ApiModelProperty("用户名")
private String username;
//
// @ApiModelProperty("密码")
// private String password;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("职位")
private String position;
@ApiModelProperty("航空公司名称")
private String airlineName;
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("盐值")
private String salt;
@ApiModelProperty("手机号码")
private String phone;
@ApiModelProperty("手机区号")
private String phoneArea;
@ApiModelProperty("性别,0:女,1:男,默认1")
private Integer gender;
@ApiModelProperty("头像")
private String head;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("状态,0:禁用,1:启用,2:锁定")
private Integer state;
@ApiModelProperty("部门id")
private Long departmentId;
@ApiModelProperty("角色id")
private Long roleId;
@ApiModelProperty("逻辑删除,0:未删除,1:已删除")
private Integer deleted;
@ApiModelProperty("版本")
private Integer version;
@ApiModelProperty("是否为管理员,0:普通,1:超级管理员")
private Integer isAdmin;
@ApiModelProperty("创建时间")
private Timestamp createTime;
@ApiModelProperty("修改时间")
private Timestamp updateTime;
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,mc_id,is_admin, username, nickname, password, salt, phone, phone_area, gender, head, remark, state, department_id, role_id, deleted, version, create_time, update_time
id,mc_id,is_admin, username, nickname, password, salt, phone, phone_area, gender, head, position, state, department_id, role_id, deleted, version, create_time, update_time
</sql>
<select id="getMerchantUserById" resultType="com.jumeirah.common.vo.MerchantUserQueryVo">
......@@ -24,9 +24,10 @@
resultType="com.jumeirah.common.vo.MerchantUserQueryVo">
select
id,mc_id,is_admin, username, nickname, phone, phone_area, gender, head, remark, state, role_id, deleted, version, create_time, update_time
id,mc_id,is_admin, username, nickname, phone, phone_area, gender, head, position, state, role_id, create_time, update_time
from merchant_user
where where mc_id = #{id}
where mc_id = #{id}
and deleted=0
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment