diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SalesAreaReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SalesAreaReportController.java new file mode 100644 index 0000000..95f6d9f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SalesAreaReportController.java @@ -0,0 +1,72 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +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.system.domain.SalesAreaReport; +import com.ruoyi.system.service.ISalesAreaReportService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +@RestController +@RequestMapping("/system/report") +public class SalesAreaReportController extends BaseController { + @Autowired + private ISalesAreaReportService salesAreaReportService; + + @PreAuthorize("@ss.hasPermi('system:report:list')") + @GetMapping("/list") + public TableDataInfo list(SalesAreaReport salesAreaReport) { + startPage(); + List list = salesAreaReportService.selectSalesAreaReportList(salesAreaReport); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('system:report:export')") + @Log(title = "区域提报", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(SalesAreaReport salesAreaReport) { + List list = salesAreaReportService.selectSalesAreaReportList(salesAreaReport); + ExcelUtil util = new ExcelUtil(SalesAreaReport.class); + return util.exportExcel(list, "区域提报数据"); + } + + @PreAuthorize("@ss.hasPermi('system:report:query')") + @GetMapping(value = "/{reportId}") + public AjaxResult getInfo(@PathVariable("reportId") Long reportId) { + return success(salesAreaReportService.selectSalesAreaReportById(reportId)); + } + + @PreAuthorize("@ss.hasPermi('system:report:add')") + @Log(title = "区域提报", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SalesAreaReport salesAreaReport) { + return toAjax(salesAreaReportService.insertSalesAreaReport(salesAreaReport)); + } + + @PreAuthorize("@ss.hasPermi('system:report:edit')") + @Log(title = "区域提报", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SalesAreaReport salesAreaReport) { + return toAjax(salesAreaReportService.updateSalesAreaReport(salesAreaReport)); + } + + @PreAuthorize("@ss.hasPermi('system:report:remove')") + @Log(title = "区域提报", businessType = BusinessType.DELETE) + @DeleteMapping("/{reportIds}") + public AjaxResult remove(@PathVariable Long[] reportIds) { + return toAjax(salesAreaReportService.deleteSalesAreaReportByIds(reportIds)); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SalesAreaReport.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SalesAreaReport.java new file mode 100644 index 0000000..0c716cb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SalesAreaReport.java @@ -0,0 +1,119 @@ +package com.ruoyi.system.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import java.util.Date; + +public class SalesAreaReport extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 提报ID */ + @Excel(name = "提报ID") + private Long reportId; + + /** 产品大类编码 */ + @Excel(name = "产品大类编码") + private String productCategory; + + /** 产品大类名称 */ + @Excel(name = "产品大类名称") + private String productCategoryName; + + /** 销售区域编码 */ + @Excel(name = "销售区域编码") + private String salesAreaCode; + + /** 销售区域名称 */ + @Excel(name = "销售区域名称") + private String salesAreaName; + + /** 负责人ID */ + @Excel(name = "负责人ID") + private Long managerId; + + /** 负责人姓名 */ + @Excel(name = "负责人姓名") + private String managerName; + + /** 提报状态(0初始化 1已提交) */ + @Excel(name = "提报状态", readConverterExp = "0=初始化,1=已提交") + private String reportStatus; + + /** 提报时间 */ + @Excel(name = "提报时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date reportTime; + + // getter/setter方法 + public Long getReportId() { + return reportId; + } + + public void setReportId(Long reportId) { + this.reportId = reportId; + } + + public String getProductCategory() { + return productCategory; + } + + public void setProductCategory(String productCategory) { + this.productCategory = productCategory; + } + + public String getProductCategoryName() { + return productCategoryName; + } + + public void setProductCategoryName(String productCategoryName) { + this.productCategoryName = productCategoryName; + } + + public String getSalesAreaCode() { + return salesAreaCode; + } + + public void setSalesAreaCode(String salesAreaCode) { + this.salesAreaCode = salesAreaCode; + } + + public String getSalesAreaName() { + return salesAreaName; + } + + public void setSalesAreaName(String salesAreaName) { + this.salesAreaName = salesAreaName; + } + + public Long getManagerId() { + return managerId; + } + + public void setManagerId(Long managerId) { + this.managerId = managerId; + } + + public String getManagerName() { + return managerName; + } + + public void setManagerName(String managerName) { + this.managerName = managerName; + } + + public String getReportStatus() { + return reportStatus; + } + + public void setReportStatus(String reportStatus) { + this.reportStatus = reportStatus; + } + + public Date getReportTime() { + return reportTime; + } + + public void setReportTime(Date reportTime) { + this.reportTime = reportTime; + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SalesAreaReportMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SalesAreaReportMapper.java new file mode 100644 index 0000000..d3992c0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SalesAreaReportMapper.java @@ -0,0 +1,36 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.SalesAreaReport; +import java.util.List; + +public interface SalesAreaReportMapper { + /** + * 查询区域提报列表 + */ + public List selectSalesAreaReportList(SalesAreaReport salesAreaReport); + + /** + * 查询区域提报详细 + */ + public SalesAreaReport selectSalesAreaReportById(Long reportId); + + /** + * 新增区域提报 + */ + public int insertSalesAreaReport(SalesAreaReport salesAreaReport); + + /** + * 修改区域提报 + */ + public int updateSalesAreaReport(SalesAreaReport salesAreaReport); + + /** + * 删除区域提报 + */ + public int deleteSalesAreaReportById(Long reportId); + + /** + * 批量删除区域提报 + */ + public int deleteSalesAreaReportByIds(Long[] reportIds); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISalesAreaReportService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISalesAreaReportService.java new file mode 100644 index 0000000..b4e8d2e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISalesAreaReportService.java @@ -0,0 +1,31 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.SalesAreaReport; +import java.util.List; + +public interface ISalesAreaReportService { + /** + * 查询区域提报列表 + */ + public List selectSalesAreaReportList(SalesAreaReport salesAreaReport); + + /** + * 查询区域提报详细 + */ + public SalesAreaReport selectSalesAreaReportById(Long reportId); + + /** + * 新增区域提报 + */ + public int insertSalesAreaReport(SalesAreaReport salesAreaReport); + + /** + * 修改区域提报 + */ + public int updateSalesAreaReport(SalesAreaReport salesAreaReport); + + /** + * 删除区域提报信息 + */ + public int deleteSalesAreaReportByIds(Long[] reportIds); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SalesAreaReportServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SalesAreaReportServiceImpl.java new file mode 100644 index 0000000..83b51b8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SalesAreaReportServiceImpl.java @@ -0,0 +1,39 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SalesAreaReportMapper; +import com.ruoyi.system.domain.SalesAreaReport; +import com.ruoyi.system.service.ISalesAreaReportService; + +@Service +public class SalesAreaReportServiceImpl implements ISalesAreaReportService { + @Autowired + private SalesAreaReportMapper salesAreaReportMapper; + + @Override + public List selectSalesAreaReportList(SalesAreaReport salesAreaReport) { + return salesAreaReportMapper.selectSalesAreaReportList(salesAreaReport); + } + + @Override + public SalesAreaReport selectSalesAreaReportById(Long reportId) { + return salesAreaReportMapper.selectSalesAreaReportById(reportId); + } + + @Override + public int insertSalesAreaReport(SalesAreaReport salesAreaReport) { + return salesAreaReportMapper.insertSalesAreaReport(salesAreaReport); + } + + @Override + public int updateSalesAreaReport(SalesAreaReport salesAreaReport) { + return salesAreaReportMapper.updateSalesAreaReport(salesAreaReport); + } + + @Override + public int deleteSalesAreaReportByIds(Long[] reportIds) { + return salesAreaReportMapper.deleteSalesAreaReportByIds(reportIds); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SalesAreaReportMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SalesAreaReportMapper.xml new file mode 100644 index 0000000..c75af56 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SalesAreaReportMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + select report_id, product_category, product_category_name, sales_area_code, sales_area_name, + manager_id, manager_name, report_status, report_time, create_by, create_time, update_by, + update_time, remark + from sales_area_report + + + + + + + + insert into sales_area_report + + product_category, + product_category_name, + sales_area_code, + sales_area_name, + manager_id, + manager_name, + report_status, + report_time, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{productCategory}, + #{productCategoryName}, + #{salesAreaCode}, + #{salesAreaName}, + #{managerId}, + #{managerName}, + #{reportStatus}, + #{reportTime}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sales_area_report + + product_category = #{productCategory}, + product_category_name = #{productCategoryName}, + sales_area_code = #{salesAreaCode}, + sales_area_name = #{salesAreaName}, + manager_id = #{managerId}, + manager_name = #{managerName}, + report_status = #{reportStatus}, + report_time = #{reportTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where report_id = #{reportId} + + + + delete from sales_area_report where report_id = #{reportId} + + + + delete from sales_area_report where report_id in + + #{reportId} + + + \ No newline at end of file diff --git a/sql/gss/区域提报.sql b/sql/gss/区域提报.sql index e69de29..68f371c 100644 --- a/sql/gss/区域提报.sql +++ b/sql/gss/区域提报.sql @@ -0,0 +1,45 @@ +CREATE TABLE `sales_area_report` ( + `report_id` bigint NOT NULL AUTO_INCREMENT COMMENT '提报ID', + `product_category` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品大类编码', + `product_category_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品大类名称', + `sales_area_code` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '销售区域编码', + `sales_area_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '销售区域名称', + `manager_id` bigint NOT NULL COMMENT '负责人ID', + `manager_name` varchar(64) COLLATE utf8mb4_general_ci NOT NULL COMMENT '负责人姓名', + `report_status` char(1) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '提报状态(0初始化 1已提交)', + `report_time` datetime DEFAULT NULL COMMENT '提报时间', + `create_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`report_id`), + KEY `idx_product_category` (`product_category`), + KEY `idx_sales_area` (`sales_area_code`), + KEY `idx_manager` (`manager_id`), + KEY `idx_report_status` (`report_status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='区域提报表'; + +------------------------------------------------------------------------------------- +-- 菜单 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('区域提报', '3', '1', 'report', 'system/report/index', 1, 0, 'C', '0', '0', 'system:report:list', 'form', 'admin', sysdate(), '', null, '区域提报菜单'); + +-- 按钮父菜单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('区域提报查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'system:report: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('区域提报新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'system:report: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('区域提报修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'system:report: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('区域提报删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'system:report: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('区域提报导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'system:report:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file