use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project yshopmall by guchengwuyue.
the class VisitsServiceImpl method count.
@Override
public void count(HttpServletRequest request) {
LocalDate localDate = LocalDate.now();
Visits visits = this.getOne(new LambdaQueryWrapper<Visits>().eq(Visits::getDate, localDate.toString()));
if (visits == null) {
visits = new Visits();
visits.setPvCounts(1L);
} else {
visits.setPvCounts(visits.getPvCounts() + 1);
}
long ipCounts = logMapper.findIp(localDate.toString(), localDate.plusDays(1).toString());
visits.setIpCounts(ipCounts);
this.saveOrUpdate(visits);
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project yshopmall by guchengwuyue.
the class VisitsServiceImpl method save.
@Override
public void save() {
LocalDate localDate = LocalDate.now();
Visits visits = this.getOne(new LambdaQueryWrapper<Visits>().eq(Visits::getDate, localDate.toString()));
if (visits == null) {
visits = new Visits();
visits.setWeekDay(StringUtils.getWeekDay());
visits.setPvCounts(1L);
visits.setIpCounts(1L);
visits.setDate(localDate.toString());
this.save(visits);
}
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project kykms by mahonelau.
the class ThirdAppWechatEnterpriseServiceImpl method sendTextCardMessage.
/**
* 发送文本卡片消息(SysAnnouncement定制)
*
* @param announcement
* @param verifyConfig 是否验证配置(未启用的APP会拒绝发送)
* @return
*/
public JSONObject sendTextCardMessage(SysAnnouncement announcement, boolean verifyConfig) {
if (verifyConfig && !thirdAppConfig.isWechatEnterpriseEnabled()) {
return null;
}
String accessToken = this.getAppAccessToken();
if (accessToken == null) {
return null;
}
TextCard textCard = new TextCard();
textCard.setAgentid(thirdAppConfig.getWechatEnterprise().getAgentIdInt());
boolean isToAll = CommonConstant.MSG_TYPE_ALL.equals(announcement.getMsgType());
String usernameString = "";
if (!isToAll) {
// 将userId转为username
String userId = announcement.getUserIds();
String[] userIds = null;
if (oConvertUtils.isNotEmpty(userId)) {
userIds = userId.substring(0, (userId.length() - 1)).split(",");
} else {
LambdaQueryWrapper<SysAnnouncementSend> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysAnnouncementSend::getAnntId, announcement.getId());
SysAnnouncementSend sysAnnouncementSend = sysAnnouncementSendMapper.selectOne(queryWrapper);
userIds = new String[] { sysAnnouncementSend.getUserId() };
}
List<String> usernameList = sysUserService.userIdToUsername(Arrays.asList(userIds));
usernameString = String.join(",", usernameList);
}
textCard.setTouser(this.getTouser(usernameString, isToAll));
TextCardEntity entity = new TextCardEntity();
entity.setTitle(announcement.getTitile());
entity.setDescription(oConvertUtils.getString(announcement.getMsgAbstract(), "空"));
entity.setUrl(RestUtil.getBaseUrl() + "/sys/annountCement/show/" + announcement.getId());
textCard.setTextcard(entity);
return JwMessageAPI.sendTextCardMessage(textCard, accessToken);
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project kykms by mahonelau.
the class SysDepartPermissionServiceImpl method getPermRuleListByDeptIdAndPermId.
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
if (departPermission != null) {
LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
query.orderByDesc(SysPermissionDataRule::getCreateTime);
List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
return permRuleList;
} else {
return null;
}
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project kykms by mahonelau.
the class SysDepartPermissionServiceImpl method saveDepartPermission.
@Override
@Transactional(rollbackFor = Exception.class)
public void saveDepartPermission(String departId, String permissionIds, String lastPermissionIds) {
List<String> add = getDiff(lastPermissionIds, permissionIds);
if (add != null && add.size() > 0) {
List<SysDepartPermission> list = new ArrayList<SysDepartPermission>();
for (String p : add) {
if (oConvertUtils.isNotEmpty(p)) {
SysDepartPermission rolepms = new SysDepartPermission(departId, p);
list.add(rolepms);
}
}
this.saveBatch(list);
}
List<String> delete = getDiff(permissionIds, lastPermissionIds);
if (delete != null && delete.size() > 0) {
for (String permissionId : delete) {
this.remove(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
// 删除部门权限时,删除部门角色中已授权的权限
List<SysDepartRole> sysDepartRoleList = sysDepartRoleMapper.selectList(new LambdaQueryWrapper<SysDepartRole>().eq(SysDepartRole::getDepartId, departId));
List<String> roleIds = sysDepartRoleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
if (roleIds != null && roleIds.size() > 0) {
departRolePermissionMapper.delete(new LambdaQueryWrapper<SysDepartRolePermission>().eq(SysDepartRolePermission::getPermissionId, permissionId));
}
}
}
}
Aggregations