Merge remote-tracking branch 'origin/release-v0.0.1' into release-v0.0.1

This commit is contained in:
bei.wu 2020-09-08 23:16:42 +08:00
commit a0cf596da0
4 changed files with 204 additions and 182 deletions

View File

@ -40,6 +40,10 @@ public class BizProduct extends BaseEntity
@Excel(name = "产品单价") @Excel(name = "产品单价")
private Long amount; private Long amount;
/** 产品返现 */
@Excel(name = "产品单价")
private Long cashbackAmount;
/** 排序 */ /** 排序 */
@Excel(name = "排序") @Excel(name = "排序")
private Long sort; private Long sort;
@ -119,6 +123,14 @@ public class BizProduct extends BaseEntity
this.sort = sort; this.sort = sort;
} }
public Long getCashbackAmount() {
return cashbackAmount;
}
public void setCashbackAmount(Long cashbackAmount) {
this.cashbackAmount = cashbackAmount;
}
public Long getSort() public Long getSort()
{ {
return sort; return sort;

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productTypeId" column="product_type_id" /> <result property="productTypeId" column="product_type_id" />
<result property="productClass" column="product_class" /> <result property="productClass" column="product_class" />
<result property="amount" column="amount" /> <result property="amount" column="amount" />
<result property="cashbackAmount" column="cashback_amount" />
<result property="sort" column="sort" /> <result property="sort" column="sort" />
<result property="onlineStatus" column="online_status" /> <result property="onlineStatus" column="online_status" />
<result property="onlineTime" column="online_time" /> <result property="onlineTime" column="online_time" />
@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectBizProductVo"> <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 select product_id, product_code, product_name, product_type_id, product_class, amount, cashback_amount, sort, online_status, online_time, offline_time, remark, create_by, create_time, update_by, update_time from biz_product
</sql> </sql>
<select id="selectBizProductList" parameterType="BizProduct" resultMap="BizProductResult"> <select id="selectBizProductList" parameterType="BizProduct" resultMap="BizProductResult">
@ -49,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectBizProductImageList" parameterType="Long" resultMap="BizProductImageResult"> <select id="selectBizProductImageList" parameterType="Long" resultMap="BizProductImageResult">
select product_image_id, product_id, image_type, b.image_url select product_image_id, product_id, image_type, image_url
from biz_product_image from biz_product_image
where product_id = #{productId} where product_id = #{productId}
order by product_image_id order by product_image_id
@ -63,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeId != null">product_type_id,</if> <if test="productTypeId != null">product_type_id,</if>
<if test="productClass != null">product_class,</if> <if test="productClass != null">product_class,</if>
<if test="amount != null">amount,</if> <if test="amount != null">amount,</if>
<if test="cashbackAmount != null">cashback_amount,</if>
<if test="sort != null">sort,</if> <if test="sort != null">sort,</if>
<if test="onlineStatus != null">online_status,</if> <if test="onlineStatus != null">online_status,</if>
<if test="onlineTime != null">online_time,</if> <if test="onlineTime != null">online_time,</if>
@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeId != null">#{productTypeId},</if> <if test="productTypeId != null">#{productTypeId},</if>
<if test="productClass != null">#{productClass},</if> <if test="productClass != null">#{productClass},</if>
<if test="amount != null">#{amount},</if> <if test="amount != null">#{amount},</if>
<if test="cashbackAmount != null">#{cashbackAmount},</if>
<if test="sort != null">#{sort},</if> <if test="sort != null">#{sort},</if>
<if test="onlineStatus != null">#{onlineStatus},</if> <if test="onlineStatus != null">#{onlineStatus},</if>
<if test="onlineTime != null">#{onlineTime},</if> <if test="onlineTime != null">#{onlineTime},</if>
@ -99,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeId != null">product_type_id = #{productTypeId},</if> <if test="productTypeId != null">product_type_id = #{productTypeId},</if>
<if test="productClass != null">product_class = #{productClass},</if> <if test="productClass != null">product_class = #{productClass},</if>
<if test="amount != null">amount = #{amount},</if> <if test="amount != null">amount = #{amount},</if>
<if test="cashbackAmount != null">cashback_amount = #{cashbackAmount},</if>
<if test="sort != null">sort = #{sort},</if> <if test="sort != null">sort = #{sort},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if> <if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="onlineTime != null">online_time = #{onlineTime},</if> <if test="onlineTime != null">online_time = #{onlineTime},</if>

View File

@ -44,6 +44,12 @@
<input name="amount" class="form-control" type="text" required digits="true" min="0" max="100000"> <input name="amount" class="form-control" type="text" required digits="true" min="0" max="100000">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">产品返现金额:</label>
<div class="col-sm-8">
<input name="cashbackAmount" class="form-control" type="text" required digits="true" min="0" max="100000">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">排序:</label> <label class="col-sm-3 control-label is-required">排序:</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -2,195 +2,195 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('修改产品')" /> <th:block th:include="include :: header('修改产品')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-product-edit" >
<form class="form-horizontal m" id="form-product-edit" th:object="${bizProduct}"> <input name="productId" th:field="*{bizProduct.productId}" type="hidden">
<h4 class="form-header h4">产品信息</h4> <input id="hiddenDetail" th:value="*{bizProduct.detailImages}" type="hidden">
<input name="productId" th:field="*{productId}" type="hidden"> <input id="hiddenLoop" th:value="*{bizProduct.loopImages}" type="hidden">
<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"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品名称:</label> <label class="col-sm-3 control-label is-required">产品名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="productName" th:field="*{productName}" class="form-control" type="text" required> <input name="productName" th:field="*{bizProduct.productName}" class="form-control" type="text" required maxlength="20">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品分类:</label> <label class="col-sm-3 control-label is-required">产品分类:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="productTypeId" class="form-control m-b" required> <select th:field="*{bizProduct.productTypeId}" name="productTypeId" class="form-control m-b" required>
<option value="">所有</option> <option th:each="ptype:${productTypeList}" th:value="*{ptype.productTypeId}" th:text="*{ptype.productTypeName}"></option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品类型:</label> <label class="col-sm-3 control-label is-required">产品类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="productClass" class="form-control m-b" required> <select th:field="*{bizProduct.productClass}" name="productClass" class="form-control m-b" required>
<option value="">所有</option> <option th:each="dict:${@dict.getType('busi_product_class')}" th:value="*{dict.dictCode}" th:text="*{dict.dictLabel}"></option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品单价:</label> <label class="col-sm-3 control-label is-required">产品单价:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="amount" th:field="*{amount}" class="form-control" type="text" required> <input name="amount" th:field="*{bizProduct.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="cashbackAmount" th:field="*{bizProduct.cashbackAmount}" class="form-control" type="text" required digits="true" min="0" max="100000">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">排序:</label> <label class="col-sm-3 control-label is-required">排序:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="sort" th:field="*{sort}" class="form-control" type="text" required> <input name="sort" th:field="*{bizProduct.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> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">是否上架:</label> <label class="col-sm-3 control-label">是否上架:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<label class="check-box"> <div class="radio-box">
<input name="onlineStatus" type="checkbox" required> <input type="radio" name="onlineStatus" th:checked="*{bizProduct.onlineStatus==1}" value="1">
</label> <label th:for="onlineStatus" th:text="是"></label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span> </div>
<div class="radio-box">
<input type="radio" name="onlineStatus" th:checked="*{bizProduct.onlineStatus==0}" value="0">
<label th:for="onlineStatus" th:text="否"></label>
</div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品描述:</label> <label class="col-sm-3 control-label is-required">产品描述:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text" required> <textarea name="remark" th:field="*{bizProduct.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" th:value="*{bizProduct.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>
<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> </div>
</div> </div>
</form> </form>
</div> <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 :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "business/product"; var prefix = ctx + "business/product";
$("#form-product-edit").validate({ $("#form-product-edit").validate({
focusCleanup: true focusCleanup: true
}); });
var detailStr = $("#hiddenDetail").val().replace(/[\[\]]/g, "");
var loopStr = $("#hiddenLoop").val().replace(/[\[\]]/g, "");
var detailImagesArr = detailStr.length ? detailStr.split(",") : [];
var loopImagesArr = loopStr.length ? loopStr.split(",") : [];
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-product-edit').serialize()); let saveData = $('#form-product-edit').serialize();
if(detailImagesArr.length > 0){
detailImagesArr.forEach((url)=>saveData += "&detailImages=" + url);
}
if(loopImagesArr.length > 0){
loopImagesArr.forEach((url)=>saveData += "&loopImages=" + url);
}
$.operate.save(prefix + "/edit", saveData);
} }
} }
$(function() { $("#mainImage").fileinput({
var options = { uploadUrl: '/common/upload',
data: [[${bizProduct.bizProductImageList}]], initialPreviewAsData: true,
pagination: false, initialPreview: [$("input[name=mainImage]").val()],
showSearch: false, maxFileCount: 1,
showRefresh: false, maxFileSize: 200,
showToggle: false, allowedFileTypes: ['image'],
showColumns: false, allowedFileExtensions: ['jpg','png','gif','jpeg'],
sidePagination: "client", autoReplace: true
columns: [{ }).on('fileuploaded', function (event, data, previewId, index) {
checkbox: true $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}, }).on('fileremoved', function (event, id, index) {
{ $("input[name='" + event.currentTarget.id + "']").val('')
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() { $("#detailImages").fileinput({
var count = $("#" + table.options.id).bootstrapTable('getData').length; uploadUrl: '/common/upload',
sub.editColumn(); initialPreviewAsData: true,
initialPreview: detailImagesArr,
$("#" + table.options.id).bootstrapTable('insertRow', { maxFileCount: 20,
index: count, maxFilesNum : 20,
row: { maxFileSize: 200,
index: $.table.serialNumber(count), allowedFileTypes: ['image'],
imageType: "", allowedFileExtensions: ['jpg','png','gif','jpeg']
imageName: "", }).on('fileuploaded', function (event, data, previewId, index) {
imageUrl: "", detailImagesArr.push(data.response.url);
createBy: "", }).on('fileremoved', function (event, id, index) {
createTime: "", detailImagesArr.splice(detailImagesArr.indexOf(data.response.url), 1);
updateBy: "", });
updateTime: ""
} $("#loopImages").fileinput({
uploadUrl: '/common/upload',
initialPreviewAsData: true,
initialPreview: loopImagesArr,
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> </script>
</body> </body>
</html> </html>