提交 | 用户 | age
|
ec748c
|
1 |
package com.yc.service.upload; |
X |
2 |
|
|
3 |
import com.yc.action.grid.GridUtils; |
418160
|
4 |
import com.yc.action.upload.AttachmentOA; |
ec748c
|
5 |
import com.yc.entity.attachment.AttachmentOAParam; |
X |
6 |
import com.yc.entity.attachment.AttachmentOaEntity; |
|
7 |
import com.yc.service.BaseService; |
|
8 |
import org.apache.commons.lang3.StringUtils; |
418160
|
9 |
import org.springframework.jdbc.core.BeanPropertyRowMapper; |
ec748c
|
10 |
import org.springframework.stereotype.Service; |
X |
11 |
import java.util.List; |
|
12 |
import java.util.Map; |
|
13 |
|
|
14 |
/** |
|
15 |
* @Author xinyb |
|
16 |
* @Date 15:32 2022/11/1 |
|
17 |
**/ |
|
18 |
@Service("AttachmentOaImpl") |
|
19 |
public class AttachmentOaImpl extends BaseService implements AttachmentOaIfc { |
|
20 |
@Override |
|
21 |
public List<Map<String, Object>> getAttachmentOAUserInfo(String unid, Integer seq, String keyword) { |
|
22 |
try { |
|
23 |
//hasView是null值的时候表示没添加过权限设置,统一返回1。后期设置0表示不能查看 |
|
24 |
String sql = "set nocount on;\n" + |
e81b7d
|
25 |
"declare @creatCode varchar(50),@unid varchar(200)="+GridUtils.prossSqlParm(unid)+",@seq int="+seq+"\n" + |
X |
26 |
"select @creatCode=isnull(a.AuthorCode,'') from _sys_Attachment a where a.UNID=@unid and a.seq=@seq\n" + |
|
27 |
"if @@ROWCOUNT = 0\n" + |
|
28 |
"begin\n" + |
|
29 |
"select @creatCode=isnull(b.AuthorCode,'') from _sys_Attachment9 b where b.UNID=@unid and b.seq=@seq\n" + |
|
30 |
"end\n" + |
|
31 |
" select a.cccode,a.ccname,a.usercode,a.username,isnull(b.hasview,1) hasview,isnull(b.hasdownload,0) hasdownload,\n" + |
418160
|
32 |
" isnull(b.hasdelete,0) hasdelete,isnull(b.hasUpdate,0) hasupdate,b.startdate,b.enddate,b.dateflag, isnull(b.allowdownnums,0) allowdownnums,\n" + |
e81b7d
|
33 |
" isnull(b.allowviewnums,0) allowviewnums,isnull(b.allowupdateNums,0) allowupdatenums, \n" + |
X |
34 |
" isnull(b.viewNums,0) viewnums,isnull(b.downNums,0) downnums,isnull(b.updateNums,0) updatenums, \n" + |
|
35 |
" (case when a.UserCode=b.usercode then 1 else 0 end) checked ,(case when @creatCode=a.userCode then 1 else 0 end) hasAuthor \n" + |
|
36 |
" from _sys_LoginUser a left join _sys_AttachmentPermission b on a.UserCode=b.usercode\n" + |
|
37 |
" and b.unid= @unid and b.seq=@seq where a.inActive <> 1"; |
ec748c
|
38 |
if (StringUtils.isNotBlank(keyword)) {//查询条件 |
X |
39 |
sql += " and (a.ccname like '%" + keyword + "%' or a.username like '%" + keyword + "%')"; |
|
40 |
} |
|
41 |
return jdbcTemplate.queryForList(sql); |
|
42 |
} catch (Exception e) { |
418160
|
43 |
throw e; |
X |
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public List<AttachmentOaEntity> getAttachmentOAUser(AttachmentOAParam param) { |
|
49 |
try { |
|
50 |
String sql="set nocount on;\n" + |
d4c717
|
51 |
"declare @authorCode varchar(50),@authorName varchar(50),@unid varchar(200)= "+GridUtils.prossSqlParm(param.getUnid())+" ," + |
X |
52 |
"@seq int="+param.getSeq()+",@return int=0,@cont int=0\n" + |
|
53 |
"select @return=1,@authorCode=isnull(a.AuthorCode,''),@authorName=isnull(a.AuthorName,'') from _sys_Attachment a where a.UNID=@unid and a.seq=@seq\n" + |
|
54 |
"if @return = 0\n" + |
418160
|
55 |
"begin\n" + |
d4c717
|
56 |
"select @return=1,@authorCode=isnull(b.AuthorCode,''),@authorName=isnull(b.AuthorName,'') from _sys_Attachment9 b where b.UNID=@unid and b.seq=@seq\n" + |
418160
|
57 |
"end\n" + |
d4c717
|
58 |
"if @return=1\n" + |
X |
59 |
"begin\n" + |
|
60 |
"select @cont=1 from _sys_AttachmentPermission where unid=@unid and seq=@seq\n" + |
|
61 |
"if @cont=1\n" + |
418160
|
62 |
"select unid,seq,userCode,userName,hasView,hasDownload,hasDelete,hasUpdate,startDate,endDate,dateFlag,AllowDownNums,AllowViewNums,AllowUpdateNums,\n" + |
d4c717
|
63 |
"isnull(viewNums,0) viewNums,isnull(downNums,0) downNums,isnull(updateNums,0) updateNums,case when usercode = @authorCode then 'true' else 'false' end as hasAuthor\n" + |
X |
64 |
"from _sys_AttachmentPermission where unid=@unid and seq=@seq\n" + |
|
65 |
"else\n" + |
|
66 |
"select @unid as unid,@seq as seq,@authorCode as userCode,@authorName as userName,1 as hasView,1 as hasDownload,1 as hasDelete,1 as hasUpdate,2 as dateFlag,1 as hasAuthor\n" + |
|
67 |
"end\n" + |
|
68 |
"else\n" + |
|
69 |
"raiserror('unid为:%s的附件不存在,请检查',12,1,@unid)\n" + |
|
70 |
"return"; |
418160
|
71 |
return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(AttachmentOaEntity.class)); |
X |
72 |
}catch (Exception e){ |
ec748c
|
73 |
throw e; |
X |
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public Integer setAttachmentOAUser(AttachmentOAParam param) { |
|
79 |
try { |
|
80 |
List<AttachmentOaEntity> oaEntity = param.getOaEntities(); |
|
81 |
String sql = "set nocount on ; \n" + |
|
82 |
" declare @unid varchar(100) =" + GridUtils.prossSqlParm(param.getUnid()) + "," + |
|
83 |
" @seq int =" + param.getSeq() + "\n"; |
|
84 |
sql += " delete a from _sys_AttachmentPermission a where a.unid=@unid and a.seq=@seq\n" ; |
|
85 |
for (AttachmentOaEntity entity : oaEntity) { |
aeb77d
|
86 |
if(entity.isHasAuthor()){//是上传者就不需要添加进去 xin 2022-12-8 10:29:01 |
X |
87 |
continue; |
|
88 |
} |
ec748c
|
89 |
sql += "insert into _sys_AttachmentPermission(uNid,seq,userCode,username,hasView,hasDownload,hasDelete,hasUpdate,startDate," + |
X |
90 |
"endDate,dateFlag,AllowDownNums,AllowViewNums,AllowUpdateNums,downNums,viewNums,updateNums)"; |
|
91 |
sql += " values (@unid,@seq," + GridUtils.prossSqlParm(entity.getUserCode()) + "," + GridUtils.prossSqlParm(entity.getUserName()) + "," + |
|
92 |
(entity.isHasView() ? 1 : 0) + "," + (entity.isHasDownload() ? 1 : 0) + "," + (entity.isHasDelete() ? 1 : 0) + "," + |
|
93 |
(entity.isHasUpdate() ? 1 : 0)+","+ |
0046a7
|
94 |
(StringUtils.isNotBlank(entity.getStartDate()) ? "convert(varchar(19),'" + entity.getStartDate() + "',120)" : null) + "," + |
X |
95 |
(StringUtils.isNotBlank(entity.getEndDate()) ? "convert(varchar(19),'" + entity.getEndDate() + "',120)" : null) + "," + |
418160
|
96 |
entity.getDateFlag()+"," + entity.getAllowDownNums() + "," + entity.getAllowViewNums() + ","+entity.getAllowUpdateNums()+"," + |
ec748c
|
97 |
entity.getDownNums()+","+entity.getViewNums()+","+entity.getUpdateNums()+") \n"; |
X |
98 |
} |
|
99 |
Integer cont = jdbcTemplate.update(sql); |
|
100 |
return cont; |
|
101 |
} catch (Exception e) { |
418160
|
102 |
throw e; |
X |
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
@Override |
|
107 |
public String setAttachmentUser(AttachmentOaEntity param) { |
|
108 |
try { |
|
109 |
String sql="declare @unid varchar(200)="+GridUtils.prossSqlParm(param.getUnid())+",@seq int= "+param.getSeq()+"," + |
|
110 |
"@userCode varchar(50)="+GridUtils.prossSqlParm(param.getUserCode())+"," + |
|
111 |
"@userName varchar(50)="+GridUtils.prossSqlParm(param.getUserName())+",@demo varchar(100),@reutn bit\n" + |
|
112 |
"select @reutn=1 from _sys_AttachmentPermission where unid=@unid and seq=@seq and usercode=@userCode\n" + |
|
113 |
"if @reutn =1\n" + |
|
114 |
"begin\n" + |
|
115 |
" update a set hasView="+(param.isHasView()?"1":"0")+",hasDownload="+(param.isHasDownload()?"1":"0")+"," + |
|
116 |
" hasdelete="+(param.isHasDelete()?"1":"0")+",hasUpdate="+(param.isHasUpdate()?"1":"0")+"," + |
0046a7
|
117 |
"startDate="+(StringUtils.isNotBlank(param.getStartDate()) ? "convert(varchar(19),'" + param.getStartDate() + "',120)" : null) +"," + |
X |
118 |
"endDate="+(StringUtils.isNotBlank(param.getEndDate()) ? "convert(varchar(19),'" + param.getEndDate() + "',120)" : null) +"," + |
418160
|
119 |
"dateFlag="+param.getDateFlag()+",AllowDownNums="+param.getAllowDownNums()+",AllowViewNums="+param.getAllowViewNums()+"," + |
X |
120 |
"AllowUpdateNums="+param.getAllowUpdateNums()+" from _sys_AttachmentPermission a where unid=@unid and seq=@seq and usercode=@userCode\n" + |
|
121 |
" if @@ROWCOUNT >0\n" + |
|
122 |
" begin\n" + |
|
123 |
" set @demo='修改完成!'\n" + |
|
124 |
" end else\n" + |
|
125 |
" begin\n" + |
|
126 |
" set @demo='修改失败!检查修改的用户是否存在'\n" + |
|
127 |
" end\n" + |
|
128 |
"end else\n" + |
|
129 |
"begin\n" + |
|
130 |
" insert into _sys_AttachmentPermission(unid,seq,usercode,username,hasView,hasDownload,hasdelete,hasUpdate,startDate,endDate,dateFlag,AllowDownNums,AllowViewNums,AllowUpdateNums)\n" + |
|
131 |
" values(@unid,@seq,@userCode,@userName,"+(param.isHasView()?"1":"0")+","+(param.isHasDownload()?"1":"0")+","+(param.isHasDelete()?"1":"0")+"" + |
0046a7
|
132 |
" ,"+(param.isHasUpdate()?"1":"0")+","+(StringUtils.isNotBlank(param.getStartDate()) ? "convert(varchar(19),'" + param.getStartDate() + "',120)" : null)+"" + |
X |
133 |
" ,"+(StringUtils.isNotBlank(param.getEndDate()) ? "convert(varchar(19),'" + param.getEndDate() + "',120)" : null)+","+param.getDateFlag()+"" + |
418160
|
134 |
" ,"+param.getAllowDownNums()+","+param.getAllowViewNums()+","+param.getAllowUpdateNums()+")\n" + |
X |
135 |
" set @demo='添加成功!'\n" + |
|
136 |
"end\n" + |
|
137 |
"select @demo as demo"; |
|
138 |
return jdbcTemplate.queryForObject(sql,String.class); |
|
139 |
}catch (Exception e){ |
ec748c
|
140 |
throw e; |
X |
141 |
} |
|
142 |
} |
|
143 |
|
|
144 |
@Override |
|
145 |
public Map<String, Object> getAttachmentOAInfo(AttachmentOAParam param) { |
|
146 |
try { |
e81b7d
|
147 |
String sql="declare @date datetime=CONVERT(varchar(100), GETDATE(), 12), @unid varchar(100)= "+GridUtils.prossSqlParm(param.getUnid())+" ," + |
X |
148 |
" @seq int ="+param.getSeq()+", @userCode varchar(50)= "+GridUtils.prossSqlParm(param.getUserCode())+" \n" + |
418160
|
149 |
" declare @hasView int,@hasDownload int,@hasDelete int,@hasUpdate int ,@startDate datetime ,@endDate datetime,@reutrn bit,@author varchar(50)\n" + |
e81b7d
|
150 |
" select @author=AuthorCode from _sys_Attachment where unid=@unid and seq=@seq\n" + |
X |
151 |
" if @author is null\n" + |
|
152 |
" begin\n" + |
|
153 |
" select @author=AuthorCode from _sys_Attachment9 where unid=@unid and seq=@seq\n" + |
|
154 |
" end\n" + |
|
155 |
" if @author <> @userCode\n" + |
|
156 |
" begin\n" + |
418160
|
157 |
" select @hasView=isnull(a.hasView,1),@hasDownload=isnull(a.hasDownload,0),@hasDelete=isnull(a.hasdelete,0),@hasUpdate=isnull(a.hasUpdate,0),\n" + |
ec748c
|
158 |
" @startDate=a.startDate,@endDate=a.endDate from _sys_AttachmentPermission a \n" + |
X |
159 |
" where a.unid=@unid and seq=@seq and a.usercode=@userCode\n" + |
|
160 |
" if @@ROWCOUNT = 1\n" + |
|
161 |
" begin\n" + |
|
162 |
" if @startDate is null set @startDate=@date\n" + |
|
163 |
" if @endDate is null set @endDate=@date\n" + |
|
164 |
" select @reutrn =1 from _sys_AttachmentPermission a \n" + |
|
165 |
" where (@date between @startDate and @endDate) and a.unid=@unid and seq=@seq and a.usercode=@userCode\n" + |
|
166 |
" if @reutrn is null\n" + |
|
167 |
" begin\n" + |
|
168 |
" set @hasView=0\n" + |
|
169 |
" set @hasDownload=0\n" + |
|
170 |
" set @hasDelete=0\n" + |
418160
|
171 |
" set @hasUpdate=0\n" + |
ec748c
|
172 |
" end\n" + |
X |
173 |
" select (case when @hasView=1 then 'true' else 'false' end) as hasView,\n" + |
|
174 |
" (case when @hasDownload=1 then 'true' else 'false' end) as hasDownload,\n" + |
418160
|
175 |
" (case when @hasDelete=1 then 'true' else 'false' end) as hasDelete,\n" + |
X |
176 |
" (case when @hasUpdate=1 then 'true' else 'false' end) as hasUpdate\n" + |
ec748c
|
177 |
" end\n" + |
X |
178 |
"else\n" + |
|
179 |
" begin\n" + |
418160
|
180 |
" select 'true' as hasView,'false' as hasDownload,'false' as hasDelete,'false' as hasUpdate \n" + |
e81b7d
|
181 |
" end\n" + |
X |
182 |
" end\n" + |
|
183 |
" else begin\n" + |
418160
|
184 |
" select 'true' as hasView,'true' as hasDownload,'true' as hasDelete,'true' as hasUpdate \n" + |
e81b7d
|
185 |
" end"; |
ec748c
|
186 |
return jdbcTemplate.queryForMap(sql); |
X |
187 |
}catch (Exception e){ |
|
188 |
throw e; |
|
189 |
} |
|
190 |
} |
|
191 |
|
|
192 |
@Override |
|
193 |
public String getAttachmentAllow(AttachmentOAParam param) { |
|
194 |
try { |
0046a7
|
195 |
String sql="declare @type varchar(20) = "+GridUtils.prossSqlParm(param.getType())+", " + |
X |
196 |
"@unid varchar(200) = "+GridUtils.prossSqlParm(param.getUnid())+", " + |
|
197 |
"@seq int = "+param.getSeq()+" ,@userCode varchar(50) = "+GridUtils.prossSqlParm(param.getUserCode())+" \n" + |
a84169
|
198 |
"declare @viewNums int = 0,@downNums int = 0,@updateNums int = 0 ,@allowViewNums int = 0,@allowDownNums int = 0,@allowUpdateNums int = 0\n" + |
e6c2af
|
199 |
"declare @memo varchar(800)='',@fileName varchar(200),@authorCode varchar(50),@isTable9 int = 0,@cont bit\n" + |
418160
|
200 |
"declare @totaViewNums int,@totaDownNums int ,@totaUpdateNums int\n" + |
e6c2af
|
201 |
"declare @dateFlag int = 2,@startDate varchar(50) = '',@endDate varchar(50) = '' \n" + |
7681c1
|
202 |
"select @totaViewNums=a.viewNums,@totaDownNums=a.DownNums,@totaUpdateNums=a.UpdateNums,@fileName=a.OriginalFileName,@authorCode=a.AuthorCode from _sys_Attachment a where a.UNID=@unid and a.seq=@seq \n" + |
X |
203 |
"if @@ROWCOUNT = 0\n" + |
418160
|
204 |
"\tbegin\n" + |
X |
205 |
"\t\tselect @isTable9=1,@totaViewNums=a.viewNums,@totaDownNums=a.DownNums,@totaUpdateNums=a.UpdateNums,@fileName=a.OriginalFileName,@authorCode=a.AuthorCode from _sys_Attachment9 a where a.UNID=@unid and a.seq=@seq\n" + |
|
206 |
" end\n" + |
|
207 |
"set @totaViewNums=isnull(@totaViewNums,0) \n" + |
|
208 |
"set @totaDownNums=isnull(@totaDownNums,0) \n" + |
|
209 |
"set @totaUpdateNums=isnull(@totaUpdateNums,0) \n" + |
|
210 |
"select @allowViewNums=isnull(a.AllowViewNums,0),@allowDownNums=isnull(a.AllowDownNums,0),@allowUpdateNums=isnull(a.AllowUpdateNums,0),\n" + |
e6c2af
|
211 |
"@viewNums=isnull(a.viewNums,0),@downNums=isnull(a.downNums,0),@updateNums=isnull(a.UpdateNums,0)," + |
X |
212 |
"@startDate=convert(varchar(20),a.startDate,120),@endDate=convert(varchar(20),a.endDate,120),@dateFlag=isnull(a.dateFlag,2) \n" + |
|
213 |
" from _sys_AttachmentPermission a where a.unid=@unid and a.seq=@seq and a.usercode=@userCode \n" + |
7681c1
|
214 |
"if @@ROWCOUNT > 0 or @authorCode = @userCode\n" + |
ec748c
|
215 |
" begin\n" + |
X |
216 |
" if @type='view'\n" + |
|
217 |
" begin\n" + |
83ba69
|
218 |
" if @authorCode <> @userCode and @allowViewNums <> 0 and @allowViewNums <= @viewNums \n" + |
ec748c
|
219 |
" begin\n" + |
X |
220 |
"\t\t\t\t\t set @cont=0\n" + |
418160
|
221 |
"\t\t\t\t\t set @memo='你在此附件允许查看的次数已经用完;-1'\n" + |
ec748c
|
222 |
" end\n" + |
X |
223 |
" else\n" + |
|
224 |
" begin\n" + |
|
225 |
" set @viewNums = @viewNums + 1\n" + |
|
226 |
" update a set a.allowViewNums=@allowViewNums,a.ViewNums=@viewNums from _sys_AttachmentPermission a where a.unid=@unid and a.seq=@seq and a.usercode=@userCode \n" + |
|
227 |
"\t\t\t\t\tset @cont=1\n" + |
418160
|
228 |
"\t\t\t\t\tset @memo='已执行查看次数;0'\n" + |
ec748c
|
229 |
" end\t\t\t \n" + |
X |
230 |
" end\n" + |
|
231 |
" else if @type='down'\n" + |
|
232 |
" begin\n" + |
83ba69
|
233 |
" if @authorCode <> @userCode and @allowDownNums <> 0 and @allowDownNums <= @downNums \n" + |
ec748c
|
234 |
" begin\n" + |
X |
235 |
"\t\t\t\t\t set @cont=0\n" + |
418160
|
236 |
"\t\t\t\t\t set @memo='你在此附件允许下载的次数已经用完;-1'\n" + |
ec748c
|
237 |
" end\n" + |
X |
238 |
" else\n" + |
|
239 |
" begin\n" + |
|
240 |
" set @downNums = @downNums + 1\n" + |
|
241 |
" update a set a.AllowDownNums=@allowDownNums,a.downNums=@downNums from _sys_AttachmentPermission a where a.unid=@unid and a.seq=@seq and a.usercode=@userCode\n" + |
|
242 |
"\t\t\t\t\t set @cont=1\n" + |
418160
|
243 |
"\t\t\t\t\t set @memo='已执行下载次数;0'\n" + |
X |
244 |
"\t\t\t\t\t\n" + |
ec748c
|
245 |
" end\t\t\t \n" + |
X |
246 |
" end\n" + |
418160
|
247 |
" else if @type='update'\n" + |
X |
248 |
"\t begin\n" + |
83ba69
|
249 |
"\t\t if @authorCode <> @userCode and @allowUpdateNums <> 0 and @allowDownNums <= @updateNums \n" + |
418160
|
250 |
" begin\n" + |
X |
251 |
"\t\t\t\t\t set @cont=0\n" + |
|
252 |
"\t\t\t\t\t set @memo='你在此附件允许更新的次数已经用完;-1'\n" + |
|
253 |
" end\n" + |
|
254 |
" else\n" + |
|
255 |
" begin\n" + |
|
256 |
" set @updateNums = @updateNums + 1\n" + |
|
257 |
" update a set a.AllowUpdateNums=@allowUpdateNums,a.UpdateNums=@updateNums from _sys_AttachmentPermission a where a.unid=@unid and a.seq=@seq and a.usercode=@userCode\n" + |
|
258 |
"\t\t\t\t\t set @cont=1\n" + |
|
259 |
"\t\t\t\t\t set @memo='已执行更新次数;0'\n" + |
|
260 |
" end\t\t\n" + |
|
261 |
"\t end\n" + |
ec748c
|
262 |
" else\n" + |
X |
263 |
" begin\n" + |
e6c2af
|
264 |
" set @memo='错误操作类型;-1;0;0;0;0;0;0;0;0;'';0;'';'';2'\n" + |
ec748c
|
265 |
" end \n" + |
X |
266 |
" end\n" + |
|
267 |
"else\n" + |
|
268 |
" begin\n" + |
418160
|
269 |
" set @memo='此用户未设置权限;0'\n" + |
ec748c
|
270 |
"\t set @cont=1\n" + |
X |
271 |
" end\n" + |
|
272 |
"---更新附件表里的数量\n" + |
|
273 |
"if @cont is not null\n" + |
|
274 |
" begin\n" + |
0c06a4
|
275 |
" set @memo=@memo+';'+convert(varchar(20),@allowViewNums)+';'+convert(varchar(20),@allowDownNums)+';'+convert(varchar(20),@viewNums)+';'+convert(varchar(20),@downNums)+';'+convert(varchar(20),@updateNums)\n" + |
418160
|
276 |
" if @cont = 1\n" + |
X |
277 |
" begin\n" + |
|
278 |
" if @type='view'\n" + |
|
279 |
" begin\n" + |
|
280 |
" set @totaViewNums = @totaViewNums + 1\n" + |
|
281 |
" \t\t if @isTable9 = 1\n" + |
ec748c
|
282 |
"\t\t begin\n" + |
X |
283 |
"\t\t\t\t update b set b.ViewNums=@totaViewNums from _sys_Attachment9 b where b.unid=@unid and b.seq=@seq \n" + |
|
284 |
"\t\t end\n" + |
418160
|
285 |
"\t\t else\n" + |
ec748c
|
286 |
"\t\t begin\n" + |
X |
287 |
"\t\t\t\t update b set b.ViewNums=@totaViewNums from _sys_Attachment b where b.unid=@unid and b.seq=@seq \n" + |
|
288 |
"\t\t\tend \n" + |
418160
|
289 |
" end\n" + |
X |
290 |
" else if @type='down'\n" + |
|
291 |
" begin\n" + |
|
292 |
" set @totaDownNums = @totaDownNums + 1\n" + |
|
293 |
"\t if @isTable9 = 1\n" + |
|
294 |
"\t\t begin\n" + |
ec748c
|
295 |
"\t\t\t update b set b.DownNums=@totaDownNums from _sys_Attachment9 b where b.unid=@unid and b.seq=@seq \n" + |
418160
|
296 |
"\t\t end\n" + |
X |
297 |
"\t else\n" + |
|
298 |
"\t\t begin\n" + |
ec748c
|
299 |
"\t\t update b set b.DownNums=@totaDownNums from _sys_Attachment b where b.unid=@unid and b.seq=@seq \n" + |
418160
|
300 |
"\t end \n" + |
X |
301 |
" end\n" + |
|
302 |
" else if @type='update'\n" + |
|
303 |
" begin\n" + |
|
304 |
" set @totaUpdateNums = @totaUpdateNums + 1\n" + |
|
305 |
"\t if @isTable9 = 1\n" + |
|
306 |
"\t\t begin\n" + |
|
307 |
"\t\t\t update b set b.UpdateNums=@totaUpdateNums from _sys_Attachment9 b where b.unid=@unid and b.seq=@seq \n" + |
|
308 |
"\t\t end\n" + |
|
309 |
"\t else\n" + |
|
310 |
"\t\t begin\n" + |
|
311 |
"\t\t update b set b.UpdateNums=@totaUpdateNums from _sys_Attachment b where b.unid=@unid and b.seq=@seq \n" + |
|
312 |
"\t end\n" + |
|
313 |
" end\n" + |
|
314 |
" end\n" + |
e6c2af
|
315 |
" set @memo=@memo+';'+convert (varchar(20),@totaViewnums)+';'+convert (varchar(20),@totaDownNums)+';'+" + |
X |
316 |
" convert (varchar(20),@totaUpdateNums)+';'+@fileName+';'+convert(varchar(20),@seq)+';'+" + |
|
317 |
" isnull(@startDate,'')+';'+isnull(@endDate,'')+';'+convert(varchar(20),@dateFlag)\n" + |
ec748c
|
318 |
" end\n" + |
X |
319 |
"select @memo as memo"; |
|
320 |
return jdbcTemplate.queryForObject(sql,String.class); |
|
321 |
}catch (Exception e){ |
|
322 |
throw e; |
|
323 |
} |
|
324 |
} |
418160
|
325 |
|
X |
326 |
@Override |
|
327 |
public String getAttachmentDelete(AttachmentOAParam param) { |
|
328 |
try { |
|
329 |
String sql="declare @unid varchar(200)="+GridUtils.prossSqlParm(param.getUnid())+",@seq int= "+param.getSeq()+"," + |
|
330 |
"@userCode varchar(50)="+GridUtils.prossSqlParm(param.getUserCode())+",@demo varchar(100),@reutn bit\n" + |
|
331 |
"select @reutn=1 from _sys_AttachmentPermission where unid=@unid and seq=@seq and usercode=@userCode\n" + |
|
332 |
"if @reutn =1\n" + |
|
333 |
"begin\n" + |
|
334 |
" delete a from _sys_AttachmentPermission a where unid=@unid and seq=@seq and usercode=@userCode\n" + |
|
335 |
" if @@ROWCOUNT >0\n" + |
|
336 |
" begin\n" + |
|
337 |
" set @demo='删除完成!'\n" + |
|
338 |
" end else\n" + |
|
339 |
" begin\n" + |
|
340 |
" set @demo='删除失败!检查删除的用户是否存在'\n" + |
|
341 |
" end\n" + |
|
342 |
"end else\n" + |
|
343 |
"begin\n" + |
|
344 |
" set @demo='当前用户'+@userCode+'未在权限内,请检查!'\n" + |
|
345 |
"end\n" + |
|
346 |
"select @demo as demo"; |
|
347 |
return jdbcTemplate.queryForObject(sql,String.class); |
|
348 |
}catch (Exception e){ |
|
349 |
throw e; |
|
350 |
} |
|
351 |
} |
ec748c
|
352 |
} |