mapper层
parent
3a07c32f32
commit
eed48a03ec
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OperatorsMapper {
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import com.muyu.cloud.market.domin.Orders;
|
||||
import com.muyu.cloud.market.domin.req.OrdersAddReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersListReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface OrderShowMapper {
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* (精确查ordersNum 精确查ordersState 日期范围 startdate enddate)
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
List<Orders> selectList(OrdersListReq req);
|
||||
|
||||
/** 订单
|
||||
* 新增订单
|
||||
* @param ordersAddReq
|
||||
* @return
|
||||
*/
|
||||
Integer addOrdeds(OrdersAddReq ordersAddReq);
|
||||
|
||||
|
||||
/** 订单
|
||||
* 修改订单
|
||||
* @param orders
|
||||
* @return
|
||||
*/
|
||||
Integer updateOrders(Orders orders);
|
||||
|
||||
/** 订单
|
||||
* 逻辑删除->根据orderid修改exist字段 1->0
|
||||
* 订单回收站
|
||||
* @param ordersId
|
||||
* @return
|
||||
*/
|
||||
Integer updateByeExist(Integer ordersId);
|
||||
|
||||
/** 订单
|
||||
* 逻辑复原->根据orderid修改exist字段 0->1
|
||||
* 订单回收站
|
||||
* @param ordersId
|
||||
* @return
|
||||
*/
|
||||
Integer updateByExist(Integer ordersId);
|
||||
|
||||
/** 订单
|
||||
* 彻底删除(根据orderid删除数据库字段)
|
||||
* @return
|
||||
*/
|
||||
Integer delByOrderId(Integer ordersId);
|
||||
|
||||
/**
|
||||
* 订单回显
|
||||
* 根据id查内容
|
||||
* @param ordersId
|
||||
* @return
|
||||
*/
|
||||
Orders findAllById (Integer ordersId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加订单(下单时),扣减库存
|
||||
* 修改订单支付状态未付款后,增加库存
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单修改支付状态后,更改该商品的销量
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrdersPayMapper {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RechargeMapper {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SalelogMapper {
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
<?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">
|
||||
|
||||
<!-- 1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)-->
|
||||
|
||||
<mapper namespace="com.muyu.cloud.market.mapper.OrderShowMapper">
|
||||
|
||||
<resultMap id="goodsResult" type="com.muyu.cloud.market.domin.Orders">
|
||||
<result column="orders_id" property="ordersId"/>
|
||||
<result column="orders_num" property="ordersNum"/>
|
||||
<result column="orders_product" property="ordersProduct"/>
|
||||
<result column="orders_user" property="ordersUser"/>
|
||||
<result column="orders_price" property="ordersPrice"/>
|
||||
<result column="orders_specification" property="ordersSpecification"/>
|
||||
<result column="orders_state" property="ordersState"/>
|
||||
<result column="orders_launchdate" property="ordersLaunchdate"/>
|
||||
<result column="exist" property="exist"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="ordersSql">
|
||||
SELECT
|
||||
orders_id,
|
||||
orders_num,
|
||||
orders_product,
|
||||
orders_user,
|
||||
orders_price,
|
||||
orders_specification,
|
||||
orders_state,
|
||||
orders_launchdate
|
||||
FROM `orders`
|
||||
where exist = 1
|
||||
</sql>
|
||||
|
||||
<!--com.muyu.common.system.domain.SysUser-->
|
||||
|
||||
<!-- 查询订单(精确查ordersNum 精确查ordersState 日期范围 startdate enddate) -->
|
||||
<!-- 多表联查 -> 产品表外键,用户外键 -->
|
||||
<select id="selectList" resultType="com.muyu.cloud.market.domin.Orders">
|
||||
SELECT orders_id, orders_num, orders_product, orders_user, orders_price, orders_specification, orders_state, orders_launchdate,
|
||||
product_id,product_name,
|
||||
user_id,user_name
|
||||
FROM `orders`
|
||||
LEFT JOIN `product` ON `orders`.orders_product = `product`.product_id
|
||||
LEFT JOIN `sys_user` ON `orders`.orders_user = `sys_user`.user_id
|
||||
<where>
|
||||
<if test=" ordersNum != null and ordersNum !='' "> AND orders_num = #{ordersNum} </if>
|
||||
<if test=" ordersState != null "> AND orders_state = #{ordersState} </if>
|
||||
<if test="startDate!=null and startDate!=''"> AND orders_launchdate >=#{startDate} </if>
|
||||
<if test="endDate!=null and endDate!=''"> AND orders_launchdate <=#{endDate} </if>
|
||||
AND exist = 1
|
||||
</where>
|
||||
ORDER BY orders_launchdate DESC
|
||||
</select>
|
||||
|
||||
<!--根据ordersId回显数据-->
|
||||
<select id="findAllById" resultMap="goodsResult">
|
||||
<include refid="ordersSql"/> WHERE orders_id = #{ordersId}
|
||||
</select>
|
||||
|
||||
<!--添加订单到-->
|
||||
<insert id="addOrdeds">
|
||||
INSERT INTO `orders`
|
||||
(`orders_num`, `orders_product`, `orders_user`, `orders_price`, `orders_specification`, `orders_state`, `orders_launchdate`)
|
||||
VALUES
|
||||
(#{ordersNum}, #{ordersProduct}, #{ordersUser}, #{ordersPrice}, #{ordersSpecification}, 0, NOW());
|
||||
</insert>
|
||||
|
||||
<update id="updateOrders">
|
||||
UPDATE `orders` SET
|
||||
`orders_product` = #{ordersProduct},
|
||||
`orders_user` = #{ordersUser},
|
||||
`orders_price` = #{ordersPrice},
|
||||
`orders_specification` = #{ordersSpecification},
|
||||
`orders_state` = 0
|
||||
WHERE `orders_id` IS #{ordersId};
|
||||
</update>
|
||||
|
||||
<!-- 逻辑删除 改变字段状态 -->
|
||||
<update id="updateByeExist">
|
||||
UPDATE `orders` SET `exist` = 0 WHERE `orders_id` IS #{ordersId}
|
||||
</update>
|
||||
<!-- 逻辑字段 修改字段状态 -->
|
||||
<update id="updateByExist">
|
||||
UPDATE `orders` SET `exist` = 1 WHERE `orders_id` IS #{ordersId}
|
||||
</update>
|
||||
|
||||
<!--订单回显-->
|
||||
<delete id="delByOrderId">
|
||||
DELETE FROM `orders` WHERE `orders_id` IS #{ordersId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue