From 8bbd8b3a6584e8ee1ada73dfe0d4bef7570aecf0 Mon Sep 17 00:00:00 2001
From: chenhao <852066789@qq.com>
Date: Wed, 14 May 2025 10:18:46 +0800
Subject: [PATCH] =?UTF-8?q?feat(sip):=20=E6=B7=BB=E5=8A=A0=E5=AE=A2?=
=?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增客户信息实体类、Mapper、Service、Controller- 实现客户信息的添加、编辑、删除、查询和导出功能
- 添加相关HTML模板文件
---
.../templates/system/customer/add.html | 166 +++++++++++++++
.../templates/system/customer/edit.html | 167 +++++++++++++++
.../templates/system/customer/info.html | 190 ++++++++++++++++++
.../controller/CustomerInfoController.java | 130 ++++++++++++
.../com/ruoyi/sip/domain/CustomerInfo.java | 86 ++++++++
.../ruoyi/sip/mapper/CustomerInfoMapper.java | 63 ++++++
.../sip/service/ICustomerInfoService.java | 63 ++++++
.../service/impl/CustomerInfoServiceImpl.java | 96 +++++++++
.../mapper/manage/CustomerInfoMapper.xml | 128 ++++++++++++
9 files changed, 1089 insertions(+)
create mode 100644 ruoyi-admin/src/main/resources/templates/system/customer/add.html
create mode 100644 ruoyi-admin/src/main/resources/templates/system/customer/edit.html
create mode 100644 ruoyi-admin/src/main/resources/templates/system/customer/info.html
create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/controller/CustomerInfoController.java
create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/domain/CustomerInfo.java
create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/ICustomerInfoService.java
create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
create mode 100644 ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/add.html b/ruoyi-admin/src/main/resources/templates/system/customer/add.html
new file mode 100644
index 00000000..6ee02b0a
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/templates/system/customer/add.html
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/edit.html b/ruoyi-admin/src/main/resources/templates/system/customer/edit.html
new file mode 100644
index 00000000..fd2583aa
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/templates/system/customer/edit.html
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/info.html b/ruoyi-admin/src/main/resources/templates/system/customer/info.html
new file mode 100644
index 00000000..c1944b47
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/templates/system/customer/info.html
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/CustomerInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/CustomerInfoController.java
new file mode 100644
index 00000000..8d6fac13
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/CustomerInfoController.java
@@ -0,0 +1,130 @@
+package com.ruoyi.sip.controller;
+
+import java.util.List;
+
+import com.ruoyi.sip.domain.CustomerInfo;
+import com.ruoyi.sip.service.ICustomerInfoService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.enums.BusinessType;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 客户信息Controller
+ *
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@Controller
+@RequestMapping("/system/customer")
+public class CustomerInfoController extends BaseController
+{
+ private String prefix = "system/customer";
+
+ @Autowired
+ private ICustomerInfoService customerInfoService;
+
+ @RequiresPermissions("system:customer:view")
+ @GetMapping()
+ public String info()
+ {
+ return prefix + "/info";
+ }
+
+ /**
+ * 查询客户信息列表
+ */
+ @RequiresPermissions("system:customer:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(CustomerInfo customerInfo)
+ {
+ startPage();
+ List list = customerInfoService.selectCustomerInfoList(customerInfo);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出客户信息列表
+ */
+ @RequiresPermissions("system:customer:export")
+ @Log(title = "客户信息", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ @ResponseBody
+ public AjaxResult export(CustomerInfo customerInfo)
+ {
+ List list = customerInfoService.selectCustomerInfoList(customerInfo);
+ ExcelUtil util = new ExcelUtil(CustomerInfo.class);
+ return util.exportExcel(list, "客户信息数据");
+ }
+
+ /**
+ * 新增客户信息
+ */
+ @RequiresPermissions("system:customer:add")
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存客户信息
+ */
+ @RequiresPermissions("system:customer:add")
+ @Log(title = "客户信息", businessType = BusinessType.INSERT)
+ @PostMapping("/add")
+ @ResponseBody
+ public AjaxResult addSave(CustomerInfo customerInfo)
+ {
+ return toAjax(customerInfoService.insertCustomerInfo(customerInfo));
+ }
+
+ /**
+ * 修改客户信息
+ */
+ @RequiresPermissions("system:customer:edit")
+ @GetMapping("/edit/{id}")
+ public String edit(@PathVariable("id") Long id, ModelMap mmap)
+ {
+ CustomerInfo customerInfo = customerInfoService.selectCustomerInfoById(id);
+ mmap.put("customerInfo", customerInfo);
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存客户信息
+ */
+ @RequiresPermissions("system:customer:edit")
+ @Log(title = "客户信息", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ @ResponseBody
+ public AjaxResult editSave(CustomerInfo customerInfo)
+ {
+ return toAjax(customerInfoService.updateCustomerInfo(customerInfo));
+ }
+
+ /**
+ * 删除客户信息
+ */
+ @RequiresPermissions("system:customer:remove")
+ @Log(title = "客户信息", businessType = BusinessType.DELETE)
+ @PostMapping( "/remove")
+ @ResponseBody
+ public AjaxResult remove(String ids)
+ {
+ return toAjax(customerInfoService.deleteCustomerInfoByIds(ids));
+ }
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/CustomerInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/CustomerInfo.java
new file mode 100644
index 00000000..863e5d54
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/CustomerInfo.java
@@ -0,0 +1,86 @@
+package com.ruoyi.sip.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.ToString;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 客户信息对象 customer_info
+ *
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@Data
+@ToString
+public class CustomerInfo extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** $column.columnComment */
+ private Long id;
+
+ /** 客户编码 */
+ @Excel(name = "客户编码")
+ private String customerCode;
+
+ /** 客户名称 */
+ @Excel(name = "客户名称")
+ private String customerName;
+
+ /** 客户邮编 */
+ @Excel(name = "客户邮编")
+ private String customerPostcode;
+
+ /** 所在省 */
+ @Excel(name = "所在省")
+ private String province;
+
+ /** 所在市 */
+ @Excel(name = "所在市")
+ private String city;
+
+ /** 详细地址 */
+ @Excel(name = "详细地址")
+ private String address;
+
+ /** 联系人 */
+ @Excel(name = "联系人")
+ private String contactPerson;
+
+ /** 联系电话 */
+ @Excel(name = "联系电话")
+ private String contactPhone;
+
+ /** 联系邮件 */
+ @Excel(name = "联系邮件")
+ private String contactEmail;
+
+ /** 所属行业 */
+ @Excel(name = "所属行业")
+ private String industryTyoe;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createAt;
+
+ /** 更新时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updateAt;
+
+ /** 删除时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date deleteAt;
+
+ /** 数据状态 */
+ @Excel(name = "数据状态")
+ private Integer status;
+
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
new file mode 100644
index 00000000..6cdd058d
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
@@ -0,0 +1,63 @@
+package com.ruoyi.sip.mapper;
+
+import com.ruoyi.sip.domain.CustomerInfo;
+
+import java.util.List;
+
+
+/**
+ * 客户信息Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+public interface CustomerInfoMapper
+{
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ public CustomerInfo selectCustomerInfoById(Long id);
+
+ /**
+ * 查询客户信息列表
+ *
+ * @param customerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectCustomerInfoList(CustomerInfo customerInfo);
+
+ /**
+ * 新增客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ public int insertCustomerInfo(CustomerInfo customerInfo);
+
+ /**
+ * 修改客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ public int updateCustomerInfo(CustomerInfo customerInfo);
+
+ /**
+ * 删除客户信息
+ *
+ * @param id 客户信息主键
+ * @return 结果
+ */
+ public int deleteCustomerInfoById(Long id);
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteCustomerInfoByIds(String[] ids);
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/ICustomerInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/ICustomerInfoService.java
new file mode 100644
index 00000000..c79624e7
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/ICustomerInfoService.java
@@ -0,0 +1,63 @@
+package com.ruoyi.sip.service;
+
+import com.ruoyi.sip.domain.CustomerInfo;
+
+import java.util.List;
+
+
+/**
+ * 客户信息Service接口
+ *
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+public interface ICustomerInfoService
+{
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ public CustomerInfo selectCustomerInfoById(Long id);
+
+ /**
+ * 查询客户信息列表
+ *
+ * @param customerInfo 客户信息
+ * @return 客户信息集合
+ */
+ public List selectCustomerInfoList(CustomerInfo customerInfo);
+
+ /**
+ * 新增客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ public int insertCustomerInfo(CustomerInfo customerInfo);
+
+ /**
+ * 修改客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ public int updateCustomerInfo(CustomerInfo customerInfo);
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的客户信息主键集合
+ * @return 结果
+ */
+ public int deleteCustomerInfoByIds(String ids);
+
+ /**
+ * 删除客户信息信息
+ *
+ * @param id 客户信息主键
+ * @return 结果
+ */
+ public int deleteCustomerInfoById(Long id);
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
new file mode 100644
index 00000000..95e3f5ed
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
@@ -0,0 +1,96 @@
+package com.ruoyi.sip.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.sip.domain.CustomerInfo;
+import com.ruoyi.sip.mapper.CustomerInfoMapper;
+import com.ruoyi.sip.service.ICustomerInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ruoyi.common.core.text.Convert;
+
+/**
+ * 客户信息Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@Service
+public class CustomerInfoServiceImpl implements ICustomerInfoService
+{
+ @Autowired
+ private CustomerInfoMapper customerInfoMapper;
+
+ /**
+ * 查询客户信息
+ *
+ * @param id 客户信息主键
+ * @return 客户信息
+ */
+ @Override
+ public CustomerInfo selectCustomerInfoById(Long id)
+ {
+ return customerInfoMapper.selectCustomerInfoById(id);
+ }
+
+ /**
+ * 查询客户信息列表
+ *
+ * @param customerInfo 客户信息
+ * @return 客户信息
+ */
+ @Override
+ public List selectCustomerInfoList(CustomerInfo customerInfo)
+ {
+ return customerInfoMapper.selectCustomerInfoList(customerInfo);
+ }
+
+ /**
+ * 新增客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ @Override
+ public int insertCustomerInfo(CustomerInfo customerInfo)
+ {
+ return customerInfoMapper.insertCustomerInfo(customerInfo);
+ }
+
+ /**
+ * 修改客户信息
+ *
+ * @param customerInfo 客户信息
+ * @return 结果
+ */
+ @Override
+ public int updateCustomerInfo(CustomerInfo customerInfo)
+ {
+ return customerInfoMapper.updateCustomerInfo(customerInfo);
+ }
+
+ /**
+ * 批量删除客户信息
+ *
+ * @param ids 需要删除的客户信息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteCustomerInfoByIds(String ids)
+ {
+ return customerInfoMapper.deleteCustomerInfoByIds(Convert.toStrArray(ids));
+ }
+
+ /**
+ * 删除客户信息信息
+ *
+ * @param id 客户信息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteCustomerInfoById(Long id)
+ {
+ return customerInfoMapper.deleteCustomerInfoById(id);
+ }
+}
diff --git a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
new file mode 100644
index 00000000..37ab2ae3
--- /dev/null
+++ b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, customer_code, customer_name, customer_postcode, province, city, address, contact_person, contact_phone, contact_email, Industry_tyoe, remark, create_at, update_at, delete_at, status from customer_info
+
+
+
+
+
+
+
+ insert into customer_info
+
+ id,
+ customer_code,
+ customer_name,
+ customer_postcode,
+ province,
+ city,
+ address,
+ contact_person,
+ contact_phone,
+ contact_email,
+ Industry_tyoe,
+ remark,
+ create_at,
+ update_at,
+ delete_at,
+ status,
+
+
+ #{id},
+ #{customerCode},
+ #{customerName},
+ #{customerPostcode},
+ #{province},
+ #{city},
+ #{address},
+ #{contactPerson},
+ #{contactPhone},
+ #{contactEmail},
+ #{industryTyoe},
+ #{remark},
+ #{createAt},
+ #{updateAt},
+ #{deleteAt},
+ #{status},
+
+
+
+
+ update customer_info
+
+ customer_code = #{customerCode},
+ customer_name = #{customerName},
+ customer_postcode = #{customerPostcode},
+ province = #{province},
+ city = #{city},
+ address = #{address},
+ contact_person = #{contactPerson},
+ contact_phone = #{contactPhone},
+ contact_email = #{contactEmail},
+ Industry_tyoe = #{industryTyoe},
+ remark = #{remark},
+ create_at = #{createAt},
+ update_at = #{updateAt},
+ delete_at = #{deleteAt},
+ status = #{status},
+
+ where id = #{id}
+
+
+
+ delete from customer_info where id = #{id}
+
+
+
+ delete from customer_info where id in
+
+ #{id}
+
+
+
+
\ No newline at end of file