use of com.ikoori.vip.common.persistence.model.StoreEmployee 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.StoreEmployee in project vip by guangdada.
the class StoreEmployeeServiceImpl method deleteEmployee.
@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void deleteEmployee(long storeEmployeeId) {
// TODO Auto-generated method stub
StoreEmployee storeEmployee = storeEmployeeService.selectById(storeEmployeeId);
userMapper.deleteById(storeEmployee.getUserId().intValue());
storeEmployeeService.deleteById(storeEmployeeId);
}
use of com.ikoori.vip.common.persistence.model.StoreEmployee in project vip by guangdada.
the class StoreEmployeeServiceImpl method saveEmployee.
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveEmployee(StoreEmployee storeEmployee, String password, String sex) {
if (storeEmployee.getId() == null) {
User user = new User();
user.setSalt(ShiroKit.getRandomSalt(5));
user.setPassword(ShiroKit.md5(password, user.getSalt()));
user.setName(storeEmployee.getName());
user.setAccount(storeEmployee.getMobile());
user.setRoleid(storeEmployee.getRoleId() + "");
user.setPhone(storeEmployee.getMobile());
user.setSex(Integer.valueOf(sex));
user.setStatus(ManagerStatus.OK.getCode());
user.setCreatetime(new Date());
userMapper.insert(user);
long userId = user.getId().longValue();
storeEmployee.setUserId(userId);
this.insert(storeEmployee);
} else {
StoreEmployee dbEmp = storeEmployeeMapper.selectById(storeEmployee.getId());
User dbUser = userMapper.selectById(dbEmp.getUserId());
dbUser.setName(storeEmployee.getName());
dbUser.setRoleid(storeEmployee.getRoleId() + "");
dbUser.setPhone(storeEmployee.getMobile());
dbUser.setSex(Integer.valueOf(sex));
userMapper.updateById(dbUser);
storeEmployeeMapper.updateById(storeEmployee);
}
}
Aggregations