From ff697d5a43ca5ae65fa8ca5b04c3eb698d476554 Mon Sep 17 00:00:00 2001 From: yuanyang_jr Date: Sat, 23 Apr 2022 23:47:42 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97(test)=EF=BC=9A=E5=A2=9E=E5=8A=A0sys?= =?UTF-8?q?=5Fclient=E8=A1=A8=EF=BC=8C=E5=B9=B6=E5=AF=B9=E5=85=B6=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysClientController.java | 128 ++++++++++++ .../templates/system/client/add.html | 99 ++++++++++ .../templates/system/client/client.html | 146 ++++++++++++++ .../templates/system/client/edit.html | 94 +++++++++ .../com/ruoyi/system/domain/SysClient.java | 185 ++++++++++++++++++ .../ruoyi/system/mapper/SysClientMapper.java | 61 ++++++ .../system/service/ISysClientService.java | 61 ++++++ .../service/impl/SysClientServiceImpl.java | 97 +++++++++ .../mapper/system/SysClientMapper.xml | 121 ++++++++++++ sql/生成客户.sql | 46 +++++ 10 files changed, 1038 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysClientController.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/client/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/client/client.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/client/edit.html create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClient.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysClientMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysClientService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysClientServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/SysClientMapper.xml create mode 100644 sql/生成客户.sql diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysClientController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysClientController.java new file mode 100644 index 000000000..7f8598acb --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysClientController.java @@ -0,0 +1,128 @@ +package com.ruoyi.web.controller.system; +//package com.ruoyi.system.controller; + +import java.util.List; +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.system.domain.SysClient; +import com.ruoyi.system.service.ISysClientService; +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 2022-04-23 + */ +@Controller +@RequestMapping("/system/client") +public class SysClientController extends BaseController +{ + private String prefix = "system/client"; + + @Autowired + private ISysClientService sysClientService; + + @RequiresPermissions("system:client:view") + @GetMapping() + public String client() + { + return prefix + "/client"; + } + + /** + * 查询客户信息列表 + */ + @RequiresPermissions("system:client:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysClient sysClient) + { + startPage(); + List list = sysClientService.selectSysClientList(sysClient); + return getDataTable(list); + } + + /** + * 导出客户信息列表 + */ + @RequiresPermissions("system:client:export") + @Log(title = "客户信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysClient sysClient) + { + List list = sysClientService.selectSysClientList(sysClient); + ExcelUtil util = new ExcelUtil(SysClient.class); + return util.exportExcel(list, "客户信息数据"); + } + + /** + * 新增客户信息 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存客户信息 + */ + @RequiresPermissions("system:client:add") + @Log(title = "客户信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(SysClient sysClient) + { + return toAjax(sysClientService.insertSysClient(sysClient)); + } + + /** + * 修改客户信息 + */ + @RequiresPermissions("system:client:edit") + @GetMapping("/edit/{clientId}") + public String edit(@PathVariable("clientId") Long clientId, ModelMap mmap) + { + SysClient sysClient = sysClientService.selectSysClientByClientId(clientId); + mmap.put("sysClient", sysClient); + return prefix + "/edit"; + } + + /** + * 修改保存客户信息 + */ + @RequiresPermissions("system:client:edit") + @Log(title = "客户信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(SysClient sysClient) + { + return toAjax(sysClientService.updateSysClient(sysClient)); + } + + /** + * 删除客户信息 + */ + @RequiresPermissions("system:client:remove") + @Log(title = "客户信息", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(sysClientService.deleteSysClientByClientIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/resources/templates/system/client/add.html b/ruoyi-admin/src/main/resources/templates/system/client/add.html new file mode 100644 index 000000000..9c9e3a7ea --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/client/add.html @@ -0,0 +1,99 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/client/client.html b/ruoyi-admin/src/main/resources/templates/system/client/client.html new file mode 100644 index 000000000..26cc764c6 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/client/client.html @@ -0,0 +1,146 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/client/edit.html b/ruoyi-admin/src/main/resources/templates/system/client/edit.html new file mode 100644 index 000000000..0648c2954 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/client/edit.html @@ -0,0 +1,94 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClient.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClient.java new file mode 100644 index 000000000..6ce8535b9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClient.java @@ -0,0 +1,185 @@ +package com.ruoyi.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + * 客户信息对象 sys_client + * + * @author ruoyi + * @date 2022-04-23 + */ +public class SysClient extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 客户ID */ + private Long clientId; + + /** 部门ID */ + @Excel(name = "部门ID") + private Long deptId; + + /** 客户key */ + @Excel(name = "客户key") + private Long clientKey; + + /** 客户昵称 */ + @Excel(name = "客户昵称") + private String clientName; + + /** 客户类型(1-内部用户 2-外部用户) */ + @Excel(name = "客户类型", readConverterExp = "1=-内部用户,2=-外部用户") + private String clientType; + + /** 手机号码 */ + @Excel(name = "手机号码") + private String phonenumber; + + /** 帐号状态(0正常 1停用) */ + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 最后登录IP */ + @Excel(name = "最后登录IP") + private String loginIp; + + /** 最后登录时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date loginDate; + + /** 密码最后更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "密码最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date pwdUpdateDate; + + public void setClientId(Long clientId) + { + this.clientId = clientId; + } + + public Long getClientId() + { + return clientId; + } + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getDeptId() + { + return deptId; + } + public void setClientKey(Long clientKey) + { + this.clientKey = clientKey; + } + + public Long getClientKey() + { + return clientKey; + } + public void setClientName(String clientName) + { + this.clientName = clientName; + } + + public String getClientName() + { + return clientName; + } + public void setClientType(String clientType) + { + this.clientType = clientType; + } + + public String getClientType() + { + return clientType; + } + public void setPhonenumber(String phonenumber) + { + this.phonenumber = phonenumber; + } + + public String getPhonenumber() + { + return phonenumber; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setLoginIp(String loginIp) + { + this.loginIp = loginIp; + } + + public String getLoginIp() + { + return loginIp; + } + public void setLoginDate(Date loginDate) + { + this.loginDate = loginDate; + } + + public Date getLoginDate() + { + return loginDate; + } + public void setPwdUpdateDate(Date pwdUpdateDate) + { + this.pwdUpdateDate = pwdUpdateDate; + } + + public Date getPwdUpdateDate() + { + return pwdUpdateDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("clientId", getClientId()) + .append("deptId", getDeptId()) + .append("clientKey", getClientKey()) + .append("clientName", getClientName()) + .append("clientType", getClientType()) + .append("phonenumber", getPhonenumber()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("loginIp", getLoginIp()) + .append("loginDate", getLoginDate()) + .append("pwdUpdateDate", getPwdUpdateDate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysClientMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysClientMapper.java new file mode 100644 index 000000000..e983ad65a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysClientMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysClient; + +/** + * 客户信息Mapper接口 + * + * @author ruoyi + * @date 2022-04-23 + */ +public interface SysClientMapper +{ + /** + * 查询客户信息 + * + * @param clientId 客户信息主键 + * @return 客户信息 + */ + public SysClient selectSysClientByClientId(Long clientId); + + /** + * 查询客户信息列表 + * + * @param sysClient 客户信息 + * @return 客户信息集合 + */ + public List selectSysClientList(SysClient sysClient); + + /** + * 新增客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + public int insertSysClient(SysClient sysClient); + + /** + * 修改客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + public int updateSysClient(SysClient sysClient); + + /** + * 删除客户信息 + * + * @param clientId 客户信息主键 + * @return 结果 + */ + public int deleteSysClientByClientId(Long clientId); + + /** + * 批量删除客户信息 + * + * @param clientIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysClientByClientIds(String[] clientIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysClientService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysClientService.java new file mode 100644 index 000000000..3e4f3ccf7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysClientService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysClient; + +/** + * 客户信息Service接口 + * + * @author ruoyi + * @date 2022-04-23 + */ +public interface ISysClientService +{ + /** + * 查询客户信息 + * + * @param clientId 客户信息主键 + * @return 客户信息 + */ + public SysClient selectSysClientByClientId(Long clientId); + + /** + * 查询客户信息列表 + * + * @param sysClient 客户信息 + * @return 客户信息集合 + */ + public List selectSysClientList(SysClient sysClient); + + /** + * 新增客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + public int insertSysClient(SysClient sysClient); + + /** + * 修改客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + public int updateSysClient(SysClient sysClient); + + /** + * 批量删除客户信息 + * + * @param clientIds 需要删除的客户信息主键集合 + * @return 结果 + */ + public int deleteSysClientByClientIds(String clientIds); + + /** + * 删除客户信息信息 + * + * @param clientId 客户信息主键 + * @return 结果 + */ + public int deleteSysClientByClientId(Long clientId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysClientServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysClientServiceImpl.java new file mode 100644 index 000000000..a5f4c46ba --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysClientServiceImpl.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SysClientMapper; +import com.ruoyi.system.domain.SysClient; +import com.ruoyi.system.service.ISysClientService; +import com.ruoyi.common.core.text.Convert; + +/** + * 客户信息Service业务层处理 + * + * @author ruoyi + * @date 2022-04-23 + */ +@Service +public class SysClientServiceImpl implements ISysClientService +{ + @Autowired + private SysClientMapper sysClientMapper; + + /** + * 查询客户信息 + * + * @param clientId 客户信息主键 + * @return 客户信息 + */ + @Override + public SysClient selectSysClientByClientId(Long clientId) + { + return sysClientMapper.selectSysClientByClientId(clientId); + } + + /** + * 查询客户信息列表 + * + * @param sysClient 客户信息 + * @return 客户信息 + */ + @Override + public List selectSysClientList(SysClient sysClient) + { + return sysClientMapper.selectSysClientList(sysClient); + } + + /** + * 新增客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + @Override + public int insertSysClient(SysClient sysClient) + { + sysClient.setCreateTime(DateUtils.getNowDate()); + return sysClientMapper.insertSysClient(sysClient); + } + + /** + * 修改客户信息 + * + * @param sysClient 客户信息 + * @return 结果 + */ + @Override + public int updateSysClient(SysClient sysClient) + { + sysClient.setUpdateTime(DateUtils.getNowDate()); + return sysClientMapper.updateSysClient(sysClient); + } + + /** + * 批量删除客户信息 + * + * @param clientIds 需要删除的客户信息主键 + * @return 结果 + */ + @Override + public int deleteSysClientByClientIds(String clientIds) + { + return sysClientMapper.deleteSysClientByClientIds(Convert.toStrArray(clientIds)); + } + + /** + * 删除客户信息信息 + * + * @param clientId 客户信息主键 + * @return 结果 + */ + @Override + public int deleteSysClientByClientId(Long clientId) + { + return sysClientMapper.deleteSysClientByClientId(clientId); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysClientMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysClientMapper.xml new file mode 100644 index 000000000..00e107dc0 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysClientMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select client_id, dept_id, client_key, client_name, client_type, phonenumber, status, del_flag, login_ip, login_date, pwd_update_date, create_by, create_time, update_by, update_time, remark from sys_client + + + + + + + + insert into sys_client + + dept_id, + client_key, + client_name, + client_type, + phonenumber, + status, + del_flag, + login_ip, + login_date, + pwd_update_date, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{deptId}, + #{clientKey}, + #{clientName}, + #{clientType}, + #{phonenumber}, + #{status}, + #{delFlag}, + #{loginIp}, + #{loginDate}, + #{pwdUpdateDate}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_client + + dept_id = #{deptId}, + client_key = #{clientKey}, + client_name = #{clientName}, + client_type = #{clientType}, + phonenumber = #{phonenumber}, + status = #{status}, + del_flag = #{delFlag}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + pwd_update_date = #{pwdUpdateDate}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where client_id = #{clientId} + + + + delete from sys_client where client_id = #{clientId} + + + + delete from sys_client where client_id in + + #{clientId} + + + + \ No newline at end of file diff --git a/sql/生成客户.sql b/sql/生成客户.sql new file mode 100644 index 000000000..08456c4ee --- /dev/null +++ b/sql/生成客户.sql @@ -0,0 +1,46 @@ +-- 生成客户表 +drop table if exists sys_client; +create table sys_client ( + client_id bigint(20) not null auto_increment comment '客户ID', + dept_id bigint(20) default null comment '部门ID', + client_key bigint(20) default null comment '客户key', + client_name varchar(30) default '' comment '客户昵称', + client_type varchar(2) default '00' comment '客户类型(1-内部用户 2-外部用户)', + phonenumber varchar(11) default '' comment '手机号码', + status char(1) default '0' comment '帐号状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + login_ip varchar(128) default '' comment '最后登录IP', + login_date datetime comment '最后登录时间', + pwd_update_date datetime comment '密码最后更新时间', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (client_id) +) engine=innodb auto_increment=100 comment = '客户信息表'; + +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息', '3', '1', '/system/client', 'C', '0', 'system:client:view', '#', 'admin', sysdate(), '', null, '客户信息菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息查询', @parentId, '1', '#', 'F', '0', 'system:client:list', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息新增', @parentId, '2', '#', 'F', '0', 'system:client:add', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息修改', @parentId, '3', '#', 'F', '0', 'system:client:edit', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息删除', @parentId, '4', '#', 'F', '0', 'system:client:remove', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户信息导出', @parentId, '5', '#', 'F', '0', 'system:client:export', '#', 'admin', sysdate(), '', null, ''); + +update sys_menu set parent_id = '1' , order_num = '10' where menu_id = '1062' and menu_name = '客户信息'; \ No newline at end of file