sgj
5 天以前 5cc86ac9bc9d24e947d28542a1023e9c063a2a12
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SnapConfService.java
@@ -41,13 +41,13 @@
     */
    public QueryWrapper<SnapConf> getQueryWrapper(SnapConf param) {
        QueryWrapper<SnapConf> queryWrapper = new QueryWrapper<>();
        if(null == param) param= new SnapConf();
        // 设置公司ID并作为查询条件
        param.setCompanyId(ContextUtil.getCompanyId());
        queryWrapper.eq("company_id", param.getCompanyId());
        // 按创建时间倒序排序
        queryWrapper.orderByDesc("create_time");
        // 按更新时间倒序排序
        queryWrapper.orderByDesc("update_time");
        return queryWrapper;
    }
@@ -66,39 +66,67 @@
     * 插入新数据
     *
     * @param param 数据实体
     * @return 影响行数
     * @return 操作结果
     */
    public int insertData(SnapConf param) {
        param.setId(ContextUtil.generateId());
        param.setCompanyId(ContextUtil.getCompanyId());
        param.setUpdateBy(ContextUtil.getLoginUserName());
        param.setUpdateTime(new Date());
        param.setCreateBy(ContextUtil.getLoginUserName());
        param.setCreateTime(new Date());
        return snapConfMapper.insert(param);
    public BaseResp insertData(SnapConf param) {
        try {
            param.setId(ContextUtil.generateId());
            param.setCompanyId(ContextUtil.getCompanyId());
            param.setCreateBy(ContextUtil.getLoginUserName());
            param.setCreateTime(new Date());
            return snapConfMapper.insert(param) > 0 ? BaseResp.success() : BaseResp.error("添加失败");
        } catch (Exception e) {
            log.error("插入快拍配置数据异常", e);
            return BaseResp.error("添加失败:" + e.getMessage());
        }
    }
    /**
     * 更新已有数据
     *
     * @param param 数据实体
     * @return 影响行数
     * @return 操作结果
     */
    public int updateData(SnapConf param) {
        param.setUpdateBy(ContextUtil.getLoginUserName());
        param.setUpdateTime(new Date());
        return snapConfMapper.updateById(param);
    public BaseResp updateData(SnapConf param) {
        try {
            param.setUpdateBy(ContextUtil.getLoginUserName());
            param.setUpdateTime(new Date());
            return snapConfMapper.updateById(param) > 0 ? BaseResp.success() : BaseResp.error("更新失败");
        } catch (Exception e) {
            log.error("更新快拍配置数据异常", e);
            return BaseResp.error("更新失败:" + e.getMessage());
        }
    }
    /**
     * 删除指定ID的数据
     *
     * @param ids 要删除的记录ID集合(逗号分隔)
     * @param param 要删除的记录
     * @return 操作结果
     */
    public void deleteDataById(String ids) {
        String[] recordIds = Convert.toStrArray(ids);
        for (String recordId : recordIds) {
            snapConfMapper.deleteById(recordId);
        }
    public BaseResp deleteData(SnapConf param) {
        return snapConfMapper.deleteById(param) > 0 ? BaseResp.success() : BaseResp.error("删除失败");
    }
    /**
     * 更新执行时间
     *
     */
    public void updateActHour(SnapConf param) {
        // 创建更新条件包装器
        QueryWrapper<SnapConf> queryWrapper = new QueryWrapper<>();
        // 设置组织ID条件
        queryWrapper.eq("company_id", param.getCompanyId());
        // 创建更新实体,只更新执行时间相关字段
        SnapConf updateEntity = new SnapConf();
        updateEntity.setActHour1(param.getActHour1());
        updateEntity.setActHour2(param.getActHour2());
        updateEntity.setActHour3(param.getActHour3());
        updateEntity.setUpdateTime(new Date());
        updateEntity.setUpdateBy(ContextUtil.getLoginUserName());
        // 执行批量更新
        snapConfMapper.update(updateEntity, queryWrapper);
    }
}