提交 | 用户 | age
|
385e2d
|
1 |
package com.yc.crm.mail.service; |
X |
2 |
|
|
3 |
import com.yc.action.grid.GridUtils; |
|
4 |
import com.yc.crm.mail.entity.T482107Entity; |
|
5 |
import com.yc.service.BaseService; |
|
6 |
import org.apache.commons.lang3.StringUtils; |
|
7 |
import org.springframework.jdbc.core.BeanPropertyRowMapper; |
428443
|
8 |
import org.springframework.stereotype.Service; |
048b74
|
9 |
import org.springframework.transaction.annotation.Transactional; |
385e2d
|
10 |
|
X |
11 |
import java.util.List; |
|
12 |
|
|
13 |
/** |
|
14 |
* @BelongsProject: eCoWorksV3 |
|
15 |
* @BelongsPackage: com.yc.crm.mail.service |
|
16 |
* @author: xinyb |
|
17 |
* @CreateTime: 2024-08-23 09:27 |
|
18 |
* @Description: |
|
19 |
*/ |
428443
|
20 |
@Service |
385e2d
|
21 |
public class MailFolderImpl extends BaseService implements MailFolderIfc { |
048b74
|
22 |
@Transactional(rollbackFor = Exception.class) |
385e2d
|
23 |
@Override |
X |
24 |
public void saveFolder(T482107Entity folder) { |
|
25 |
String sql = "set nocount on\n"; |
|
26 |
try { |
428443
|
27 |
sql += "insert into t482107(companyId,companyName,folder_name,userCode,userName,sort_id,create_time,update_time,rowId,treeControl,parentRowId) " + |
385e2d
|
28 |
"values (" + GridUtils.prossSqlParm(folder.getCompanyId()) + "," + GridUtils.prossSqlParm(folder.getCompanyName()) + "," + |
X |
29 |
GridUtils.prossSqlParm(folder.getFolderName()) + "," + GridUtils.prossSqlParm(folder.getUserCode()) + "," + |
428443
|
30 |
GridUtils.prossSqlParm(folder.getUserName()) + "," + folder.getSortId() + ",getdate(),getdate()," + |
X |
31 |
GridUtils.prossSqlParm(folder.getRowId()) + "," + GridUtils.prossSqlParm(folder.getTreeControl()) + "," + GridUtils.prossSqlParm(folder.getParentRowId()) + ")"; |
385e2d
|
32 |
jdbcTemplate.update(sql); |
X |
33 |
} catch (Exception e) { |
|
34 |
throw e; |
|
35 |
} |
|
36 |
} |
048b74
|
37 |
@Transactional(rollbackFor = Exception.class) |
385e2d
|
38 |
@Override |
X |
39 |
public Integer updateFolder(T482107Entity folder) { |
|
40 |
String sql = "set nocount on\n"; |
|
41 |
try { |
428443
|
42 |
sql += "update t482107 set folder_name=" + GridUtils.prossSqlParm(folder.getFolderName()) + |
X |
43 |
",sort_id=" + folder.getSortId() + ",update_time=getdate() " + ",rowId=" + GridUtils.prossSqlParm(folder.getRowId()) + |
|
44 |
",treeControl=" + GridUtils.prossSqlParm(folder.getTreeControl()) + ",parentRowId=" + GridUtils.prossSqlParm(folder.getParentRowId()) + |
|
45 |
"where folder_id=" + folder.getFolderId() + " and userCode=" + GridUtils.prossSqlParm(folder.getUserCode()) + "\n"; |
385e2d
|
46 |
sql += "select @@ROWCOUNT"; |
f5cc47
|
47 |
return jdbcTemplate.queryForObject(sql, Integer.class); |
385e2d
|
48 |
} catch (Exception e) { |
X |
49 |
throw e; |
|
50 |
} |
|
51 |
} |
048b74
|
52 |
@Transactional(rollbackFor = Exception.class) |
385e2d
|
53 |
@Override |
X |
54 |
public Integer deleteFolder(String userCode, Integer folderId) { |
|
55 |
String sql = "set nocount on\n"; |
|
56 |
try { |
428443
|
57 |
sql += "delete t482107 where userCode='" + userCode + "' and folder_id=" + folderId + "\n"; |
385e2d
|
58 |
sql += "select @@ROWCOUNT"; |
f5cc47
|
59 |
return jdbcTemplate.queryForObject(sql, Integer.class); |
385e2d
|
60 |
} catch (Exception e) { |
X |
61 |
throw e; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
f5cc47
|
66 |
public List<T482107Entity> getMailFolder(String userCode, String search) { |
385e2d
|
67 |
String sql = "set nocount on\n"; |
X |
68 |
try { |
53241c
|
69 |
sql += "select companyId,companyName,folder_id,folder_name,userCode,userName,sort_id,create_time,update_time," + |
X |
70 |
"isnull(rowId,'') as rowId,treeControl," + |
|
71 |
"isnull(parentRowId,'') as parentRowId from t482107 where userCode=" + GridUtils.prossSqlParm(userCode); |
f5cc47
|
72 |
if (StringUtils.isNotBlank(search)) { |
428443
|
73 |
sql += " and folder_name like '%" + search + "%'"; |
385e2d
|
74 |
} |
428443
|
75 |
sql += " order by folder_id \n"; |
385e2d
|
76 |
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(T482107Entity.class)); |
X |
77 |
} catch (Exception e) { |
|
78 |
throw e; |
|
79 |
} |
|
80 |
} |
|
81 |
} |