use of tk.mybatis.mapper.entity.Example in project paascloud-master by paascloud.
the class UacDictCommonController method checkDictCode.
/**
* 检测菜单编码是否已存在
*
* @param mdcDictCheckCodeDto the mdc dict check code dto
*
* @return the wrapper
*/
@PostMapping(value = "/checkDictCode")
@ApiOperation(httpMethod = "POST", value = "检测数据字典编码是否已存在")
public Wrapper<Boolean> checkDictCode(@ApiParam(name = "uacMenuCheckCodeDto", value = "id与url") @RequestBody MdcDictCheckCodeDto mdcDictCheckCodeDto) {
logger.info("检测数据字典编码是否已存在 mdcDictCheckCodeDto={}", mdcDictCheckCodeDto);
Long id = mdcDictCheckCodeDto.getDictId();
String dictCode = mdcDictCheckCodeDto.getDictCode();
Example example = new Example(MdcDict.class);
Example.Criteria criteria = example.createCriteria();
if (id != null) {
criteria.andNotEqualTo("id", id);
}
criteria.andEqualTo("dictCode", dictCode);
int result = mdcDictService.selectCountByExample(example);
return WrapMapper.ok(result < 1);
}
use of tk.mybatis.mapper.entity.Example in project paascloud-master by paascloud.
the class UacDictCommonController method checkDictName.
/**
* 检测数据字典名称是否已存在.
*
* @param mdcDictCheckNameDto the mdc dict check name dto
*
* @return the wrapper
*/
@PostMapping(value = "/checkDictName")
@ApiOperation(httpMethod = "POST", value = "检测数据字典名称是否已存在")
public Wrapper<Boolean> checkDictName(@ApiParam(name = "uacMenuCheckCodeDto", value = "id与url") @RequestBody MdcDictCheckNameDto mdcDictCheckNameDto) {
logger.info("检测数据字典名称是否已存在 mdcDictCheckNameDto={}", mdcDictCheckNameDto);
Long id = mdcDictCheckNameDto.getDictId();
String dictName = mdcDictCheckNameDto.getDictName();
Example example = new Example(MdcDict.class);
Example.Criteria criteria = example.createCriteria();
if (id != null) {
criteria.andNotEqualTo("id", id);
}
criteria.andEqualTo("dictName", dictName);
int result = mdcDictService.selectCountByExample(example);
return WrapMapper.ok(result < 1);
}
use of tk.mybatis.mapper.entity.Example in project paascloud-master by paascloud.
the class UacUserCommonController method checkUserPhone.
/**
* 校验用户电话号码唯一性.
*
* @param checkUserPhoneDto the check user phone dto
*
* @return the wrapper
*/
@PostMapping(value = "/checkUserPhone")
@ApiOperation(httpMethod = "POST", value = "校验用户电话号码唯一性")
public Wrapper<Boolean> checkUserPhone(@ApiParam(name = "checkUserPhoneDto", value = "校验用户电话号码唯一性Dto") @RequestBody CheckUserPhoneDto checkUserPhoneDto) {
logger.info(" 校验用户电话号码唯一性 checkUserPhoneDto={}", checkUserPhoneDto);
Long id = checkUserPhoneDto.getUserId();
String mobileNo = checkUserPhoneDto.getMobileNo();
Example example = new Example(UacUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("mobileNo", mobileNo);
if (id != null) {
criteria.andNotEqualTo("id", id);
}
int result = uacUserService.selectCountByExample(example);
return WrapMapper.ok(result < 1);
}
use of tk.mybatis.mapper.entity.Example in project paascloud-master by paascloud.
the class UacRoleCommonController method checkUacRoleCode.
/**
* 验证角色编码是否存在.
*
* @param checkRoleCodeDto the check role code dto
*
* @return the wrapper
*/
@PostMapping(value = "/checkRoleCode")
@ApiOperation(httpMethod = "POST", value = "验证角色编码是否存在")
public Wrapper<Boolean> checkUacRoleCode(@ApiParam(name = "roleCode", value = "角色编码") @RequestBody CheckRoleCodeDto checkRoleCodeDto) {
logger.info("校验角色编码唯一性 checkRoleCodeDto={}", checkRoleCodeDto);
Long id = checkRoleCodeDto.getRoleId();
String roleCode = checkRoleCodeDto.getRoleCode();
Example example = new Example(UacRole.class);
Example.Criteria criteria = example.createCriteria();
if (id != null) {
criteria.andNotEqualTo("id", id);
}
criteria.andEqualTo("roleCode", roleCode);
int result = uacRoleService.selectCountByExample(example);
return WrapMapper.ok(result < 1);
}
use of tk.mybatis.mapper.entity.Example in project paascloud-master by paascloud.
the class EmailServiceImpl method sendEmailCode.
@Override
public void sendEmailCode(SendEmailMessage sendEmailMessage, String loginName) {
Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), "用户名不能为空");
String email = sendEmailMessage.getEmail();
Preconditions.checkArgument(StringUtils.isNotEmpty(email), ErrorCodeEnum.UAC10011018.msg());
Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), ErrorCodeEnum.UAC10011007.msg());
// 解密
email = decryptEmail(loginName, email);
Example example = new Example(UacUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("email", email);
criteria.andNotEqualTo("loginName", loginName);
int result = uacUserService.selectCountByExample(example);
if (result > 0) {
throw new UacBizException(ErrorCodeEnum.UAC10011019);
}
String emailCode = RandomUtil.createNumberCode(6);
String key = RedisKeyUtil.getSendEmailCodeKey(loginName, email);
// 在redis中绑定验证码
redisService.setKey(key, emailCode, 7 * 24, TimeUnit.HOURS);
// 先写死 类型多了再抽方法
Map<String, Object> param = Maps.newHashMap();
param.put("loginName", loginName);
param.put("email", email);
param.put("emailCode", emailCode);
param.put("dateTime", DateUtil.formatDateTime(new Date()));
Set<String> to = Sets.newHashSet();
to.add(email);
MqMessageData mqMessageData = emailProducer.sendEmailMq(to, UacEmailTemplateEnum.RESET_USER_EMAIL, AliyunMqTopicConstants.MqTagEnum.RESET_LOGIN_PWD, param);
userManager.sendEmailCode(mqMessageData);
}
Aggregations