diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderTemplateController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderTemplateController.java index 81641a1c..84b58215 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderTemplateController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderTemplateController.java @@ -1,6 +1,7 @@ package com.ghy.web.controller.order; import com.ghy.common.core.controller.BaseController; +import com.ghy.common.core.domain.AjaxResult; import com.ghy.order.domain.OrderTemplate; import com.ghy.order.service.OrderTemplateService; import lombok.extern.slf4j.Slf4j; @@ -21,11 +22,13 @@ public class OrderTemplateController extends BaseController { @PostMapping("insert") @ResponseBody - public int insert(@RequestBody OrderTemplate orderTemplate) { + public AjaxResult insert(@RequestBody OrderTemplate orderTemplate) { Long userId = getUserId(); Assert.notNull(userId, "UserId is null !"); orderTemplate.setUserId(userId); - return orderTemplateService.insert(orderTemplate); + orderTemplate.setCreateBy(getLoginName()); + orderTemplateService.insert(orderTemplate); + return AjaxResult.success(); } @DeleteMapping("delete") diff --git a/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html b/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html index b87b2321..69c2d10d 100644 --- a/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html +++ b/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html @@ -178,7 +178,7 @@
- +
@@ -441,7 +441,28 @@ } function submitOrder() { + if ($.validate.form()) { + var data = $("#addTemplateForm").serializeArray(); + var params= {}; + data.forEach(function (item){ + params[item.name] = item.value; + }); + $.ajax({ + type: "POST", + dataType:"json", + url: ctx + "order/sys/order", + data: JSON.stringify(params), + contentType: 'application/json', + success: function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.msgSuccess("提交成功") + } else { + $.modal.msgError("请求失败") + } + } + }) + } } function addTemplate() { diff --git a/ghy-order/src/main/resources/mapper/order/OrderTemplateMapper.xml b/ghy-order/src/main/resources/mapper/order/OrderTemplateMapper.xml index cc126f1c..3c896b8c 100644 --- a/ghy-order/src/main/resources/mapper/order/OrderTemplateMapper.xml +++ b/ghy-order/src/main/resources/mapper/order/OrderTemplateMapper.xml @@ -36,26 +36,26 @@ UPDATE order_template - template_name = #{templateName}, - goods_brand = #{goodsBrand}, - goods_specification = #{goodsSpecification}, - video_url = #{videoUrl}, - image_url = #{imageUrl}, - address_id = #{addressId}, - street_id = #{streetId}, - full_address = #{fullAddress}, - customer_name = #{customerName}, - customer_phone = #{customerPhone}, - order_mode = #{orderMode}, - price = #{price}, - agency_fund = #{agencyFund}, - information_fee = #{informationFee}, - bonus = #{bonus}, - logistics_code = #{logisticsCode}, - need_wagon = #{needWagon}, - need_carry = #{needCarry}, - floor = #{floor}, - update_by = #{updateBy}, + template_name = #{templateName}, + goods_brand = #{goodsBrand}, + goods_specification = #{goodsSpecification}, + video_url = #{videoUrl}, + image_url = #{imageUrl}, + address_id = #{addressId}, + street_id = #{streetId}, + full_address = #{fullAddress}, + customer_name = #{customerName}, + customer_phone = #{customerPhone}, + order_mode = #{orderMode}, + price = #{price}, + agency_fund = #{agencyFund}, + information_fee = #{informationFee}, + bonus = #{bonus}, + logistics_code = #{logisticsCode}, + need_wagon = #{needWagon}, + need_carry = #{needCarry}, + floor = #{floor}, + update_by = #{updateBy}, update_time = SYSDATE() WHERE id = #{id} @@ -64,47 +64,47 @@ INSERT INTO order_template( user_id, - template_name, - goods_brand, - goods_specification = #{goodsSpecification}, - video_url, - image_url, - address_id, - street_id, - full_address, - customer_name, - customer_phone, - order_mode, - price, - agency_fund, - information_fee, - bonus, - logistics_code, - need_wagon, - need_carry, - floor, + template_name, + goods_brand, + goods_specification, + video_url, + image_url, + address_id, + street_id, + full_address, + customer_name, + customer_phone, + order_mode, + price, + agency_fund, + information_fee, + bonus, + logistics_code, + need_wagon, + need_carry, + floor, create_time )VALUES( #{userId}, - #{templateName}, - #{goodsBrand}, - #{goodsSpecification}, - #{videoUrl}, - #{imageUrl}, - #{addressId}, - #{streetId}, - #{fullAddress}, - #{customerName}, - #{customerPhone}, - #{orderMode}, - #{price}, - #{agencyFund}, - #{informationFee}, - #{bonus}, - #{logisticsCode}, - #{needWagon}, - #{needCarry}, - #{floor}, + #{templateName}, + #{goodsBrand}, + #{goodsSpecification}, + #{videoUrl}, + #{imageUrl}, + #{addressId}, + #{streetId}, + #{fullAddress}, + #{customerName}, + #{customerPhone}, + #{orderMode}, + #{price}, + #{agencyFund}, + #{informationFee}, + #{bonus}, + #{logisticsCode}, + #{needWagon}, + #{needCarry}, + #{floor}, SYSDATE() ) @@ -112,7 +112,7 @@