package com.yc.crm.mail.service;
|
|
import com.yc.action.grid.GridUtils;
|
import com.yc.crm.mail.entity.T482108Entity;
|
import com.yc.service.BaseService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
/**
|
* @BelongsProject: eCoWorksV3
|
* @BelongsPackage: com.yc.crm.mail.service
|
* @author: xinyb
|
* @CreateTime: 2024-08-08 08:56
|
* @Description:
|
*/
|
@Service
|
public class MailQuickTextImpl extends BaseService implements MailQuickTextIfc {
|
@Override
|
public void saveQuickText(T482108Entity quickText) {
|
String sql = "set nocount on\n";
|
try {
|
sql += "insert into t482108(companyId,companyName,text_Name,userCode,userName,content,sort_id,create_time,update_time) " +
|
"values (" + GridUtils.prossSqlParm(quickText.getCompanyId()) + "," + GridUtils.prossSqlParm(quickText.getCompanyName()) + "," +
|
GridUtils.prossSqlParm(quickText.getTextName()) + "," + GridUtils.prossSqlParm(quickText.getUserCode()) + "," +
|
GridUtils.prossSqlParm(quickText.getUserName()) + "," + GridUtils.prossSqlParm(quickText.getContent()) + "," +
|
quickText.getSortId() + ",getdate(),getdate())";
|
jdbcTemplate.update(sql);
|
} catch (Exception e) {
|
throw e;
|
}
|
}
|
|
@Override
|
public Integer updateQuickText(T482108Entity quickText) {
|
String sql = "set nocount on\n";
|
try {
|
sql += "update t482108 set text_Name=" + GridUtils.prossSqlParm(quickText.getTextName()) + ",content=" + GridUtils.prossSqlParm(quickText.getContent()) +
|
",sort_id=" + quickText.getSortId() + ",update_time=getdate() " +
|
"where text_id=" + quickText.getTextId() + " and userCode=" + GridUtils.prossSqlParm(quickText.getUserCode()) + "\n";
|
sql += "select @@ROWCOUNT";
|
return jdbcTemplate.queryForObject(sql, Integer.class);
|
} catch (Exception e) {
|
throw e;
|
}
|
}
|
|
@Override
|
public Integer deleteQuickText(String userCode, Integer textId) {
|
String sql = "set nocount on\n";
|
try {
|
sql += "delete t482108 where userCode='" + userCode + "' and textId=" + textId + "\n";
|
sql += "select @@ROWCOUNT";
|
return jdbcTemplate.queryForObject(sql, Integer.class);
|
} catch (Exception e) {
|
throw e;
|
}
|
}
|
|
@Override
|
public List<T482108Entity> getMailQuickText(String userCode,String search) {
|
String sql = "set nocount on\n";
|
try {
|
sql += "select companyId,companyName,textId,textName,userCode,userName,content,sortId,createTime,updateTime" +
|
"from t482108 where userCode=" + GridUtils.prossSqlParm(userCode);
|
if (StringUtils.isNotBlank(search)) {
|
sql += " and TextName like '%" + search+"%'";
|
}
|
sql += " order by textId" + "\n";
|
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(T482108Entity.class));
|
} catch (Exception e) {
|
throw e;
|
}
|
}
|
}
|