From 88d1974e2bfce565747c01b796091fdc6bc01d6c Mon Sep 17 00:00:00 2001 From: dataprince Date: Tue, 11 Jul 2023 16:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E7=BE=8E=E5=85=BC=E5=AE=B9RuoYi-Vue?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=EF=BC=8C=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E4=B8=BB=E5=AD=90=E8=A1=A8mybatis=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DemoCustomerController.java | 104 +++++ .../com/ruoyi/demo/domain/DemoCustomer.java | 112 +++++ .../java/com/ruoyi/demo/domain/DemoGoods.java | 125 ++++++ .../ruoyi/demo/mapper/DemoCustomerMapper.java | 87 ++++ .../demo/service/IDemoCustomerService.java | 61 +++ .../service/impl/DemoCustomerServiceImpl.java | 131 ++++++ .../mapper/demo/DemoCustomerMapper.xml | 110 +++++ ruoyi-ui/src/api/demo/customer.js | 44 ++ ruoyi-ui/src/views/demo/customer/index.vue | 397 ++++++++++++++++++ sql/update.sql | 58 ++- 10 files changed, 1227 insertions(+), 2 deletions(-) create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/DemoCustomerController.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoCustomer.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoGoods.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/DemoCustomerMapper.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IDemoCustomerService.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/DemoCustomerServiceImpl.java create mode 100644 ruoyi-modules/ruoyi-demo/src/main/resources/mapper/demo/DemoCustomerMapper.xml create mode 100644 ruoyi-ui/src/api/demo/customer.js create mode 100644 ruoyi-ui/src/views/demo/customer/index.vue diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/DemoCustomerController.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/DemoCustomerController.java new file mode 100644 index 0000000..02af4d6 --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/DemoCustomerController.java @@ -0,0 +1,104 @@ +package com.ruoyi.demo.controller; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.demo.domain.DemoCustomer; +import com.ruoyi.demo.service.IDemoCustomerService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 客户主表(mb)Controller + * + * @author 数据小王子 + * @date 2023-07-11 + */ +@RestController +@RequestMapping("/demo/customer") +public class DemoCustomerController extends BaseController +{ + @Autowired + private IDemoCustomerService demoCustomerService; + + /** + * 查询客户主表(mb)列表 + */ + @PreAuthorize("@ss.hasPermi('demo:customer:list')") + @GetMapping("/list") + public TableDataInfo list(DemoCustomer demoCustomer) + { + startPage(); + List list = demoCustomerService.selectDemoCustomerList(demoCustomer); + return getDataTable(list); + } + + /** + * 导出客户主表(mb)列表 + */ + @PreAuthorize("@ss.hasPermi('demo:customer:export')") + @Log(title = "客户主表(mb)", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DemoCustomer demoCustomer) + { + List list = demoCustomerService.selectDemoCustomerList(demoCustomer); + ExcelUtil util = new ExcelUtil(DemoCustomer.class); + util.exportExcel(response, list, "客户主表(mb)数据"); + } + + /** + * 获取客户主表(mb)详细信息 + */ + @PreAuthorize("@ss.hasPermi('demo:customer:query')") + @GetMapping(value = "/{customerId}") + public AjaxResult getInfo(@PathVariable("customerId") Long customerId) + { + return success(demoCustomerService.selectDemoCustomerByCustomerId(customerId)); + } + + /** + * 新增客户主表(mb) + */ + @PreAuthorize("@ss.hasPermi('demo:customer:add')") + @Log(title = "客户主表(mb)", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DemoCustomer demoCustomer) + { + return toAjax(demoCustomerService.insertDemoCustomer(demoCustomer)); + } + + /** + * 修改客户主表(mb) + */ + @PreAuthorize("@ss.hasPermi('demo:customer:edit')") + @Log(title = "客户主表(mb)", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DemoCustomer demoCustomer) + { + return toAjax(demoCustomerService.updateDemoCustomer(demoCustomer)); + } + + /** + * 删除客户主表(mb) + */ + @PreAuthorize("@ss.hasPermi('demo:customer:remove')") + @Log(title = "客户主表(mb)", businessType = BusinessType.DELETE) + @DeleteMapping("/{customerIds}") + public AjaxResult remove(@PathVariable Long[] customerIds) + { + return toAjax(demoCustomerService.deleteDemoCustomerByCustomerIds(customerIds)); + } +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoCustomer.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoCustomer.java new file mode 100644 index 0000000..1087eeb --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoCustomer.java @@ -0,0 +1,112 @@ +package com.ruoyi.demo.domain; + +import java.util.List; +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; + +/** + * 客户主表(mb)对象 demo_customer + * + * @author 数据小王子 + * @date 2023-07-11 + */ +public class DemoCustomer extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 客户id */ + private Long customerId; + + /** 客户姓名 */ + @Excel(name = "客户姓名") + private String customerName; + + /** 手机号码 */ + @Excel(name = "手机号码") + private String phonenumber; + + /** 客户性别 */ + @Excel(name = "客户性别") + private String sex; + + /** 客户生日 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "客户生日", width = 30, dateFormat = "yyyy-MM-dd") + private Date birthday; + + /** 商品子信息 */ + private List demoGoodsList; + + public void setCustomerId(Long customerId) + { + this.customerId = customerId; + } + + public Long getCustomerId() + { + return customerId; + } + public void setCustomerName(String customerName) + { + this.customerName = customerName; + } + + public String getCustomerName() + { + return customerName; + } + public void setPhonenumber(String phonenumber) + { + this.phonenumber = phonenumber; + } + + public String getPhonenumber() + { + return phonenumber; + } + public void setSex(String sex) + { + this.sex = sex; + } + + public String getSex() + { + return sex; + } + public void setBirthday(Date birthday) + { + this.birthday = birthday; + } + + public Date getBirthday() + { + return birthday; + } + + public List getDemoGoodsList() + { + return demoGoodsList; + } + + public void setDemoGoodsList(List demoGoodsList) + { + this.demoGoodsList = demoGoodsList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("customerId", getCustomerId()) + .append("customerName", getCustomerName()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("birthday", getBirthday()) + .append("remark", getRemark()) + .append("demoGoodsList", getDemoGoodsList()) + .toString(); + } +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoGoods.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoGoods.java new file mode 100644 index 0000000..edbc0ad --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/DemoGoods.java @@ -0,0 +1,125 @@ +package com.ruoyi.demo.domain; + +import java.math.BigDecimal; +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; + +/** + * 商品子对象 demo_goods + * + * @author 数据小王子 + * @date 2023-07-11 + */ +public class DemoGoods extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 商品id */ + private Long goodsId; + + /** 客户id */ + @Excel(name = "客户id") + private Long customerId; + + /** 商品名称 */ + @Excel(name = "商品名称") + private String name; + + /** 商品重量 */ + @Excel(name = "商品重量") + private Long weight; + + /** 商品价格 */ + @Excel(name = "商品价格") + private BigDecimal price; + + /** 商品时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "商品时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date date; + + /** 商品种类 */ + @Excel(name = "商品种类") + private String type; + + public void setGoodsId(Long goodsId) + { + this.goodsId = goodsId; + } + + public Long getGoodsId() + { + return goodsId; + } + public void setCustomerId(Long customerId) + { + this.customerId = customerId; + } + + public Long getCustomerId() + { + return customerId; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setWeight(Long weight) + { + this.weight = weight; + } + + public Long getWeight() + { + return weight; + } + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public BigDecimal getPrice() + { + return price; + } + public void setDate(Date date) + { + this.date = date; + } + + public Date getDate() + { + return date; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("goodsId", getGoodsId()) + .append("customerId", getCustomerId()) + .append("name", getName()) + .append("weight", getWeight()) + .append("price", getPrice()) + .append("date", getDate()) + .append("type", getType()) + .toString(); + } +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/DemoCustomerMapper.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/DemoCustomerMapper.java new file mode 100644 index 0000000..a23e583 --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/DemoCustomerMapper.java @@ -0,0 +1,87 @@ +package com.ruoyi.demo.mapper; + +import java.util.List; +import com.ruoyi.demo.domain.DemoCustomer; +import com.ruoyi.demo.domain.DemoGoods; + +/** + * 客户主表(mb)Mapper接口 + * + * @author 数据小王子 + * @date 2023-07-11 + */ +public interface DemoCustomerMapper +{ + /** + * 查询客户主表(mb) + * + * @param customerId 客户主表(mb)主键 + * @return 客户主表(mb) + */ + public DemoCustomer selectDemoCustomerByCustomerId(Long customerId); + + /** + * 查询客户主表(mb)列表 + * + * @param demoCustomer 客户主表(mb) + * @return 客户主表(mb)集合 + */ + public List selectDemoCustomerList(DemoCustomer demoCustomer); + + /** + * 新增客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + public int insertDemoCustomer(DemoCustomer demoCustomer); + + /** + * 修改客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + public int updateDemoCustomer(DemoCustomer demoCustomer); + + /** + * 删除客户主表(mb) + * + * @param customerId 客户主表(mb)主键 + * @return 结果 + */ + public int deleteDemoCustomerByCustomerId(Long customerId); + + /** + * 批量删除客户主表(mb) + * + * @param customerIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDemoCustomerByCustomerIds(Long[] customerIds); + + /** + * 批量删除商品子 + * + * @param customerIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDemoGoodsByCustomerIds(Long[] customerIds); + + /** + * 批量新增商品子 + * + * @param demoGoodsList 商品子列表 + * @return 结果 + */ + public int batchDemoGoods(List demoGoodsList); + + + /** + * 通过客户主表(mb)主键删除商品子信息 + * + * @param customerId 客户主表(mb)ID + * @return 结果 + */ + public int deleteDemoGoodsByCustomerId(Long customerId); +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IDemoCustomerService.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IDemoCustomerService.java new file mode 100644 index 0000000..06d1ee4 --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IDemoCustomerService.java @@ -0,0 +1,61 @@ +package com.ruoyi.demo.service; + +import java.util.List; +import com.ruoyi.demo.domain.DemoCustomer; + +/** + * 客户主表(mb)Service接口 + * + * @author 数据小王子 + * @date 2023-07-11 + */ +public interface IDemoCustomerService +{ + /** + * 查询客户主表(mb) + * + * @param customerId 客户主表(mb)主键 + * @return 客户主表(mb) + */ + public DemoCustomer selectDemoCustomerByCustomerId(Long customerId); + + /** + * 查询客户主表(mb)列表 + * + * @param demoCustomer 客户主表(mb) + * @return 客户主表(mb)集合 + */ + public List selectDemoCustomerList(DemoCustomer demoCustomer); + + /** + * 新增客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + public int insertDemoCustomer(DemoCustomer demoCustomer); + + /** + * 修改客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + public int updateDemoCustomer(DemoCustomer demoCustomer); + + /** + * 批量删除客户主表(mb) + * + * @param customerIds 需要删除的客户主表(mb)主键集合 + * @return 结果 + */ + public int deleteDemoCustomerByCustomerIds(Long[] customerIds); + + /** + * 删除客户主表(mb)信息 + * + * @param customerId 客户主表(mb)主键 + * @return 结果 + */ + public int deleteDemoCustomerByCustomerId(Long customerId); +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/DemoCustomerServiceImpl.java b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/DemoCustomerServiceImpl.java new file mode 100644 index 0000000..c6cb7c7 --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/DemoCustomerServiceImpl.java @@ -0,0 +1,131 @@ +package com.ruoyi.demo.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.demo.domain.DemoGoods; +import com.ruoyi.demo.mapper.DemoCustomerMapper; +import com.ruoyi.demo.domain.DemoCustomer; +import com.ruoyi.demo.service.IDemoCustomerService; + +/** + * 客户主表(mb)Service业务层处理 + * + * @author 数据小王子 + * @date 2023-07-11 + */ +@Service +public class DemoCustomerServiceImpl implements IDemoCustomerService +{ + @Autowired + private DemoCustomerMapper demoCustomerMapper; + + /** + * 查询客户主表(mb) + * + * @param customerId 客户主表(mb)主键 + * @return 客户主表(mb) + */ + @Override + public DemoCustomer selectDemoCustomerByCustomerId(Long customerId) + { + return demoCustomerMapper.selectDemoCustomerByCustomerId(customerId); + } + + /** + * 查询客户主表(mb)列表 + * + * @param demoCustomer 客户主表(mb) + * @return 客户主表(mb) + */ + @Override + public List selectDemoCustomerList(DemoCustomer demoCustomer) + { + return demoCustomerMapper.selectDemoCustomerList(demoCustomer); + } + + /** + * 新增客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + @Transactional + @Override + public int insertDemoCustomer(DemoCustomer demoCustomer) + { + int rows = demoCustomerMapper.insertDemoCustomer(demoCustomer); + insertDemoGoods(demoCustomer); + return rows; + } + + /** + * 修改客户主表(mb) + * + * @param demoCustomer 客户主表(mb) + * @return 结果 + */ + @Transactional + @Override + public int updateDemoCustomer(DemoCustomer demoCustomer) + { + demoCustomerMapper.deleteDemoGoodsByCustomerId(demoCustomer.getCustomerId()); + insertDemoGoods(demoCustomer); + return demoCustomerMapper.updateDemoCustomer(demoCustomer); + } + + /** + * 批量删除客户主表(mb) + * + * @param customerIds 需要删除的客户主表(mb)主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteDemoCustomerByCustomerIds(Long[] customerIds) + { + demoCustomerMapper.deleteDemoGoodsByCustomerIds(customerIds); + return demoCustomerMapper.deleteDemoCustomerByCustomerIds(customerIds); + } + + /** + * 删除客户主表(mb)信息 + * + * @param customerId 客户主表(mb)主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteDemoCustomerByCustomerId(Long customerId) + { + demoCustomerMapper.deleteDemoGoodsByCustomerId(customerId); + return demoCustomerMapper.deleteDemoCustomerByCustomerId(customerId); + } + + /** + * 新增商品子信息 + * + * @param demoCustomer 客户主表(mb)对象 + */ + public void insertDemoGoods(DemoCustomer demoCustomer) + { + List demoGoodsList = demoCustomer.getDemoGoodsList(); + Long customerId = demoCustomer.getCustomerId(); + if (StringUtils.isNotNull(demoGoodsList)) + { + List list = new ArrayList(); + for (DemoGoods demoGoods : demoGoodsList) + { + demoGoods.setCustomerId(customerId); + list.add(demoGoods); + } + if (list.size() > 0) + { + demoCustomerMapper.batchDemoGoods(list); + } + } + } +} diff --git a/ruoyi-modules/ruoyi-demo/src/main/resources/mapper/demo/DemoCustomerMapper.xml b/ruoyi-modules/ruoyi-demo/src/main/resources/mapper/demo/DemoCustomerMapper.xml new file mode 100644 index 0000000..98359f8 --- /dev/null +++ b/ruoyi-modules/ruoyi-demo/src/main/resources/mapper/demo/DemoCustomerMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select customer_id, customer_name, phonenumber, sex, birthday, remark from demo_customer + + + + + + + + insert into demo_customer + + customer_name, + phonenumber, + sex, + birthday, + remark, + + + #{customerName}, + #{phonenumber}, + #{sex}, + #{birthday}, + #{remark}, + + + + + update demo_customer + + customer_name = #{customerName}, + phonenumber = #{phonenumber}, + sex = #{sex}, + birthday = #{birthday}, + remark = #{remark}, + + where customer_id = #{customerId} + + + + delete from demo_customer where customer_id = #{customerId} + + + + delete from demo_customer where customer_id in + + #{customerId} + + + + + delete from demo_goods where customer_id in + + #{customerId} + + + + + delete from demo_goods where customer_id = #{customerId} + + + + insert into demo_goods( goods_id, customer_id, name, weight, price, date, type) values + + ( #{item.goodsId}, #{item.customerId}, #{item.name}, #{item.weight}, #{item.price}, #{item.date}, #{item.type}) + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/demo/customer.js b/ruoyi-ui/src/api/demo/customer.js new file mode 100644 index 0000000..7655550 --- /dev/null +++ b/ruoyi-ui/src/api/demo/customer.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询客户主表(mb)列表 +export function listCustomer(query) { + return request({ + url: '/demo/customer/list', + method: 'get', + params: query + }) +} + +// 查询客户主表(mb)详细 +export function getCustomer(customerId) { + return request({ + url: '/demo/customer/' + customerId, + method: 'get' + }) +} + +// 新增客户主表(mb) +export function addCustomer(data) { + return request({ + url: '/demo/customer', + method: 'post', + data: data + }) +} + +// 修改客户主表(mb) +export function updateCustomer(data) { + return request({ + url: '/demo/customer', + method: 'put', + data: data + }) +} + +// 删除客户主表(mb) +export function delCustomer(customerId) { + return request({ + url: '/demo/customer/' + customerId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/demo/customer/index.vue b/ruoyi-ui/src/views/demo/customer/index.vue new file mode 100644 index 0000000..70a88a0 --- /dev/null +++ b/ruoyi-ui/src/views/demo/customer/index.vue @@ -0,0 +1,397 @@ + + + diff --git a/sql/update.sql b/sql/update.sql index 06f5954..d081c2b 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -62,11 +62,52 @@ values('产品树表(mb)删除', @parentId, '4', '#', '', 1, 0, 'F', '0', ' insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品树表(mb)导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'demo:product:export', '#', 'admin', sysdate(), '', null, ''); +-- 客户主表 demo_customer 结构定义 +CREATE TABLE IF NOT EXISTS `demo_customer` ( + `customer_id` bigint NOT NULL AUTO_INCREMENT COMMENT '客户id', + `customer_name` varchar(30) COLLATE utf8mb4_bin DEFAULT '' COMMENT '客户姓名', + `phonenumber` varchar(11) COLLATE utf8mb4_bin DEFAULT '' COMMENT '手机号码', + `sex` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户性别', + `birthday` datetime DEFAULT NULL COMMENT '客户生日', + `remark` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户描述', + PRIMARY KEY (`customer_id`) + ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='客户主表'; + +-- 商品子表 demo_goods 结构定义 +CREATE TABLE IF NOT EXISTS `demo_goods` ( + `goods_id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品id', + `customer_id` bigint NOT NULL COMMENT '客户id', + `name` varchar(30) COLLATE utf8mb4_bin DEFAULT '' COMMENT '商品名称', + `weight` int DEFAULT NULL COMMENT '商品重量', + `price` decimal(6,2) DEFAULT NULL COMMENT '商品价格', + `date` datetime DEFAULT NULL COMMENT '商品时间', + `type` char(1) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品种类', + PRIMARY KEY (`goods_id`) + ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='商品子表'; + +-- 客户主表(mb)菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)', '2018', '1', 'customer', 'demo/customer/index', 1, 0, 'C', '0', '0', 'demo:customer:list', '#', 'admin', sysdate(), '', null, '客户主表(mb)菜单'); +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'demo:customer:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'demo:customer:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'demo:customer:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'demo:customer:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('客户主表(mb)导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'demo:customer:export', '#', 'admin', sysdate(), '', null, ''); -- 插入gen_table数据 INSERT INTO `gen_table` (`table_id`, `table_name`, `table_comment`, `sub_table_name`, `sub_table_fk_name`, `class_name`, `tpl_category`, `package_name`, `module_name`, `business_name`, `function_name`, `function_author`, `gen_type`, `gen_path`, `options`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, 'demo_student', '学生信息表', NULL, NULL, 'DemoStudent', 'crud', 'com.ruoyi.demo', 'demo', 'student', '学生信息单表(mb)', '数据小王子', '0', '/', '{"parentMenuId":"2018"}', 'admin', '2023-06-03 21:44:19', '', '2023-07-09 12:14:53', '生成mybatis语法单表代码'), - (2, 'demo_product', '产品树表', '', '', 'DemoProduct', 'tree', 'com.ruoyi.demo', 'demo', 'product', '产品树表(mb)', '数据小王子', '0', '/', '{"treeCode":"product_id","treeName":"product_name","treeParentCode":"parent_id","parentMenuId":"2018"}', 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08', '生成mybatis语法树表代码'); + (2, 'demo_product', '产品树表', '', '', 'DemoProduct', 'tree', 'com.ruoyi.demo', 'demo', 'product', '产品树表(mb)', '数据小王子', '0', '/', '{"treeCode":"product_id","treeName":"product_name","treeParentCode":"parent_id","parentMenuId":"2018"}', 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08', '生成mybatis语法树表代码'), + (3, 'demo_customer', '客户主表', 'demo_goods', 'customer_id', 'DemoCustomer', 'sub', 'com.ruoyi.demo', 'demo', 'customer', '客户主表(mb)', '数据小王子', '0', '/', '{"parentMenuId":"2018"}', 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51', '生成mybatis语法主子表代码'), + (12, 'demo_goods', '商品子表', NULL, NULL, 'DemoGoods', 'crud', 'com.ruoyi.demo', 'demo', 'goods', '商品子', '数据小王子', '0', '/', NULL, 'admin', '2023-07-11 15:52:15', '', NULL, NULL); -- 插入gen_table_column数据 INSERT INTO `gen_table_column` (`column_id`, `table_id`, `column_name`, `column_comment`, `column_type`, `java_type`, `java_field`, `is_pk`, `is_increment`, `is_required`, `is_insert`, `is_edit`, `is_list`, `is_query`, `query_type`, `html_type`, `dict_type`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES @@ -81,7 +122,20 @@ INSERT INTO `gen_table_column` (`column_id`, `table_id`, `column_name`, `column_ (9, 2, 'parent_id', '父产品id', 'bigint', 'Long', 'parentId', '0', '0', NULL, '1', '1', '0', '0', 'EQ', 'input', '', 2, 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08'), (10, 2, 'product_name', '产品名称', 'varchar(30)', 'String', 'productName', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 3, 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08'), (11, 2, 'order_num', '显示顺序', 'int', 'Long', 'orderNum', '0', '0', NULL, '1', '1', '0', '0', 'EQ', 'input', '', 4, 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08'), - (12, 2, 'status', '产品状态(0正常 1停用)', 'char(1)', 'String', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', 'sys_common_status', 5, 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08'); + (12, 2, 'status', '产品状态(0正常 1停用)', 'char(1)', 'String', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', 'sys_common_status', 5, 'admin', '2023-06-04 21:22:27', '', '2023-07-09 20:56:08'), + (13, 3, 'customer_id', '客户id', 'bigint', 'Long', 'customerId', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (14, 3, 'customer_name', '客户姓名', 'varchar(30)', 'String', 'customerName', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (15, 3, 'phonenumber', '手机号码', 'varchar(11)', 'String', 'phonenumber', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (16, 3, 'sex', '客户性别', 'varchar(20)', 'String', 'sex', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', 'sys_user_sex', 4, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (17, 3, 'birthday', '客户生日', 'datetime', 'Date', 'birthday', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'datetime', '', 5, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (18, 3, 'remark', '客户描述', 'varchar(500)', 'String', 'remark', '0', '0', NULL, '1', '1', '1', NULL, 'EQ', 'textarea', '', 6, 'admin', '2023-06-04 21:43:20', '', '2023-07-11 15:49:51'), + (67, 12, 'goods_id', '商品id', 'bigint', 'Long', 'goodsId', '1', '1', NULL, NULL, NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2023-07-11 15:52:15', '', NULL), + (68, 12, 'customer_id', '客户id', 'bigint', 'Long', 'customerId', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2023-07-11 15:52:15', '', NULL), + (69, 12, 'name', '商品名称', 'varchar(30)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 3, 'admin', '2023-07-11 15:52:15', '', NULL), + (70, 12, 'weight', '商品重量', 'int', 'Long', 'weight', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2023-07-11 15:52:15', '', NULL), + (71, 12, 'price', '商品价格', 'decimal(6,2)', 'BigDecimal', 'price', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2023-07-11 15:52:15', '', NULL), + (72, 12, 'date', '商品时间', 'datetime', 'Date', 'date', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'datetime', '', 6, 'admin', '2023-07-11 15:52:15', '', NULL), + (73, 12, 'type', '商品种类', 'char(1)', 'String', 'type', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', '', 7, 'admin', '2023-07-11 15:52:15', '', NULL);