云
5 天以前 cccbfadcb6e96c23a33c40c0687a27c2f6efa1db
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java
@@ -30,6 +30,11 @@
    public List<Map<String,Object>> seals(boolean activeOnly) {
        return jdbc.queryForList("SELECT id,name,enabled,create_time FROM pd_seal WHERE tenant_id=? AND deleted=0" + (activeOnly ? " AND enabled=1" : "") + " ORDER BY id DESC", tenant());
    }
    public byte[] getImage(long id) {
        var rows = jdbc.queryForList("SELECT image_data FROM pd_seal WHERE id=? AND tenant_id=? AND deleted=0", id, tenant());
        if (rows.isEmpty()) throw fail("印章不存在");
        return (byte[]) rows.get(0).get("image_data");
    }
    public long upload(String name, MultipartFile file, Long userId) throws Exception {
        if (name == null || name.isBlank() || name.length() > 100) throw fail("印章名称不能为空且不能超过100字");
        if (file == null || file.isEmpty() || file.getSize() > 2 * 1024 * 1024) throw fail("请上传不超过2MB的PNG印章图片");