Search in sources :

Example 96 with LambdaQueryWrapper

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);
}
Also used : Visits(co.yixiang.modules.monitor.domain.Visits) LocalDate(java.time.LocalDate) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 97 with LambdaQueryWrapper

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);
    }
}
Also used : Visits(co.yixiang.modules.monitor.domain.Visits) LocalDate(java.time.LocalDate) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 98 with LambdaQueryWrapper

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);
}
Also used : TextCardEntity(com.jeecg.qywx.api.message.vo.TextCardEntity) TextCard(com.jeecg.qywx.api.message.vo.TextCard) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 99 with LambdaQueryWrapper

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;
    }
}
Also used : SysDepartPermission(org.jeecg.modules.system.entity.SysDepartPermission) SysPermissionDataRule(org.jeecg.modules.system.entity.SysPermissionDataRule) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 100 with LambdaQueryWrapper

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));
            }
        }
    }
}
Also used : SysDepartPermission(org.jeecg.modules.system.entity.SysDepartPermission) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) SysDepartRole(org.jeecg.modules.system.entity.SysDepartRole) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)381 Transactional (org.springframework.transaction.annotation.Transactional)60 JSONObject (com.alibaba.fastjson.JSONObject)52 Result (org.jeecg.common.api.vo.Result)50 ArrayList (java.util.ArrayList)42 List (java.util.List)30 Map (java.util.Map)29 Collectors (java.util.stream.Collectors)26 Service (org.springframework.stereotype.Service)24 LoginUser (org.jeecg.common.system.vo.LoginUser)22 SysPermission (org.jeecg.modules.system.entity.SysPermission)22 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)22 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)21 IPage (com.baomidou.mybatisplus.core.metadata.IPage)20 HashMap (java.util.HashMap)20 SysUser (org.jeecg.modules.system.entity.SysUser)20 ApiOperation (io.swagger.annotations.ApiOperation)19 ServiceException (cn.lili.common.exception.ServiceException)18 ServiceImpl (com.baomidou.mybatisplus.extension.service.impl.ServiceImpl)18 Autowired (org.springframework.beans.factory.annotation.Autowired)18