| | |
| | | import com.yc.service.BaseService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @CreateTime: 2024-08-23 09:27 |
| | | * @Description: |
| | | */ |
| | | @Service |
| | | public class MailFolderImpl extends BaseService implements MailFolderIfc { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void saveFolder(T482107Entity folder) { |
| | | String sql = "set nocount on\n"; |
| | | try { |
| | | sql += "insert into t482107(companyId,companyName,folderName,userCode,userName,content,sortId,createTime,updateTime) " + |
| | | sql += "insert into t482107(companyId,companyName,folder_name,userCode,userName,sort_id,create_time,update_time,rowId,treeControl,parentRowId) " + |
| | | "values (" + GridUtils.prossSqlParm(folder.getCompanyId()) + "," + GridUtils.prossSqlParm(folder.getCompanyName()) + "," + |
| | | GridUtils.prossSqlParm(folder.getFolderName()) + "," + GridUtils.prossSqlParm(folder.getUserCode()) + "," + |
| | | GridUtils.prossSqlParm(folder.getUserName()) + "," + GridUtils.prossSqlParm(folder.getTreeControl()) + "," + |
| | | folder.getSortId() + ",getdate(),getdate())"; |
| | | GridUtils.prossSqlParm(folder.getUserName()) + "," + folder.getSortId() + ",getdate(),getdate()," + |
| | | GridUtils.prossSqlParm(folder.getRowId()) + "," + GridUtils.prossSqlParm(folder.getTreeControl()) + "," + GridUtils.prossSqlParm(folder.getParentRowId()) + ")"; |
| | | jdbcTemplate.update(sql); |
| | | } catch (Exception e) { |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer updateFolder(T482107Entity folder) { |
| | | String sql = "set nocount on\n"; |
| | | try { |
| | | sql += "update t482107 set folderName=" + GridUtils.prossSqlParm(folder.getFolderName()) + ",treeControl=" + GridUtils.prossSqlParm(folder.getTreeControl()) + |
| | | ",sortId=" + folder.getSortId() + ",updateTime=getdate() " + |
| | | "where folderId=" + folder.getFolderId() + " and userCode=" + GridUtils.prossSqlParm(folder.getUserCode()) + "\n"; |
| | | sql += "update t482107 set folder_name=" + GridUtils.prossSqlParm(folder.getFolderName()) + |
| | | ",sort_id=" + folder.getSortId() + ",update_time=getdate() " + ",rowId=" + GridUtils.prossSqlParm(folder.getRowId()) + |
| | | ",treeControl=" + GridUtils.prossSqlParm(folder.getTreeControl()) + ",parentRowId=" + GridUtils.prossSqlParm(folder.getParentRowId()) + |
| | | "where folder_id=" + folder.getFolderId() + " and userCode=" + GridUtils.prossSqlParm(folder.getUserCode()) + "\n"; |
| | | sql += "select @@ROWCOUNT"; |
| | | return jdbcTemplate.queryForObject(sql, Integer.class); |
| | | } catch (Exception e) { |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer deleteFolder(String userCode, Integer folderId) { |
| | | String sql = "set nocount on\n"; |
| | | try { |
| | | sql += "delete t482107 where userCode='" + userCode + "' and folderId=" + folderId + "\n"; |
| | | sql += "delete t482107 where userCode='" + userCode + "' and folder_id=" + folderId + "\n"; |
| | | sql += "select @@ROWCOUNT"; |
| | | return jdbcTemplate.queryForObject(sql, Integer.class); |
| | | } catch (Exception e) { |
| | |
| | | public List<T482107Entity> getMailFolder(String userCode, String search) { |
| | | String sql = "set nocount on\n"; |
| | | try { |
| | | sql += "select companyId,companyName,folderName,userCode,userName,content,sortId,createTime,updateTime " + |
| | | "from t482107 where userCode=" + GridUtils.prossSqlParm(userCode); |
| | | sql += "select companyId,companyName,folder_id,folder_name,userCode,userName,sort_id,create_time,update_time," + |
| | | "isnull(rowId,'') as rowId,treeControl," + |
| | | "isnull(parentRowId,'') as parentRowId from t482107 where userCode=" + GridUtils.prossSqlParm(userCode); |
| | | if (StringUtils.isNotBlank(search)) { |
| | | sql += " and content like '%" + search + "%'"; |
| | | sql += " and folder_name like '%" + search + "%'"; |
| | | } |
| | | sql += " order by folderId \n"; |
| | | sql += " order by folder_id \n"; |
| | | return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(T482107Entity.class)); |
| | | } catch (Exception e) { |
| | | throw e; |