多单位版国产化地质资料管理系统
zs
2026-02-04 2b543ca35ad4697e31225829be13e375cd2b0259
src/main/java/com/zbooksoft/gdmis/operate/CatAjjxxOperate.java
@@ -179,10 +179,16 @@
        try {
            int state = 0;
            String columnName = "fbzt";
//            updateState(viewId, idList, state, columnName);
            updateState(viewId, idList, state, columnName);
            QueryWrapper<CatAjjxx> fileQueryWrapper = new QueryWrapper<>();
            fileQueryWrapper.in("id",idList);
            List<CatAjjxx> catAjjxxList=catAjjxxService.list(fileQueryWrapper);
            ArchivesCustomConfig archivesCustomConfig = customConfigUtil.getConfigObj(ArchivesCustomConfig.class);
            for (CatAjjxx catAjjxx:catAjjxxList){
                String wjlj = archivesCustomConfig.getOriginalPath() + "已入库" + File.separator + catAjjxx.getXmkyqbh() + "["+catAjjxx.getXmkyqmc()+"]";
                File file=new File(wjlj);
                deleteDirectory(file);
            }
            return new AjaxResponse(true);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
@@ -213,17 +219,30 @@
    public void updateState(Long viewId, ArrayList<Long> idList, Integer state, String columnName) {
        View view = viewService.getViewById(viewId);
        String strSql = "update " + view.getMainTableName() + " set " + columnName + " = " + state;
//        jdbcTemplate.batchUpdate(strSql + " where " + view.getIdField() + "=?", new BatchPreparedStatementSetter() {
//            @Override
//            public void setValues(PreparedStatement ps, int i) throws SQLException {
//                ps.setLong(1, idList.get(i));// 下标从1开始
//            }
//
//            @Override
//            public int getBatchSize() {
//                return idList.size();
//            }
//        });
        jdbcTemplate.batchUpdate(strSql + " where " + view.getIdField() + "=?", new BatchPreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement ps, int i) throws SQLException {
                ps.setLong(1, idList.get(i));// 下标从1开始
            }
            @Override
            public int getBatchSize() {
                return idList.size();
            }
        });
        strSql = "update cat_item_yswjxx set yszt = 0";
        jdbcTemplate.batchUpdate(strSql + " where aj_id=?", new BatchPreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement ps, int i) throws SQLException {
                ps.setLong(1, idList.get(i));// 下标从1开始
            }
            @Override
            public int getBatchSize() {
                return idList.size();
            }
        });
    }