Merge remote-tracking branch 'origin/release-v0.0.1' into release-v0.0.1
This commit is contained in:
commit
eb76717b36
8
pom.xml
8
pom.xml
|
|
@ -202,6 +202,13 @@
|
|||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 商业代码-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-business</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
@ -212,6 +219,7 @@
|
|||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-business</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,12 @@
|
|||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 商业代码-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-business</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://www.ks1.top:20336/Bizz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>4.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-business</artifactId>
|
||||
|
||||
<description>
|
||||
商业代码
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot集成thymeleaf模板 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
-- 菜单 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('产品', '2000', '1', '/business/product', 'C', '0', 'business:product:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '产品菜单');
|
||||
|
||||
-- 按钮父菜单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', 'business:product:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:product:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:product:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:product:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:product:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
-- 菜单 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('产品分类', '2000', '1', '/business/productType', 'C', '0', 'business:productType:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '产品分类菜单');
|
||||
|
||||
-- 按钮父菜单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', 'business:productType:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:productType:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:productType:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:productType:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
||||
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', 'business:productType:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
package com.ruoyi.business.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.business.domain.BizProductType;
|
||||
import com.ruoyi.business.service.IBizProductTypeService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
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.business.domain.BizProduct;
|
||||
import com.ruoyi.business.service.IBizProductService;
|
||||
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 2020-09-06
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/business/product")
|
||||
public class BizProductController extends BaseController
|
||||
{
|
||||
private String prefix = "business/product";
|
||||
|
||||
@Autowired
|
||||
private IBizProductService bizProductService;
|
||||
|
||||
@Autowired
|
||||
private IBizProductTypeService bizProductTypeService;
|
||||
|
||||
@RequiresPermissions("business:product:view")
|
||||
@GetMapping()
|
||||
public String product(ModelMap mmap)
|
||||
{
|
||||
mmap.put("productTypeList", bizProductTypeService.selectBizProductTypeList(new BizProductType()));
|
||||
return prefix + "/product";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@RequiresPermissions("business:product:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(BizProduct bizProduct)
|
||||
{
|
||||
startPage();
|
||||
List<BizProduct> list = bizProductService.selectBizProductList(bizProduct);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品列表
|
||||
*/
|
||||
@RequiresPermissions("business:product:export")
|
||||
@Log(title = "产品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(BizProduct bizProduct)
|
||||
{
|
||||
List<BizProduct> list = bizProductService.selectBizProductList(bizProduct);
|
||||
ExcelUtil<BizProduct> util = new ExcelUtil<BizProduct>(BizProduct.class);
|
||||
return util.exportExcel(list, "product");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
mmap.put("productTypeList", bizProductTypeService.selectBizProductTypeList(new BizProductType()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存产品
|
||||
*/
|
||||
@RequiresPermissions("business:product:add")
|
||||
@Log(title = "产品", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(BizProduct bizProduct)
|
||||
{
|
||||
Date now = new Date();
|
||||
bizProduct.setCreateBy(ShiroUtils.getLoginName());
|
||||
bizProduct.setCreateTime(now);
|
||||
bizProduct.setProductCode("BPD" + DateUtils.dateTimeNow("YYYYMMDDHHMMSSSSS"));
|
||||
//如果上架设置上架时间
|
||||
if (bizProduct.getOnlineStatus() == 1) {
|
||||
bizProduct.setOnlineTime(now);
|
||||
}
|
||||
return toAjax(bizProductService.insertBizProduct(bizProduct));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*/
|
||||
@GetMapping("/edit/{productId}")
|
||||
public String edit(@PathVariable(value = "productId", required = true) Long productId, ModelMap mmap)
|
||||
{
|
||||
BizProduct bizProduct = bizProductService.selectBizProductById(productId);
|
||||
mmap.put("bizProduct", bizProduct);
|
||||
mmap.put("productTypeList", bizProductTypeService.selectBizProductTypeList(new BizProductType()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存产品
|
||||
*/
|
||||
@RequiresPermissions("business:product:edit")
|
||||
@Log(title = "产品", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(BizProduct bizProduct)
|
||||
{
|
||||
bizProduct.setUpdateBy(ShiroUtils.getLoginName());
|
||||
bizProduct.setUpdateTime(new Date());
|
||||
return toAjax(bizProductService.updateBizProduct(bizProduct));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架下架产品
|
||||
*/
|
||||
@RequiresPermissions("business:product:edit")
|
||||
@Log(title = "产品", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/status")
|
||||
@ResponseBody
|
||||
public AjaxResult editStatus(@PathVariable(value = "productId", required = true) Long productID)
|
||||
{
|
||||
return toAjax(bizProductService.updateBizProductStatus(productID));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
*/
|
||||
@RequiresPermissions("business:product:remove")
|
||||
@Log(title = "产品", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(bizProductService.deleteBizProductByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.ruoyi.business.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
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.business.domain.BizProductType;
|
||||
import com.ruoyi.business.service.IBizProductTypeService;
|
||||
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 2020-09-05
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/business/productType")
|
||||
public class BizProductTypeController extends BaseController
|
||||
{
|
||||
private String prefix = "business/productType";
|
||||
|
||||
@Autowired
|
||||
private IBizProductTypeService bizProductTypeService;
|
||||
|
||||
@RequiresPermissions("business:productType:view")
|
||||
@GetMapping()
|
||||
public String productType()
|
||||
{
|
||||
return prefix + "/productType";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*/
|
||||
@RequiresPermissions("business:productType:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(BizProductType bizProductType)
|
||||
{
|
||||
startPage();
|
||||
List<BizProductType> list = bizProductTypeService.selectBizProductTypeList(bizProductType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品分类列表
|
||||
*/
|
||||
@RequiresPermissions("business:productType:export")
|
||||
@Log(title = "产品分类", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(BizProductType bizProductType)
|
||||
{
|
||||
List<BizProductType> list = bizProductTypeService.selectBizProductTypeList(bizProductType);
|
||||
ExcelUtil<BizProductType> util = new ExcelUtil<BizProductType>(BizProductType.class);
|
||||
return util.exportExcel(list, "productType");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存产品分类
|
||||
*/
|
||||
@RequiresPermissions("business:productType:add")
|
||||
@Log(title = "产品分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(BizProductType bizProductType)
|
||||
{
|
||||
bizProductType.setCreateBy(ShiroUtils.getLoginName());
|
||||
bizProductType.setCreateTime(new Date());
|
||||
bizProductType.setProductTypeCode("BPT" + DateUtils.dateTimeNow("YYYYMMDDHHMMSSSSS"));
|
||||
return toAjax(bizProductTypeService.insertBizProductType(bizProductType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*/
|
||||
@GetMapping("/edit/{productTypeId}")
|
||||
public String edit(@PathVariable(value = "productTypeId", required = true) Long productTypeId, ModelMap mmap)
|
||||
{
|
||||
BizProductType bizProductType = bizProductTypeService.selectBizProductTypeById(productTypeId);
|
||||
mmap.put("bizProductType", bizProductType);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存产品分类
|
||||
*/
|
||||
@RequiresPermissions("business:productType:edit")
|
||||
@Log(title = "产品分类", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(BizProductType bizProductType)
|
||||
{
|
||||
bizProductType.setUpdateBy(ShiroUtils.getLoginName());
|
||||
bizProductType.setUpdateTime(new Date());
|
||||
return toAjax(bizProductTypeService.updateBizProductType(bizProductType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品分类
|
||||
*/
|
||||
@RequiresPermissions("business:productType:remove")
|
||||
@Log(title = "产品分类", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(bizProductTypeService.deleteBizProductTypeByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
package com.ruoyi.business.domain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 产品对象 biz_product
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-06
|
||||
*/
|
||||
public class BizProduct extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 产品编码 */
|
||||
@Excel(name = "产品编码")
|
||||
private String productCode;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 产品分类ID */
|
||||
@Excel(name = "产品分类ID")
|
||||
private Long productTypeId;
|
||||
|
||||
/** 产品类型 */
|
||||
@Excel(name = "产品类型")
|
||||
private Integer productClass;
|
||||
|
||||
/** 产品单价 */
|
||||
@Excel(name = "产品单价")
|
||||
private Long amount;
|
||||
|
||||
/** 排序 */
|
||||
@Excel(name = "排序")
|
||||
private Long sort;
|
||||
|
||||
/** 是否上架 */
|
||||
@Excel(name = "是否上架")
|
||||
private Integer onlineStatus;
|
||||
|
||||
/** 上架时间 */
|
||||
@Excel(name = "上架时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date onlineTime;
|
||||
|
||||
/** 下架时间 */
|
||||
private Date offlineTime;
|
||||
|
||||
/** 产品图片信息 */
|
||||
private String mainImage;
|
||||
private List<String> detailImages;
|
||||
private List<String> loopImages;
|
||||
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductCode(String productCode)
|
||||
{
|
||||
this.productCode = productCode;
|
||||
}
|
||||
|
||||
public String getProductCode()
|
||||
{
|
||||
return productCode;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setProductTypeId(Long productTypeId)
|
||||
{
|
||||
this.productTypeId = productTypeId;
|
||||
}
|
||||
|
||||
public Long getProductTypeId()
|
||||
{
|
||||
return productTypeId;
|
||||
}
|
||||
public void setProductClass(Integer productClass)
|
||||
{
|
||||
this.productClass = productClass;
|
||||
}
|
||||
|
||||
public Integer getProductClass()
|
||||
{
|
||||
return productClass;
|
||||
}
|
||||
public void setAmount(Long amount)
|
||||
{
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Long getAmount()
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
public void setSort(Long sort)
|
||||
{
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Long getSort()
|
||||
{
|
||||
return sort;
|
||||
}
|
||||
public void setOnlineStatus(Integer onlineStatus)
|
||||
{
|
||||
this.onlineStatus = onlineStatus;
|
||||
}
|
||||
|
||||
public Integer getOnlineStatus()
|
||||
{
|
||||
return onlineStatus;
|
||||
}
|
||||
public void setOnlineTime(Date onlineTime)
|
||||
{
|
||||
this.onlineTime = onlineTime;
|
||||
}
|
||||
|
||||
public Date getOnlineTime()
|
||||
{
|
||||
return onlineTime;
|
||||
}
|
||||
public void setOfflineTime(Date offlineTime)
|
||||
{
|
||||
this.offlineTime = offlineTime;
|
||||
}
|
||||
|
||||
public Date getOfflineTime()
|
||||
{
|
||||
return offlineTime;
|
||||
}
|
||||
|
||||
public String getMainImage() {
|
||||
return mainImage;
|
||||
}
|
||||
|
||||
public void setMainImage(String mainImage) {
|
||||
this.mainImage = mainImage;
|
||||
}
|
||||
|
||||
public List<String> getDetailImages() {
|
||||
return detailImages;
|
||||
}
|
||||
|
||||
public void setDetailImages(List<String> detailImages) {
|
||||
this.detailImages = detailImages;
|
||||
}
|
||||
|
||||
public List<String> getLoopImages() {
|
||||
return loopImages;
|
||||
}
|
||||
|
||||
public void setLoopImages(List<String> loopImages) {
|
||||
this.loopImages = loopImages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("productId", getProductId())
|
||||
.append("productCode", getProductCode())
|
||||
.append("productName", getProductName())
|
||||
.append("productTypeId", getProductTypeId())
|
||||
.append("productClass", getProductClass())
|
||||
.append("amount", getAmount())
|
||||
.append("sort", getSort())
|
||||
.append("onlineStatus", getOnlineStatus())
|
||||
.append("onlineTime", getOnlineTime())
|
||||
.append("offlineTime", getOfflineTime())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.ruoyi.business.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 产品图片对象 biz_product_image
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-06
|
||||
*/
|
||||
public class BizProductImage extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品图片ID */
|
||||
private Long productImageId;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 附件类型:0-主图,1-详情图,2-轮播图 */
|
||||
private Integer imageType;
|
||||
|
||||
/** 附件地址 */
|
||||
private String imageUrl;
|
||||
|
||||
|
||||
public void setProductImageId(Long productImageId)
|
||||
{
|
||||
this.productImageId = productImageId;
|
||||
}
|
||||
|
||||
public Long getProductImageId()
|
||||
{
|
||||
return productImageId;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setImageType(Integer imageType)
|
||||
{
|
||||
this.imageType = imageType;
|
||||
}
|
||||
|
||||
public Integer getImageType() {
|
||||
return imageType;
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getImageUrl()
|
||||
{
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("productImageId", getProductImageId())
|
||||
.append("productId", getProductId())
|
||||
.append("imageUrl", getImageUrl())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.ruoyi.business.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 产品分类对象 biz_product_type
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-05
|
||||
*/
|
||||
public class BizProductType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品分类ID */
|
||||
private Long productTypeId;
|
||||
|
||||
/** 产品分类编码 */
|
||||
@Excel(name = "产品分类编码")
|
||||
private String productTypeCode;
|
||||
|
||||
/** 产品分类名称 */
|
||||
@Excel(name = "产品分类名称")
|
||||
private String productTypeName;
|
||||
|
||||
/** 附件地址 */
|
||||
private String imageUrl;
|
||||
|
||||
/** 排序 */
|
||||
@Excel(name = "排序")
|
||||
private Long sort;
|
||||
|
||||
/** 是否禁用:0-否,1-是 */
|
||||
@Excel(name = "是否禁用:0-否,1-是")
|
||||
private Integer isEnable;
|
||||
|
||||
public void setProductTypeId(Long productTypeId)
|
||||
{
|
||||
this.productTypeId = productTypeId;
|
||||
}
|
||||
|
||||
public Long getProductTypeId()
|
||||
{
|
||||
return productTypeId;
|
||||
}
|
||||
public void setProductTypeCode(String productTypeCode)
|
||||
{
|
||||
this.productTypeCode = productTypeCode;
|
||||
}
|
||||
|
||||
public String getProductTypeCode()
|
||||
{
|
||||
return productTypeCode;
|
||||
}
|
||||
public void setProductTypeName(String productTypeName)
|
||||
{
|
||||
this.productTypeName = productTypeName;
|
||||
}
|
||||
|
||||
public String getProductTypeName()
|
||||
{
|
||||
return productTypeName;
|
||||
}
|
||||
public void setImageUrl(String imageUrl)
|
||||
{
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getImageUrl()
|
||||
{
|
||||
return imageUrl;
|
||||
}
|
||||
public void setSort(Long sort)
|
||||
{
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Long getSort()
|
||||
{
|
||||
return sort;
|
||||
}
|
||||
public void setIsEnable(Integer isEnable)
|
||||
{
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public Integer getIsEnable()
|
||||
{
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("productTypeId", getProductTypeId())
|
||||
.append("productTypeCode", getProductTypeCode())
|
||||
.append("productTypeName", getProductTypeName())
|
||||
.append("imageUrl", getImageUrl())
|
||||
.append("sort", getSort())
|
||||
.append("isEnable", getIsEnable())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.BizProduct;
|
||||
import com.ruoyi.business.domain.BizProductImage;
|
||||
|
||||
/**
|
||||
* 产品Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-06
|
||||
*/
|
||||
public interface BizProductMapper
|
||||
{
|
||||
/**
|
||||
* 查询产品
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 产品
|
||||
*/
|
||||
public BizProduct selectBizProductById(Long productId);
|
||||
|
||||
/**
|
||||
* 查询产品图片列表
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 产品图片列表
|
||||
*/
|
||||
public List<BizProductImage> selectBizProductImageList(Long productId);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 产品集合
|
||||
*/
|
||||
public List<BizProduct> selectBizProductList(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizProduct(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizProduct(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductById(Long productId);
|
||||
|
||||
/**
|
||||
* 批量删除产品
|
||||
*
|
||||
* @param productIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductByIds(String[] productIds);
|
||||
|
||||
/**
|
||||
* 批量删除产品图片
|
||||
*
|
||||
* @param productIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductImageByProductIds(String[] productIds);
|
||||
|
||||
/**
|
||||
* 批量新增产品图片
|
||||
*
|
||||
* @param bizProductImageList 产品图片列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchBizProductImage(List<BizProductImage> bizProductImageList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过产品ID删除产品图片信息
|
||||
*
|
||||
* @param productId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductImageByProductId(Long productId);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.BizProductType;
|
||||
|
||||
/**
|
||||
* 产品分类Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-05
|
||||
*/
|
||||
public interface BizProductTypeMapper
|
||||
{
|
||||
/**
|
||||
* 查询产品分类
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 产品分类
|
||||
*/
|
||||
public BizProductType selectBizProductTypeById(Long productTypeId);
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<BizProductType> selectBizProductTypeList(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizProductType(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizProductType(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 删除产品分类
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductTypeById(Long productTypeId);
|
||||
|
||||
/**
|
||||
* 批量删除产品分类
|
||||
*
|
||||
* @param productTypeIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductTypeByIds(String[] productTypeIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.ruoyi.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.BizProduct;
|
||||
import com.ruoyi.business.domain.BizProductImage;
|
||||
|
||||
/**
|
||||
* 产品Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-06
|
||||
*/
|
||||
public interface IBizProductService
|
||||
{
|
||||
/**
|
||||
* 查询产品
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 产品
|
||||
*/
|
||||
public BizProduct selectBizProductById(Long productId);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 产品集合
|
||||
*/
|
||||
public List<BizProduct> selectBizProductList(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizProduct(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizProduct(BizProduct bizProduct);
|
||||
|
||||
/**
|
||||
* 上架下架产品
|
||||
*
|
||||
* @param productID 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizProductStatus(Long productID);
|
||||
|
||||
/**
|
||||
* 批量删除产品
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除产品信息
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductById(Long productId);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.BizProductType;
|
||||
|
||||
/**
|
||||
* 产品分类Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-05
|
||||
*/
|
||||
public interface IBizProductTypeService
|
||||
{
|
||||
/**
|
||||
* 查询产品分类
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 产品分类
|
||||
*/
|
||||
public BizProductType selectBizProductTypeById(Long productTypeId);
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<BizProductType> selectBizProductTypeList(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizProductType(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizProductType(BizProductType bizProductType);
|
||||
|
||||
/**
|
||||
* 批量删除产品分类
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductTypeByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除产品分类信息
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizProductTypeById(Long productTypeId);
|
||||
}
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
package com.ruoyi.business.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.utils.DictUtils;
|
||||
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.business.domain.BizProductImage;
|
||||
import com.ruoyi.business.mapper.BizProductMapper;
|
||||
import com.ruoyi.business.domain.BizProduct;
|
||||
import com.ruoyi.business.service.IBizProductService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 产品Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-06
|
||||
*/
|
||||
@Service
|
||||
public class BizProductServiceImpl implements IBizProductService
|
||||
{
|
||||
@Autowired
|
||||
private BizProductMapper bizProductMapper;
|
||||
|
||||
/**
|
||||
* 查询产品
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 产品
|
||||
*/
|
||||
@Override
|
||||
public BizProduct selectBizProductById(Long productId)
|
||||
{
|
||||
BizProduct bizProduct = bizProductMapper.selectBizProductById(productId);
|
||||
List<BizProductImage> imageList = bizProductMapper.selectBizProductImageList(productId);
|
||||
List<String> detailImages = new ArrayList<String>();
|
||||
List<String> loopImages = new ArrayList<String>();
|
||||
//取出商品三种图片数据
|
||||
for (BizProductImage image : imageList) {
|
||||
String url = image.getImageUrl();
|
||||
switch (image.getImageType()) {
|
||||
case 0:
|
||||
bizProduct.setMainImage(url);
|
||||
break;
|
||||
case 1:
|
||||
detailImages.add(url);
|
||||
break;
|
||||
case 2:
|
||||
loopImages.add(url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bizProduct.setDetailImages(detailImages);
|
||||
bizProduct.setLoopImages(loopImages);
|
||||
return bizProduct;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 产品
|
||||
*/
|
||||
@Override
|
||||
public List<BizProduct> selectBizProductList(BizProduct bizProduct)
|
||||
{
|
||||
return bizProductMapper.selectBizProductList(bizProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertBizProduct(BizProduct bizProduct)
|
||||
{
|
||||
bizProduct.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = bizProductMapper.insertBizProduct(bizProduct);
|
||||
insertBizProductImage(bizProduct);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*
|
||||
* @param bizProduct 产品
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateBizProduct(BizProduct bizProduct)
|
||||
{
|
||||
bizProduct.setUpdateTime(DateUtils.getNowDate());
|
||||
bizProductMapper.deleteBizProductImageByProductId(bizProduct.getProductId());
|
||||
insertBizProductImage(bizProduct);
|
||||
return bizProductMapper.updateBizProduct(bizProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架下架产品
|
||||
*
|
||||
* @param productID 产品
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateBizProductStatus(Long productID)
|
||||
{
|
||||
BizProduct bizProduct = bizProductMapper.selectBizProductById(productID);
|
||||
Date now = new Date();
|
||||
switch (bizProduct.getOnlineStatus())
|
||||
{
|
||||
case 0:
|
||||
bizProduct.setOnlineTime(now);
|
||||
bizProduct.setOnlineStatus(1);
|
||||
break;
|
||||
case 1:
|
||||
bizProduct.setOfflineTime(now);
|
||||
bizProduct.setOnlineStatus(0);
|
||||
break;
|
||||
}
|
||||
return bizProductMapper.updateBizProduct(bizProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteBizProductByIds(String ids)
|
||||
{
|
||||
bizProductMapper.deleteBizProductImageByProductIds(Convert.toStrArray(ids));
|
||||
return bizProductMapper.deleteBizProductByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品信息
|
||||
*
|
||||
* @param productId 产品ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBizProductById(Long productId)
|
||||
{
|
||||
bizProductMapper.deleteBizProductImageByProductId(productId);
|
||||
return bizProductMapper.deleteBizProductById(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品图片信息
|
||||
*
|
||||
* @param bizProduct 产品对象
|
||||
*/
|
||||
public void insertBizProductImage(BizProduct bizProduct)
|
||||
{
|
||||
List<String> detailImages = bizProduct.getDetailImages();
|
||||
List<String> loopImages = bizProduct.getLoopImages();
|
||||
String mainImage = bizProduct.getMainImage();
|
||||
Long productId = bizProduct.getProductId();
|
||||
List<BizProductImage> list = new ArrayList<BizProductImage>();
|
||||
//插入三类产品图片
|
||||
if (StringUtils.isNotEmpty(mainImage)) {
|
||||
list.add(getInsertProductImage(productId, 0, mainImage));
|
||||
}
|
||||
if (StringUtils.isNotNull(detailImages)) {
|
||||
for (String url : detailImages) {
|
||||
list.add(getInsertProductImage(productId, 1, url));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotNull(loopImages)) {
|
||||
for (String url : loopImages) {
|
||||
list.add(getInsertProductImage(productId, 2, url));
|
||||
}
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
bizProductMapper.batchBizProductImage(list);
|
||||
}
|
||||
}
|
||||
|
||||
//新增企业图片
|
||||
public BizProductImage getInsertProductImage(Long productId, Integer type, String url) {
|
||||
BizProductImage productImage = new BizProductImage();
|
||||
productImage.setProductId(productId);
|
||||
productImage.setImageType(type);
|
||||
productImage.setImageUrl(url);
|
||||
return productImage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.ruoyi.business.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.business.mapper.BizProductTypeMapper;
|
||||
import com.ruoyi.business.domain.BizProductType;
|
||||
import com.ruoyi.business.service.IBizProductTypeService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 产品分类Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-05
|
||||
*/
|
||||
@Service
|
||||
public class BizProductTypeServiceImpl implements IBizProductTypeService
|
||||
{
|
||||
@Autowired
|
||||
private BizProductTypeMapper bizProductTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询产品分类
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 产品分类
|
||||
*/
|
||||
@Override
|
||||
public BizProductType selectBizProductTypeById(Long productTypeId)
|
||||
{
|
||||
return bizProductTypeMapper.selectBizProductTypeById(productTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 产品分类
|
||||
*/
|
||||
@Override
|
||||
public List<BizProductType> selectBizProductTypeList(BizProductType bizProductType)
|
||||
{
|
||||
return bizProductTypeMapper.selectBizProductTypeList(bizProductType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBizProductType(BizProductType bizProductType)
|
||||
{
|
||||
bizProductType.setCreateTime(DateUtils.getNowDate());
|
||||
return bizProductTypeMapper.insertBizProductType(bizProductType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*
|
||||
* @param bizProductType 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBizProductType(BizProductType bizProductType)
|
||||
{
|
||||
bizProductType.setUpdateTime(DateUtils.getNowDate());
|
||||
return bizProductTypeMapper.updateBizProductType(bizProductType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品分类对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBizProductTypeByIds(String ids)
|
||||
{
|
||||
return bizProductTypeMapper.deleteBizProductTypeByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品分类信息
|
||||
*
|
||||
* @param productTypeId 产品分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBizProductTypeById(Long productTypeId)
|
||||
{
|
||||
return bizProductTypeMapper.deleteBizProductTypeById(productTypeId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.business.mapper.BizProductMapper">
|
||||
|
||||
<resultMap type="BizProduct" id="BizProductResult">
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="productTypeId" column="product_type_id" />
|
||||
<result property="productClass" column="product_class" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="onlineStatus" column="online_status" />
|
||||
<result property="onlineTime" column="online_time" />
|
||||
<result property="offlineTime" column="offline_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="BizProductImage" id="BizProductImageResult">
|
||||
<result property="productImageId" column="product_image_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="imageType" column="image_type" />
|
||||
<result property="imageUrl" column="image_url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBizProductVo">
|
||||
select product_id, product_code, product_name, product_type_id, product_class, amount, sort, online_status, online_time, offline_time, remark, create_by, create_time, update_by, update_time from biz_product
|
||||
</sql>
|
||||
|
||||
<select id="selectBizProductList" parameterType="BizProduct" resultMap="BizProductResult">
|
||||
<include refid="selectBizProductVo"/>
|
||||
<where>
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="productTypeId != null "> and product_type_id = #{productTypeId}</if>
|
||||
<if test="productClass != null "> and product_class = #{productClass}</if>
|
||||
</where>
|
||||
order by sort desc, product_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectBizProductById" parameterType="Long" resultMap="BizProductResult">
|
||||
<include refid="selectBizProductVo"/>
|
||||
where product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectBizProductImageList" parameterType="Long" resultMap="BizProductImageResult">
|
||||
select product_image_id, product_id, image_type, b.image_url
|
||||
from biz_product_image
|
||||
where product_id = #{productId}
|
||||
order by product_image_id
|
||||
</select>
|
||||
|
||||
<insert id="insertBizProduct" parameterType="BizProduct" useGeneratedKeys="true" keyProperty="productId">
|
||||
insert into biz_product
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productCode != null and productCode != ''">product_code,</if>
|
||||
<if test="productName != null and productName != ''">product_name,</if>
|
||||
<if test="productTypeId != null">product_type_id,</if>
|
||||
<if test="productClass != null">product_class,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
<if test="onlineStatus != null">online_status,</if>
|
||||
<if test="onlineTime != null">online_time,</if>
|
||||
<if test="offlineTime != null">offline_time,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productCode != null and productCode != ''">#{productCode},</if>
|
||||
<if test="productName != null and productName != ''">#{productName},</if>
|
||||
<if test="productTypeId != null">#{productTypeId},</if>
|
||||
<if test="productClass != null">#{productClass},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
<if test="onlineStatus != null">#{onlineStatus},</if>
|
||||
<if test="onlineTime != null">#{onlineTime},</if>
|
||||
<if test="offlineTime != null">#{offlineTime},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBizProduct" parameterType="BizProduct">
|
||||
update biz_product
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
|
||||
<if test="productName != null and productName != ''">product_name = #{productName},</if>
|
||||
<if test="productTypeId != null">product_type_id = #{productTypeId},</if>
|
||||
<if test="productClass != null">product_class = #{productClass},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="sort != null">sort = #{sort},</if>
|
||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
||||
<if test="onlineTime != null">online_time = #{onlineTime},</if>
|
||||
<if test="offlineTime != null">offline_time = #{offlineTime},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBizProductById" parameterType="Long">
|
||||
delete from biz_product where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBizProductByIds" parameterType="String">
|
||||
delete from biz_product where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBizProductImageByProductIds" parameterType="String">
|
||||
delete from biz_product_image where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBizProductImageByProductId" parameterType="Long">
|
||||
delete from biz_product_image where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchBizProductImage">
|
||||
insert into biz_product_image( product_id, image_type, image_url ) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.productId}, #{item.imageType}, #{item.imageUrl} )
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.business.mapper.BizProductTypeMapper">
|
||||
|
||||
<resultMap type="BizProductType" id="BizProductTypeResult">
|
||||
<result property="productTypeId" column="product_type_id" />
|
||||
<result property="productTypeCode" column="product_type_code" />
|
||||
<result property="productTypeName" column="product_type_name" />
|
||||
<result property="imageUrl" column="image_url" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="isEnable" column="is_enable" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBizProductTypeVo">
|
||||
select product_type_id, product_type_code, product_type_name, image_url, sort, is_enable, create_by, create_time, update_by, update_time from biz_product_type
|
||||
</sql>
|
||||
|
||||
<select id="selectBizProductTypeList" parameterType="BizProductType" resultMap="BizProductTypeResult">
|
||||
<include refid="selectBizProductTypeVo"/>
|
||||
<where>
|
||||
<if test="productTypeName != null and productTypeName != ''"> and product_type_name like concat('%', #{productTypeName}, '%')</if>
|
||||
<if test="isEnable != null "> and is_enable = #{isEnable}</if>
|
||||
</where>
|
||||
order by sort desc, product_type_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectBizProductTypeById" parameterType="Long" resultMap="BizProductTypeResult">
|
||||
<include refid="selectBizProductTypeVo"/>
|
||||
where product_type_id = #{productTypeId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBizProductType" parameterType="BizProductType" useGeneratedKeys="true" keyProperty="productTypeId">
|
||||
insert into biz_product_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productTypeCode != null">product_type_code,</if>
|
||||
<if test="productTypeName != null and productTypeName != ''">product_type_name,</if>
|
||||
<if test="imageUrl != null and imageUrl != ''">image_url,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
<if test="isEnable != null">is_enable,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productTypeCode != null">#{productTypeCode},</if>
|
||||
<if test="productTypeName != null and productTypeName != ''">#{productTypeName},</if>
|
||||
<if test="imageUrl != null and imageUrl != ''">#{imageUrl},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
<if test="isEnable != null">#{isEnable},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBizProductType" parameterType="BizProductType">
|
||||
update biz_product_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productTypeCode != null">product_type_code = #{productTypeCode},</if>
|
||||
<if test="productTypeName != null and productTypeName != ''">product_type_name = #{productTypeName},</if>
|
||||
<if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
|
||||
<if test="sort != null">sort = #{sort},</if>
|
||||
<if test="isEnable != null">is_enable = #{isEnable},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where product_type_id = #{productTypeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBizProductTypeById" parameterType="Long">
|
||||
delete from biz_product_type where product_type_id = #{productTypeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBizProductTypeByIds" parameterType="String">
|
||||
delete from biz_product_type where product_type_id in
|
||||
<foreach item="productTypeId" collection="array" open="(" separator="," close=")">
|
||||
#{productTypeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增产品')" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<form class="form-horizontal m" id="form-product-add">
|
||||
<div class="tabs-container">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">1产品基础信息</a>
|
||||
</li>
|
||||
<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">2产品相关图片</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="productName" class="form-control" type="text" required maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="productTypeId" class="form-control m-b" required>
|
||||
<option th:each="ptype:${productTypeList}" th:value="*{ptype.productTypeId}" th:text="*{ptype.productTypeName}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="productClass" class="form-control m-b" required>
|
||||
<option th:each="dict:${@dict.getType('busi_product_class')}" th:value="*{dict.dictCode}" th:text="*{dict.dictLabel}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品单价:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="amount" class="form-control" type="text" required digits="true" min="0" max="100000">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sort" class="form-control" type="text" digits="true" min="0" max="100">
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 排序数字越大排列越靠前</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否上架:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="onlineStatus" value="1">
|
||||
<label th:for="onlineStatus" th:text="是"></label>
|
||||
</div>
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="onlineStatus" checked value="0">
|
||||
<label th:for="onlineStatus" th:text="否"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control" required maxlength="80"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-2" class="tab-pane">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品主图:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="mainImage">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="mainImage" name="file" type="file">
|
||||
</div>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只能上传png jpg gif图片且大小不能超过200KB</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品详情图(最多20张):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="detailImages" multiple name="file" type="file">
|
||||
</div>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只能上传png jpg gif图片且大小不能超过200KB</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品轮播图(最多5张):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="loopImages" multiple name="file" type="file">
|
||||
</div>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只能上传png jpg gif图片且大小不能超过200KB</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<style>
|
||||
.file-drop-zone-title{padding:45px 10px}
|
||||
.file-thumbnail-footer{height:30px !important;}
|
||||
.file-footer-caption{margin-bottom:0 !important;}
|
||||
.kv-file-content{width: 150px !important;height: 100px !important;}
|
||||
</style>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "business/product"
|
||||
$("#form-product-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
var detailImagesArr = [];
|
||||
var loopImagesArr = [];
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
let saveData = $('#form-product-add').serialize();
|
||||
if(detailImagesArr.length > 0){
|
||||
detailImagesArr.forEach((url)=>saveData += "&detailImages=" + url);
|
||||
}
|
||||
if(loopImagesArr.length > 0){
|
||||
loopImagesArr.forEach((url)=>saveData += "&loopImages=" + url);
|
||||
}
|
||||
$.operate.save(prefix + "/add", saveData);
|
||||
}
|
||||
}
|
||||
|
||||
$("#mainImage").fileinput({
|
||||
uploadUrl: '/common/upload',
|
||||
maxFileCount: 1,
|
||||
maxFileSize: 200,
|
||||
allowedFileTypes: ['image'],
|
||||
allowedFileExtensions: ['jpg','png','gif','jpeg'],
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
});
|
||||
|
||||
$("#detailImages").fileinput({
|
||||
uploadUrl: '/common/upload',
|
||||
maxFileCount: 20,
|
||||
maxFilesNum : 20,
|
||||
maxFileSize: 200,
|
||||
allowedFileTypes: ['image'],
|
||||
allowedFileExtensions: ['jpg','png','gif','jpeg']
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
detailImagesArr.push(data.response.url);
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
detailImagesArr.splice(detailImagesArr.indexOf(data.response.url), 1);
|
||||
});
|
||||
|
||||
$("#loopImages").fileinput({
|
||||
uploadUrl: '/common/upload',
|
||||
maxFileCount: 5,
|
||||
maxFilesNum : 5,
|
||||
maxFileSize: 200,
|
||||
allowedFileTypes: ['image'],
|
||||
allowedFileExtensions: ['jpg','png','gif','jpeg']
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
loopImagesArr.push(data.response.url);
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
loopImagesArr.splice(loopImagesArr.indexOf(data.response.url), 1);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改产品')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-product-edit" th:object="${bizProduct}">
|
||||
<h4 class="form-header h4">产品信息</h4>
|
||||
<input name="productId" th:field="*{productId}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="productName" th:field="*{productName}" class="form-control" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="productTypeId" class="form-control m-b" required>
|
||||
<option value="">所有</option>
|
||||
</select>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="productClass" class="form-control m-b" required>
|
||||
<option value="">所有</option>
|
||||
</select>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品单价:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="amount" th:field="*{amount}" class="form-control" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sort" th:field="*{sort}" class="form-control" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否上架:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="check-box">
|
||||
<input name="onlineStatus" type="checkbox" required> 无
|
||||
</label>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="remark" th:field="*{remark}" class="form-control" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">产品图片信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "business/product";
|
||||
$("#form-product-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-product-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
data: [[${bizProduct.bizProductImageList}]],
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
return columnIndex + $.table.serialNumber(index);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'imageType',
|
||||
align: 'center',
|
||||
title: '附件类型:0-主图,1-详情图,2-轮播图',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].imageType' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'imageName',
|
||||
align: 'center',
|
||||
title: '附件名称',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].imageName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'imageUrl',
|
||||
align: 'center',
|
||||
title: '附件地址',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].imageUrl' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
align: 'center',
|
||||
title: '创建者',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].createBy' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
title: '创建时间',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].createTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'updateBy',
|
||||
align: 'center',
|
||||
title: '更新者',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].updateBy' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
align: 'center',
|
||||
title: '更新时间',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='bizProductImageList[%s].updateTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function addColumn() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
sub.editColumn();
|
||||
|
||||
$("#" + table.options.id).bootstrapTable('insertRow', {
|
||||
index: count,
|
||||
row: {
|
||||
index: $.table.serialNumber(count),
|
||||
imageType: "",
|
||||
imageName: "",
|
||||
imageUrl: "",
|
||||
createBy: "",
|
||||
createTime: "",
|
||||
updateBy: "",
|
||||
updateTime: ""
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('产品列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>产品名称:</label>
|
||||
<input type="text" name="productName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>产品类型:</label>
|
||||
<select name="productClass">
|
||||
<option value="">所有</option>
|
||||
<option class="classOption" th:each="dict:${@dict.getType('busi_product_class')}" th:value="*{dict.dictCode}" th:text="*{dict.dictLabel}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>产品分类:</label>
|
||||
<select name="productTypeId">
|
||||
<option value="">所有</option>
|
||||
<option class="typeOption" th:each="ptype:${productTypeList}" th:value="*{ptype.productTypeId}" th:text="*{ptype.productTypeName}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="business:product:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:product:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:product:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:product:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('business:product:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('business:product:remove')}]];
|
||||
var prefix = ctx + "business/product";
|
||||
//取产品分类和类型数据
|
||||
var typeDict = {};
|
||||
$(".typeOption").each(function(){typeDict[$(this).val()] = $(this).text()});
|
||||
var classDict = {};
|
||||
$(".classOption").each(function(){classDict[$(this).val()] = $(this).text()});
|
||||
|
||||
//上架或下架
|
||||
function productStatusEdit(productID, status){
|
||||
$.modal.confirm("确认要将该产品" + (status ? "下" : "上") + "架吗?", function() {
|
||||
$.operate.post(prefix + "/status", {
|
||||
productID:productID
|
||||
}, function(response){
|
||||
if(response.code == 0){
|
||||
$.modal.alertSuccess('操作成功!')
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "产品",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'productId',
|
||||
title: '产品ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'productCode',
|
||||
title: '产品编码'
|
||||
},
|
||||
{
|
||||
field: 'productName',
|
||||
title: '产品名称'
|
||||
},
|
||||
{
|
||||
field: 'productTypeId',
|
||||
title: '产品分类',
|
||||
formatter: function(value, row, index) {
|
||||
return typeDict[value];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'productClass',
|
||||
title: '产品类型',
|
||||
formatter: function(value, row, index) {
|
||||
return classDict[value];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'amount',
|
||||
title: '产品单价'
|
||||
},
|
||||
{
|
||||
field: 'sort',
|
||||
title: '排序'
|
||||
},
|
||||
{
|
||||
field: 'onlineStatus',
|
||||
title: '产品状态',
|
||||
formatter: function(value, row, index) {
|
||||
return "<span style='color:" + (value ? "#00FF00" :"#999999") + "'>" + ((value ? "上架中" :"已下架")) + "</span>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'onlineTime',
|
||||
title: '上架时间'
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '产品描述'
|
||||
},
|
||||
{
|
||||
field: 'onlineStatus',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-' + (value ? 'warning' : 'primary') + ' btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="productStatusEdit(\'' + row.productId + '\', ' + value + ')"><i class="fa fa-' + (value ? 'level-down' : 'level-up') + '"></i>' + (value ? '下架' : '上架') + '</a> ');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.productId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.productId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增产品分类')" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-productType-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品分类名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="productTypeName" class="form-control" type="text" required maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">附件地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="imageUrl">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="imageUrl" name="file" type="file">
|
||||
</div>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只能上传png jpg gif图片且大小不能超过200KB</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sort" class="form-control" type="text" required digits="true" min="0" max="100">
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 排序数字越大排列越靠前</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否禁用:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="isEnable" value="1">
|
||||
<label th:for="isEnable" th:text="是"></label>
|
||||
</div>
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="isEnable" checked value="0">
|
||||
<label th:for="isEnable" th:text="否"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "business/productType"
|
||||
$("#form-productType-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-productType-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(".file-upload").fileinput({
|
||||
uploadUrl: '/common/upload',
|
||||
maxFileCount: 1,
|
||||
maxFileSize: 200,
|
||||
allowedFileTypes: ['image'],
|
||||
allowedFileExtensions: ['jpg','png','gif','jpeg'],
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改产品分类')" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-productType-edit" th:object="${bizProductType}">
|
||||
<input name="productTypeId" th:field="*{productTypeId}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">产品分类名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="productTypeName" th:field="*{productTypeName}" class="form-control" type="text" required maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">附件地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="imageUrl" th:field="*{imageUrl}">
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="imageUrl" name="file" type="file">
|
||||
</div>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只能上传png jpg gif图片且大小不能超过200KB</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sort" th:field="*{sort}" class="form-control" type="text" required digits="true" min="0" max="100">
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 排序数字越大排列越靠前</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否禁用:0-否,1-是:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="isEnable" th:checked="*{isEnable==1}" value="1">
|
||||
<label th:for="isEnable" th:text="是"></label>
|
||||
</div>
|
||||
<div class="radio-box">
|
||||
<input type="radio" name="isEnable" th:checked="*{isEnable==0}" value="0">
|
||||
<label th:for="isEnable" th:text="否"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "business/productType";
|
||||
$("#form-productType-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-productType-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val()
|
||||
$(this).fileinput({
|
||||
'uploadUrl': '/common/upload',
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: [val],
|
||||
maxFileCount: 1,
|
||||
maxFileSize: 200,
|
||||
allowedFileTypes: ['image'],
|
||||
allowedFileExtensions: ['jpg','png','gif','jpeg'],
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
$(this).fileinput('_initFileActions');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('产品分类列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>名称:</label>
|
||||
<input type="text" name="productTypeName"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="business:productType:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:productType:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:productType:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:productType:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('business:productType:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('business:productType:remove')}]];
|
||||
var prefix = ctx + "business/productType";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "产品分类",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'productTypeId',
|
||||
title: '产品分类ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'productTypeCode',
|
||||
title: '产品分类编码'
|
||||
},
|
||||
{
|
||||
field: 'productTypeName',
|
||||
title: '产品分类名称'
|
||||
},
|
||||
{
|
||||
field: 'sort',
|
||||
title: '排序'
|
||||
},
|
||||
{
|
||||
field: 'isEnable',
|
||||
title: '是否禁用',
|
||||
formatter: function(value, row, index) {
|
||||
return "<span style='color:" + (value == 1 ? "#FF0000" :"#00FF00") + "'>" + ((value == 1 ? "禁用" :"启用")) + "</span>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '创建者'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.productTypeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.productTypeId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue