163 lines
4.6 KiB
Java
163 lines
4.6 KiB
Java
package lingtao.net.service;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import lingtao.net.bean.CustomerTrainContent;
|
|
import lingtao.net.bean.CustomerTrainKindLabel;
|
|
import lingtao.net.bean.CustomerTrainProType;
|
|
import lingtao.net.bean.Msg;
|
|
import lingtao.net.bean.SysUser;
|
|
import lingtao.net.dao.CustomerTrainMapper;
|
|
|
|
@Service
|
|
public class CustomerTrainService {
|
|
|
|
@Autowired
|
|
private CustomerTrainMapper customerTrainMapper;
|
|
|
|
// 查询列表
|
|
public List<CustomerTrainContent> getCustomerTrainContents(CustomerTrainContent customerTrainContent) {
|
|
return customerTrainMapper.getCustomerTrainContents(customerTrainContent);
|
|
}
|
|
|
|
// 新增
|
|
public Msg addCustomerTrainContent(CustomerTrainContent customerTrainContent, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainContent.setCreateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.addCustomerTrainContent(customerTrainContent);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 修改
|
|
public Msg updateCustomerTrainContentById(CustomerTrainContent customerTrainContent, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainContent.setUpdateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.updateCustomerTrainContentById(customerTrainContent);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 修改排序
|
|
public Msg updateCustomerTrainContentSort(int id, String value) {
|
|
customerTrainMapper.updateCustomerTrainContentSort(id, Integer.valueOf(value));
|
|
return Msg.success();
|
|
}
|
|
|
|
// 删除
|
|
public Msg deleteCustomerTrainContentById(Integer id) {
|
|
try {
|
|
customerTrainMapper.deleteCustomerTrainContentById(id);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 产品种类字典
|
|
|
|
/**
|
|
*
|
|
* @param customerTrainProType
|
|
* @return
|
|
*/
|
|
// 查询
|
|
public List<CustomerTrainProType> getCustomerTrainProTypes(CustomerTrainProType customerTrainProType) {
|
|
return customerTrainMapper.getCustomerTrainProTypes(customerTrainProType);
|
|
}
|
|
|
|
// 新增
|
|
public Msg addCustomerTrainProType(CustomerTrainProType customerTrainProType, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainProType.setCreateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.addCustomerTrainProType(customerTrainProType);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 修改
|
|
public Msg updateCustomerTrainProTypeById(CustomerTrainProType customerTrainProType, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainProType.setUpdateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.updateCustomerTrainProTypeById(customerTrainProType);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 删除
|
|
public Msg deleteCustomerTrainProTypeById(Integer id) {
|
|
try {
|
|
customerTrainMapper.deleteCustomerTrainProTypeById(id);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 类型字典
|
|
/**
|
|
*
|
|
* @param customerTrainKindLabel
|
|
* @return
|
|
*/
|
|
// 查询
|
|
public List<CustomerTrainKindLabel> getCustomerTrainKindLabelsByProType(
|
|
CustomerTrainKindLabel customerTrainKindLabel) {
|
|
return customerTrainMapper.getCustomerTrainKindLabelsByProType(customerTrainKindLabel);
|
|
}
|
|
|
|
// 新增
|
|
public Msg addCustomerTrainKindLabel(CustomerTrainKindLabel customerTrainKindLabel, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainKindLabel.setCreateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.addCustomerTrainKindLabel(customerTrainKindLabel);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 修改
|
|
public Msg updateCustomerTrainKindLabelById(CustomerTrainKindLabel customerTrainKindLabel, HttpSession session) {
|
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
|
customerTrainKindLabel.setUpdateBy(user.getRealname());
|
|
try {
|
|
customerTrainMapper.updateCustomerTrainKindLabelById(customerTrainKindLabel);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
|
|
// 删除
|
|
public Msg deleteCustomerTrainKindLabelById(Integer id) {
|
|
try {
|
|
customerTrainMapper.deleteCustomerTrainKindLabelById(id);
|
|
return Msg.success();
|
|
} catch (Exception e) {
|
|
return Msg.fail();
|
|
}
|
|
}
|
|
}
|