| | |
| | | import com.yc.sdk.weixincp.util.UploadFiles; |
| | | import com.yc.service.BaseService; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.dao.DataAccessException; |
| | |
| | | return (ret!= null && !ret.equals(0)?true:false) ; |
| | | } |
| | | public String getdeleteAttachmentSql(PicEntity entity){ |
| | | String rand= "_"+RandomStringUtils.randomAlphanumeric(2); |
| | | String tableName = ""; |
| | | if (entity.getType() == 0 || entity.getType() == 1) { |
| | | tableName = "_sys_attachment9"; |
| | |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(entity.getRowid())){ |
| | | where+=" and rowid="+GridUtils.prossSqlParm(entity.getRowid()); |
| | | } |
| | | String sql = " \n set nocount on \n declare @unid varchar(50)="+GridUtils.prossSqlParm(entity.getUuid())+" ,@seq int = "+entity.getSeq()+" \n" |
| | | + " declare @AcType varchar(50) = "+GridUtils.prossSqlParm(entity.getAction())+" \n" |
| | | + " declare @usercode varchar(50) = "+GridUtils.prossSqlParm(entity.getUserCode())+" \n" |
| | | + " declare @username varchar(50) = "+GridUtils.prossSqlParm(entity.getUserName())+" \n" |
| | | + " declare @ip varchar(50) ="+GridUtils.prossSqlParm(entity.getIp()) +" \n" |
| | | + " declare @mydelPicrowcount int = 0 \n" |
| | | String sql = " \n set nocount on \n declare @unid"+rand+" varchar(50)="+GridUtils.prossSqlParm(entity.getUuid())+" ,@seq"+rand+" int = "+entity.getSeq()+" \n" |
| | | + " declare @AcType"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getAction())+" \n" |
| | | + " declare @usercode"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getUserCode())+" \n" |
| | | + " declare @username"+rand+" varchar(50) = "+GridUtils.prossSqlParm(entity.getUserName())+" \n" |
| | | + " declare @ip"+rand+" varchar(50) ="+GridUtils.prossSqlParm(entity.getIp()) +" \n" |
| | | + " declare @mydelPicrowcount"+rand+" int = 0 \n" |
| | | + " insert into _sys_attachmentlog(unid,seq,acType,usercode,username,downloadtime,ip," |
| | | + " formid,doccode,rowid,fieldid,PhysicalPath,PhysicalFile,OriginalFileName,FileSize,\n" |
| | | + " FileType,DownNums,ViewNums,UpdateNums,AuthorCode,AuthorName,UploadTime,LastUpdateTime,\n" |
| | | + " smallPicPath,isSetPermission,lastfilename,SmallPicture,OriginalPicture,lastfilesize,\n" |
| | | + " LastAuthorCode,lastauthorName,lastfileType,wxFileType,WxCreateTime,wxMediaId,wxPicUrl,Remark) \n" |
| | | + " select unid,seq,@acType,@usercode,@username,getdate(),@ip, \n" |
| | | + " select unid,seq,@acType"+rand+",@usercode"+rand+",@username"+rand+",getdate(),@ip"+rand+", \n" |
| | | + " formid,doccode,rowid,fieldid,PhysicalPath,PhysicalFile,OriginalFileName,FileSize,\n" |
| | | + " FileType,DownNums,ViewNums,UpdateNums,AuthorCode,AuthorName,UploadTime,LastUpdateTime,\n" |
| | | + " smallPicPath,isSetPermission,lastfilename,SmallPicture,OriginalPicture,lastfilesize,\n" |
| | | + " LastAuthorCode,lastauthorName,lastfileType,wxFileType,WxCreateTime,wxMediaId,wxPicUrl,Remark \n" |
| | | + " from " + tableName + " where unid =@unid and seq=@seq "+where+" \n" |
| | | + " delete " + tableName + " where unid =@unid and seq=@seq "+where+"\n"; |
| | | + " from " + tableName + " where unid =@unid"+rand+" and seq=@seq"+rand+" "+where+" \n" |
| | | + " delete " + tableName + " where unid =@unid"+rand+" and seq=@seq"+rand+" "+where+"\n"; |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(entity.getSql())){ |
| | | sql+=" if @@rowcount>0 \n begin \n"+entity.getSql()+" \n end\n"; |
| | | } |
| | | sql+=" set @mydelPicrowcount = @@rowcount \n" |
| | | + " select @mydelPicrowcount \n"; |
| | | sql+=" set @mydelPicrowcount"+rand+" = @@rowcount \n" |
| | | + " select @mydelPicrowcount"+rand+" \n"; |
| | | return sql; |
| | | } |
| | | // 删除文件数据记录 |