use of com.ikoori.vip.common.persistence.model.User in project vip by guangdada.
the class UserMgrController method roleAssign.
/**
* 跳转到角色分配页面
*/
@Permission
@RequestMapping("/role_assign/{userId}")
public String roleAssign(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
User user = (User) Db.create(UserMapper.class).selectOneByCon("id", userId);
model.addAttribute("userId", userId);
model.addAttribute("userAccount", user.getAccount());
return PREFIX + "user_roleassign.html";
}
use of com.ikoori.vip.common.persistence.model.User in project vip by guangdada.
the class UserMgrController method add.
/**
* 添加管理员
*/
@RequestMapping("/add")
@BussinessLog(value = "添加管理员", key = "account", dict = Dict.UserDict)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Tip add(@Valid UserDto user, BindingResult result) {
if (result.hasErrors()) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
// 判断账号是否重复
User theUser = managerDao.getByAccount(user.getAccount());
if (theUser != null) {
throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
}
// 完善账号信息
user.setSalt(ShiroKit.getRandomSalt(5));
user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
user.setStatus(ManagerStatus.OK.getCode());
user.setCreatetime(new Date());
this.userMapper.insert(UserFactory.createUser(user));
return SUCCESS_TIP;
}
use of com.ikoori.vip.common.persistence.model.User in project vip by guangdada.
the class UserMgrController method userEdit.
/**
* 跳转到编辑管理员页面
*/
@Permission
@RequestMapping("/user_edit/{userId}")
public String userEdit(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userMapper.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_edit.html";
}
use of com.ikoori.vip.common.persistence.model.User in project vip by guangdada.
the class StoreEmployeeController method storeEmployeeUpdate.
/**
* 跳转到修改员工管理
*/
@Permission
@RequestMapping("/storeEmployee_update/{storeEmployeeId}")
public String storeEmployeeUpdate(@PathVariable Long storeEmployeeId, Model model) {
StoreEmployee storeEmployee = storeEmployeeService.selectById(storeEmployeeId);
// 当前登录账号
Long createUserId = Long.valueOf(ShiroKit.getUser().getId());
Merchant merchant = merchantService.getMerchantUserId(createUserId);
Role role = roleService.selectById(storeEmployee.getRoleId());
User user = userMapper.selectById(storeEmployee.getUserId());
Map<String, Object> condition = new HashMap<String, Object>();
condition.put("merchantId", merchant.getId());
List<Store> stores = storeService.selectByCondition(condition);
// 查询店铺
model.addAttribute("stores", stores);
model.addAttribute("roles", RoleType.values());
model.addAttribute(user);
model.addAttribute(role);
model.addAttribute(storeEmployee);
model.addAttribute(merchant);
return PREFIX + "storeEmployee_edit.html";
}
use of com.ikoori.vip.common.persistence.model.User in project vip by guangdada.
the class StoreEmployeeController method add.
/**
* 新增员工管理
*/
@RequestMapping(value = "/add")
@Permission
@ResponseBody
public Object add(StoreEmployee storeEmployee, String password, String sex) {
// 当前登录账号
Long createUserId = Long.valueOf(ShiroKit.getUser().getId());
Merchant merchant = merchantService.getMerchantUserId(createUserId);
// 添加用户, 判断账号是否重复
User theUser = managerDao.getByAccount(storeEmployee.getMobile());
if (theUser != null) {
throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
}
storeEmployee.setMerchantId(merchant.getId());
storeEmployee.setCreateUserId(createUserId);
storeEmployeeService.saveEmployee(storeEmployee, password, sex);
return super.SUCCESS_TIP;
}
Aggregations