主订单、详细订单接口开发
This commit is contained in:
parent
51205df3c7
commit
9b1132d171
|
|
@ -32,3 +32,4 @@ build/
|
|||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
||||
|
|
@ -73,6 +73,12 @@
|
|||
<artifactId>ghy-goods</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 订单模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ghy</groupId>
|
||||
<artifactId>ghy-order</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
package com.ghy.web.controller.order;
|
||||
|
||||
import com.ghy.common.annotation.Log;
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 详细订单API
|
||||
*
|
||||
* @author HH 2022/4/25
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/order/detail")
|
||||
public class OrderDetailController extends BaseController {
|
||||
|
||||
private final String prefix = "order/detail";
|
||||
|
||||
@Resource
|
||||
private OrderDetailService orderDetailService;
|
||||
|
||||
@RequiresPermissions("order:master:view")
|
||||
@GetMapping()
|
||||
public String orderDetail() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
@RequiresPermissions("order:master:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(OrderDetail orderDetail) {
|
||||
startPage();
|
||||
List<OrderDetail> list = orderDetailService.selectOrderDetailList(orderDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "详细订单管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("order:master:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(OrderDetail orderDetail) {
|
||||
List<OrderDetail> list = orderDetailService.selectOrderDetailList(orderDetail);
|
||||
ExcelUtil<OrderDetail> util = new ExcelUtil<>(OrderDetail.class);
|
||||
return util.exportExcel(list, "详细订单数据");
|
||||
}
|
||||
|
||||
@RequiresPermissions("order:master:remove")
|
||||
@Log(title = "详细订单管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
try {
|
||||
return toAjax(orderDetailService.deleteOrderDetailByIds(ids));
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改详细订单
|
||||
*/
|
||||
@RequiresPermissions("order:master:edit")
|
||||
@GetMapping("/edit/{orderDetailId}")
|
||||
public String edit(@PathVariable("orderDetailId") Long orderDetailId, ModelMap mmap) {
|
||||
mmap.put("orderDetail", orderDetailService.selectById(orderDetailId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存详细订单
|
||||
*/
|
||||
@RequiresPermissions("order:master:edit")
|
||||
@Log(title = "详细订单管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated OrderDetail orderDetail) {
|
||||
if (UserConstants.ORDER_CODE_NOT_UNIQUE.equals(orderDetailService.checkOrderDetailCodeUnique(orderDetail))) {
|
||||
return error("修改详细订单'" + orderDetail.getCode() + "'失败,详细订单编码已存在");
|
||||
}
|
||||
orderDetail.setUpdateBy(getLoginName());
|
||||
return toAjax(orderDetailService.updateOrderDetail(orderDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验详细订单编码
|
||||
*/
|
||||
@PostMapping("/checkOrderDetailCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkOrderDetailCodeUnique(OrderDetail orderDetail) {
|
||||
return orderDetailService.checkOrderDetailCodeUnique(orderDetail);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.ghy.web.controller.order;
|
||||
|
||||
import com.ghy.common.annotation.Log;
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主订单API
|
||||
*
|
||||
* @author HH 2022/4/25
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/order/master")
|
||||
public class OrderMasterController extends BaseController {
|
||||
|
||||
private final String prefix = "order/master";
|
||||
|
||||
@Resource
|
||||
private OrderMasterService orderMasterService;
|
||||
|
||||
@RequiresPermissions("order:master:view")
|
||||
@GetMapping()
|
||||
public String orderMaster() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
@RequiresPermissions("order:master:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(OrderMaster orderMaster) {
|
||||
startPage();
|
||||
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "主订单管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("order:master:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(OrderMaster orderMaster) {
|
||||
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
|
||||
ExcelUtil<OrderMaster> util = new ExcelUtil<>(OrderMaster.class);
|
||||
return util.exportExcel(list, "主订单数据");
|
||||
}
|
||||
|
||||
@RequiresPermissions("order:master:remove")
|
||||
@Log(title = "主订单管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
try {
|
||||
return toAjax(orderMasterService.deleteOrderMasterByIds(ids));
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主订单
|
||||
*/
|
||||
@RequiresPermissions("order:master:edit")
|
||||
@GetMapping("/edit/{orderMasterId}")
|
||||
public String edit(@PathVariable("orderMasterId") Long orderMasterId, ModelMap mmap) {
|
||||
mmap.put("orderMaster", orderMasterService.selectById(orderMasterId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存主订单
|
||||
*/
|
||||
@RequiresPermissions("order:master:edit")
|
||||
@Log(title = "主订单管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated OrderMaster orderMaster) {
|
||||
if (UserConstants.ORDER_CODE_NOT_UNIQUE.equals(orderMasterService.checkOrderMasterCodeUnique(orderMaster))) {
|
||||
return error("修改主订单'" + orderMaster.getCode() + "'失败,主订单编码已存在");
|
||||
}
|
||||
orderMaster.setUpdateBy(getLoginName());
|
||||
return toAjax(orderMasterService.updateOrderMaster(orderMaster));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验主订单编码
|
||||
*/
|
||||
@PostMapping("/checkOrderMasterCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkOrderMasterCodeUnique(OrderMaster orderMaster) {
|
||||
return orderMasterService.checkOrderMasterCodeUnique(orderMaster);
|
||||
}
|
||||
}
|
||||
|
|
@ -109,6 +109,10 @@ public class UserConstants
|
|||
public final static String CONFIG_KEY_UNIQUE = "0";
|
||||
public final static String CONFIG_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
/** 订单编码是否唯一的返回结果 */
|
||||
public final static String ORDER_CODE_UNIQUE = "0";
|
||||
public final static String ORDER_CODE_NOT_UNIQUE = "1";
|
||||
|
||||
/**
|
||||
* 密码长度限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ghy.order.mapper;
|
||||
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 细单表(转派后产生的订单)的mapper层
|
||||
*
|
||||
* @author HH 2022/4/25
|
||||
*/
|
||||
public interface OrderDetailMapper {
|
||||
|
||||
/**
|
||||
* @param orderDetail 细单表属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int insertOrderDetail(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* @param orderDetail 细单表属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int updateOrderDetail(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* @param orderDetail 细单表入参
|
||||
* @return 细单表集合
|
||||
*/
|
||||
List<OrderDetail> selectOrderDetailList(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* @param orderDetailId 细单表id
|
||||
* @return 细单表
|
||||
*/
|
||||
OrderDetail selectById(Long orderDetailId);
|
||||
|
||||
/**
|
||||
* 批量删除细单表信息
|
||||
*
|
||||
* @param orderDetailIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteOrderDetailByIds(Long[] orderDetailIds);
|
||||
|
||||
/**
|
||||
* @param orderDetailCode 细单表编码
|
||||
* @return 细单表信息
|
||||
*/
|
||||
OrderDetail checkOrderDetailCodeUnique(String orderDetailCode);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ghy.order.mapper;
|
||||
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主订单的mapper层
|
||||
*
|
||||
* @author HH 2022/4/24
|
||||
*/
|
||||
public interface OrderMasterMapper {
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int insertOrderMaster(OrderMaster orderMaster);
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int updateOrderMaster(OrderMaster orderMaster);
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单入参
|
||||
* @return 主订单集合
|
||||
*/
|
||||
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
||||
|
||||
/**
|
||||
* @param orderMasterId 主订单id
|
||||
* @return 主订单
|
||||
*/
|
||||
OrderMaster selectById(Long orderMasterId);
|
||||
|
||||
/**
|
||||
* 批量删除主订单信息
|
||||
*
|
||||
* @param orderMasterIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteOrderMasterByIds(Long[] orderMasterIds);
|
||||
|
||||
/**
|
||||
* @param orderMasterCode 主订单编码
|
||||
* @return 主订单信息
|
||||
*/
|
||||
OrderMaster checkOrderMasterCodeUnique(String orderMasterCode);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ghy.order.service;
|
||||
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 详细订单接口
|
||||
*
|
||||
* @author HH 2022/4/25
|
||||
*/
|
||||
public interface OrderDetailService {
|
||||
|
||||
/**
|
||||
* @param orderDetail 详细订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int insertOrderDetail(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* @param orderDetail 详细订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int updateOrderDetail(OrderDetail orderDetail);
|
||||
|
||||
/**
|
||||
* @param orderDetail 详细订单入参
|
||||
* @return 详细订单集合
|
||||
*/
|
||||
List<OrderDetail> selectOrderDetailList(OrderDetail orderDetail);
|
||||
|
||||
|
||||
/**
|
||||
* @param orderDetailId 详细订单id
|
||||
* @return 详细订单
|
||||
*/
|
||||
OrderDetail selectById(Long orderDetailId);
|
||||
|
||||
/**
|
||||
* @param ids 详细订单ids
|
||||
* @return 删除结果
|
||||
*/
|
||||
int deleteOrderDetailByIds(String ids);
|
||||
|
||||
/**
|
||||
* 校验详细订单编码是否重复
|
||||
*
|
||||
* @param orderDetail 详细订单属性
|
||||
* @return 校验结果 1存在 0不存在
|
||||
*/
|
||||
String checkOrderDetailCodeUnique(OrderDetail orderDetail);
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.ghy.order.service;
|
||||
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主订单接口
|
||||
*
|
||||
* @author clunt
|
||||
*/
|
||||
public interface OrderMasterService {
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int insertOrderMaster(OrderMaster orderMaster);
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单属性
|
||||
* @return 成功条数
|
||||
*/
|
||||
int updateOrderMaster(OrderMaster orderMaster);
|
||||
|
||||
/**
|
||||
* @param orderMaster 主订单入参
|
||||
* @return 主订单集合
|
||||
*/
|
||||
List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster);
|
||||
|
||||
|
||||
/**
|
||||
* @param orderMasterId 主订单id
|
||||
* @return 主订单
|
||||
*/
|
||||
OrderMaster selectById(Long orderMasterId);
|
||||
|
||||
/**
|
||||
* @param ids 主订单ids
|
||||
* @return 删除结果
|
||||
*/
|
||||
int deleteOrderMasterByIds(String ids);
|
||||
|
||||
/**
|
||||
* 校验主订单编码是否重复
|
||||
*
|
||||
* @param orderMaster 主订单属性
|
||||
* @return 校验结果 1存在 0不存在
|
||||
*/
|
||||
String checkOrderMasterCodeUnique(OrderMaster orderMaster);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.ghy.order.service.impl;
|
||||
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.mapper.OrderDetailMapper;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
|
||||
@Resource
|
||||
private OrderDetailMapper orderDetailMapper;
|
||||
|
||||
@Override
|
||||
public int insertOrderDetail(OrderDetail orderDetail) {
|
||||
return orderDetailMapper.insertOrderDetail(orderDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOrderDetail(OrderDetail orderDetail) {
|
||||
return orderDetailMapper.updateOrderDetail(orderDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderDetail> selectOrderDetailList(OrderDetail orderDetail) {
|
||||
return orderDetailMapper.selectOrderDetailList(orderDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDetail selectById(Long orderDetailId) {
|
||||
return orderDetailMapper.selectById(orderDetailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteOrderDetailByIds(String ids) {
|
||||
Long[] orderDetailIds = Convert.toLongArray(ids);
|
||||
return orderDetailMapper.deleteOrderDetailByIds(orderDetailIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkOrderDetailCodeUnique(OrderDetail orderDetail) {
|
||||
long orderDetailId = orderDetail.getId() == null ? -1L : orderDetail.getId();
|
||||
OrderDetail info = orderDetailMapper.checkOrderDetailCodeUnique(orderDetail.getCode());
|
||||
if (info != null && info.getId() != orderDetailId) {
|
||||
return UserConstants.ORDER_CODE_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ORDER_CODE_UNIQUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.ghy.order.service.impl;
|
||||
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.mapper.OrderMasterMapper;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品模块实现类
|
||||
*
|
||||
* @author clunt
|
||||
*/
|
||||
@Service
|
||||
public class OrderMasterServiceImpl implements OrderMasterService {
|
||||
|
||||
@Resource
|
||||
private OrderMasterMapper orderMasterMapper;
|
||||
|
||||
@Override
|
||||
public int insertOrderMaster(OrderMaster orderMaster) {
|
||||
return orderMasterMapper.insertOrderMaster(orderMaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOrderMaster(OrderMaster orderMaster) {
|
||||
return orderMasterMapper.updateOrderMaster(orderMaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderMaster> selectOrderMasterList(OrderMaster orderMaster) {
|
||||
return orderMasterMapper.selectOrderMasterList(orderMaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderMaster selectById(Long orderMasterId) {
|
||||
return orderMasterMapper.selectById(orderMasterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteOrderMasterByIds(String ids) {
|
||||
Long[] orderMasterIds = Convert.toLongArray(ids);
|
||||
return orderMasterMapper.deleteOrderMasterByIds(orderMasterIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkOrderMasterCodeUnique(OrderMaster orderMaster) {
|
||||
long orderMasterId = orderMaster.getId() == null ? -1L : orderMaster.getId();
|
||||
OrderMaster info = orderMasterMapper.checkOrderMasterCodeUnique(orderMaster.getCode());
|
||||
if (info != null && info.getId() != orderMasterId) {
|
||||
return UserConstants.ORDER_CODE_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.ORDER_CODE_UNIQUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<?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.ghy.order.mapper.OrderDetailMapper">
|
||||
|
||||
<resultMap id="OrderDetailResult" type="com.ghy.order.domain.OrderDetail">
|
||||
<id property="id" column="id"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="orderMasterId" column="order_master_id"/>
|
||||
<result property="orderMasterCode" column="order_master_code"/>
|
||||
<result property="customerId" column="customer_id"/>
|
||||
<result property="orderType" column="order_type"/>
|
||||
<result property="orderStatus" column="order_status"/>
|
||||
<result property="workerId" column="worker_id"/>
|
||||
<result property="payTime" column="pay_time"/>
|
||||
<result property="revTime" column="rev_time"/>
|
||||
<result property="workBeginTime" column="work_begin_time"/>
|
||||
<result property="workFinishTime" column="work_finish_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOrderDetail">
|
||||
SELECT id,
|
||||
code,
|
||||
order_master_code,
|
||||
customer_id,
|
||||
order_type,
|
||||
order_status,
|
||||
worker_id,
|
||||
pay_time,
|
||||
rev_time,
|
||||
work_begin_time,
|
||||
work_finish_time,
|
||||
create_by,
|
||||
create_time,
|
||||
remark
|
||||
FROM order_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
|
||||
<include refid="selectOrderDetail"/>
|
||||
<where>
|
||||
<if test="code != null and code != ''">
|
||||
AND code LIKE concat('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="customerId != null and customerId != 0">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="orderType != null and orderType != 0">
|
||||
AND order_type = #{orderType}
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != 0">
|
||||
AND order_status = #{orderStatus}
|
||||
</if>
|
||||
<if test="orderMasterCode != null and orderMasterCode != 0">
|
||||
AND order_detail_code = #{orderMasterCode}
|
||||
</if>
|
||||
<if test="workerId != null and workerId != 0">
|
||||
AND worker_id = #{workerId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="long" resultMap="OrderDetailResult">
|
||||
<include refid="selectOrderDetail"/>
|
||||
<where>
|
||||
<if test="orderDetailId != null and orderDetailId != 0">
|
||||
AND id = #{orderDetailId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteOrderDetailByIds" parameterType="Long">
|
||||
DELETE FROM order_detail WHERE id IN
|
||||
<foreach collection="array" item="orderDetailId" open="(" separator="," close=")">
|
||||
#{orderDetailId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateOrderDetail" parameterType="com.ghy.order.domain.OrderDetail">
|
||||
UPDATE order_detail
|
||||
<set>
|
||||
<if test="code != null and code != ''">code = #{code},</if>
|
||||
<if test="orderMasterId != null and orderMasterId != ''">order_master_id = #{orderMasterId},</if>
|
||||
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code = #{orderMasterCode},</if>
|
||||
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
|
||||
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
|
||||
<if test="workerId != null and workerId != ''">worker_id = #{workerId},</if>
|
||||
<if test="payTime != null and payTime != ''">pay_time = #{payTime},</if>
|
||||
<if test="revTime != null and revTime != ''">rev_time = #{revTime},</if>
|
||||
<if test="workBeginTime != null and workBeginTime != ''">work_begin_time = #{workBeginTime},</if>
|
||||
<if test="workFinishTime != null and workFinishTime != ''">work_finish_time = #{workFinishTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = SYSDATE()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO order_detail(
|
||||
<if test="code != null and code != 0">code,</if>
|
||||
<if test="orderMasterId != null and orderMasterId != ''">order_master_id,</if>
|
||||
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code,</if>
|
||||
<if test="customerId != null and customerId != ''">customer_id,</if>
|
||||
<if test="orderType != null and orderType != ''">order_type,</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
|
||||
<if test="workerId != null and workerId != ''">worker_id,</if>
|
||||
<if test="payTime != null and payTime != ''">pay_time,</if>
|
||||
<if test="revTime != null and revTime != ''">rev_time,</if>
|
||||
<if test="workBeginTime != null and workBeginTime != ''">work_begin_time,</if>
|
||||
<if test="workFinishTime != null and workFinishTime != ''">work_finish_time,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)VALUES(
|
||||
<if test="code != null and code != 0">#{code},</if>
|
||||
<if test="orderMasterId != null and orderMasterId != ''">o#{orderMasterId},</if>
|
||||
<if test="orderMasterCode != null and orderMasterCode != ''">#{orderMasterCode},</if>
|
||||
<if test="customerId != null and customerId != ''">#{customerId},</if>
|
||||
<if test="orderType != null and orderType != ''">#{orderType},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
|
||||
<if test="workerId != null and workerId != ''">#{workerId},</if>
|
||||
<if test="payTime != null and payTime != ''">#{payTime},</if>
|
||||
<if test="revTime != null and revTime != ''">#{revTime},</if>
|
||||
<if test="workBeginTime != null and workBeginTime != ''">#{workBeginTime},</if>
|
||||
<if test="workFinishTime != null and workFinishTime != ''">#{workFinishTime},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
SYSDATE()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="checkOrderDetailCodeUnique" parameterType="String" resultMap="OrderDetailResult">
|
||||
<include refid="selectOrderDetail"/>
|
||||
WHERE `code` =#{orderDetailCode} LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<?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.ghy.order.mapper.OrderMasterMapper">
|
||||
|
||||
<resultMap id="OrderMasterResult" type="com.ghy.order.domain.OrderMaster">
|
||||
<id property="id" column="id"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="customerId" column="customer_id"/>
|
||||
<result property="orderType" column="order_type"/>
|
||||
<result property="orderStatus" column="order_status"/>
|
||||
<result property="payType" column="pay_type"/>
|
||||
<result property="payStatus" column="pay_status"/>
|
||||
<result property="workerId" column="worker_id"/>
|
||||
<result property="payTime" column="pay_time"/>
|
||||
<result property="revTime" column="rev_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOrderMaster">
|
||||
SELECT id,
|
||||
code,
|
||||
customer_id,
|
||||
order_type,
|
||||
order_status,
|
||||
pay_type,
|
||||
pay_status,
|
||||
worker_id,
|
||||
pay_time,
|
||||
rev_time,
|
||||
create_by,
|
||||
create_time,
|
||||
remark
|
||||
FROM order_master
|
||||
</sql>
|
||||
|
||||
<select id="selectOrderMasterList" parameterType="com.ghy.order.domain.OrderMaster" resultMap="OrderMasterResult">
|
||||
<include refid="selectOrderMaster"/>
|
||||
<where>
|
||||
<if test="code != null and code != ''">
|
||||
AND code LIKE concat('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="customerId != null and customerId != 0">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="orderType != null and orderType != 0">
|
||||
AND order_type = #{orderType}
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != 0">
|
||||
AND order_status = #{orderStatus}
|
||||
</if>
|
||||
<if test="payType != null and payType != 0">
|
||||
AND pay_type = #{payType}
|
||||
</if>
|
||||
<if test="payStatus != null and payStatus != 0">
|
||||
AND pay_status = #{payStatus}
|
||||
</if>
|
||||
<if test="workerId != null and workerId != 0">
|
||||
AND worker_id = #{workerId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="long" resultMap="OrderMasterResult">
|
||||
<include refid="selectOrderMaster"/>
|
||||
<where>
|
||||
<if test="orderMasterId != null and orderMasterId != 0">
|
||||
AND id = #{orderMasterId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteOrderMasterByIds" parameterType="Long">
|
||||
DELETE FROM order_master WHERE id IN
|
||||
<foreach collection="array" item="orderMasterId" open="(" separator="," close=")">
|
||||
#{orderMasterId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateOrderMaster" parameterType="com.ghy.order.domain.OrderMaster">
|
||||
UPDATE order_master
|
||||
<set>
|
||||
<if test="code != null and code != ''">code = #{code},</if>
|
||||
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
|
||||
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
|
||||
<if test="payType != null and payType != ''">pay_type = #{payType},</if>
|
||||
<if test="payStatus != null and payStatus != ''">pay_status = #{payStatus},</if>
|
||||
<if test="workerId != null and workerId != ''">worker_id = #{workerId},</if>
|
||||
<if test="payTime != null and payTime != ''">pay_time = #{payTime},</if>
|
||||
<if test="revTime != null and revTime != ''">rev_time = #{revTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = SYSDATE()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertOrderMaster" parameterType="com.ghy.order.domain.OrderMaster" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO order_master(
|
||||
<if test="code != null and code != 0">code,</if>
|
||||
<if test="customerId != null and customerId != ''">customer_id,</if>
|
||||
<if test="orderType != null and orderType != ''">order_type,</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
|
||||
<if test="payType != null and payType != ''">pay_type,</if>
|
||||
<if test="payStatus != null and payStatus != ''">pay_status,</if>
|
||||
<if test="workerId != null and workerId != ''">worker_id,</if>
|
||||
<if test="payTime != null and payTime != ''">pay_time,</if>
|
||||
<if test="revTime != null and revTime != ''">rev_time,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)VALUES(
|
||||
<if test="code != null and code != 0">#{code},</if>
|
||||
<if test="customerId != null and customerId != ''">#{customerId},</if>
|
||||
<if test="orderType != null and orderType != ''">#{orderType},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
|
||||
<if test="payType != null and payType != ''">#{payType},</if>
|
||||
<if test="payStatus != null and payStatus != ''">#{payStatus},</if>
|
||||
<if test="workerId != null and workerId != ''">#{workerId},</if>
|
||||
<if test="payTime != null and payTime != ''">#{payTime},</if>
|
||||
<if test="revTime != null and revTime != ''">#{revTime},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
SYSDATE()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="checkOrderMasterCodeUnique" parameterType="String" resultMap="OrderMasterResult">
|
||||
<include refid="selectOrderMaster"/>
|
||||
WHERE `code` =#{orderMasterCode} LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue