提交 70d84d29 作者: 刘明祎-运维用途

Merge branch 'develop'

流水线 #8677 已通过 于阶段
in 2 分 53 秒
......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms
newTag: 8a35b3727088b77c7a5eb826d26367cc8d133558
newTag: dfba6777489da5e028d1436989346d127198f628
package com.mmc.oms.controller.mall;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.controller.BaseController;
import com.mmc.oms.entity.mall.PointsMallDO;
import com.mmc.oms.entity.mall.PointsOrderDO;
import com.mmc.oms.model.dto.mall.MallOrderPageDTO;
import com.mmc.oms.model.dto.user.BaseAccountDTO;
import com.mmc.oms.model.qo.GeneralQO;
import com.mmc.oms.model.qo.PointsMallOrderQO;
import com.mmc.oms.model.qo.mall.MallOrderQO;
import com.mmc.oms.service.mall.MallOrderService;
import com.mmc.oms.service.mall.PointMallService;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @author Admin
*/
@Api(tags = { "积分商城(订单)" })
@RestController
@RequestMapping("/pointsMall/")
@AllArgsConstructor
public class PointsMallController extends BaseController {
private final PointMallService pointMallService;
@ApiOperation(value = "后台——添加积分商品")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("insertMall")
public ResultBody insertMall(@RequestBody PointsMallDO param, HttpServletRequest request) {
return pointMallService.insertMall(param);
}
@ApiOperation(value = "后台——删除积分商品")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@GetMapping("deleteMall")
public ResultBody deleteMall(@RequestParam("id") Integer id) {
return pointMallService.deleteMall(id);
}
@ApiOperation(value = "后台——修改积分商品")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("updateMall")
public ResultBody updateMall(@RequestBody PointsMallDO param, HttpServletRequest request) {
return pointMallService.updateMall(param);
}
@ApiOperation(value = "积分商品详情")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@GetMapping("getMallInfo")
public ResultBody getMallInfo(@RequestParam("id") Integer id, HttpServletRequest request) {
return pointMallService.getMallInfo(id);
}
@ApiOperation(value = "积分商城列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("getMallList")
public ResultBody getMallList(@RequestBody GeneralQO qo, HttpServletRequest request) {
return pointMallService.getMallList(qo);
}
@ApiOperation(value = "小程序——购买积分商品")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("buyGoods")
public ResultBody buyGoods(@RequestBody PointsOrderDO pointsOrderDO, HttpServletRequest request) {
Integer userAccountId = this.getCurrentAccount(request).getUserAccountId();
pointsOrderDO.setUserId(userAccountId);
return pointMallService.insertPointsOrder(pointsOrderDO,request);
}
@ApiOperation(value = "积分商品订单列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("mallOrderList")
public ResultBody mallOrderList(@RequestBody PointsMallOrderQO qo, HttpServletRequest request) {
Integer userAccountId = this.getCurrentAccount(request).getUserAccountId();
if(qo.getIsAdmin() == 0){
qo.setUserId(userAccountId);
}
return pointMallService.getOrderList(qo);
}
@ApiOperation(value = "修改商品订单")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@PostMapping("updateGoodsOrder")
public ResultBody updateGoodsOrder(@RequestBody PointsOrderDO param) {
return pointMallService.updateGoodsOrder(param);
}
}
package com.mmc.oms.dao.mall;
import com.mmc.oms.entity.mall.PointsMallDO;
import com.mmc.oms.model.qo.GeneralQO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Admin
* @description 针对表【points_mall】的数据库操作Mapper
* @createDate 2024-03-30 14:37:06
* @Entity com.mmc.oms.entity.mall.PointsMallDO
*/
@Mapper
public interface PointsMallDao {
int deleteByPrimaryKey(Integer id);
int insert(PointsMallDO record);
int insertSelective(PointsMallDO record);
PointsMallDO selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PointsMallDO record);
int updateByPrimaryKey(PointsMallDO record);
List<PointsMallDO> selectAll(GeneralQO qo);
int count();
}
package com.mmc.oms.dao.mall;
import com.mmc.oms.entity.mall.PointsOrderDO;
import com.mmc.oms.model.qo.GeneralQO;
import com.mmc.oms.model.qo.PointsMallOrderQO;
import com.mmc.oms.model.vo.mall.PointsOrderVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Admin
* @description 针对表【points_order】的数据库操作Mapper
* @createDate 2024-03-30 14:37:06
* @Entity com.mmc.oms.entity.mall.PointsOrderDO
*/
@Mapper
public interface PointsOrderDao {
int deleteByPrimaryKey(Long id);
int insert(PointsOrderDO record);
int insertSelective(PointsOrderDO record);
PointsOrderDO selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PointsOrderDO record);
int updateByPrimaryKey(PointsOrderDO record);
List<PointsOrderVO> getOrderList(PointsMallOrderQO qo);
int countOrderList(PointsMallOrderQO qo);
}
package com.mmc.oms.entity.mall;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName points_mall
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PointsMallDO implements Serializable {
/**
*
*/
@ApiModelProperty(value = "积分商品id")
private Integer id;
/**
* 所需积分
*/
@ApiModelProperty(value = "所需积分")
private Integer needPoints;
/**
* 商品名字
*/
@ApiModelProperty(value = "商品名字")
private String goods;
/**
* 商品图片
*/
@ApiModelProperty(value = "商品图片")
private String goodsUrl;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.mmc.oms.entity.mall;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName points_order
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PointsOrderDO implements Serializable {
/**
*
*/
private Integer id;
/**
* 购买积分商品的用户id
*/
@ApiModelProperty(value = "购买积分商品的用户id")
private Integer userId;
/**
* 积分商城id
*/
@ApiModelProperty(value = "积分商城id ")
private Integer pointsMallId;
/**
* 快递地址
*/
@ApiModelProperty(value = "快递地址")
private String address;
/**
* 快递单号
*/
@ApiModelProperty(value = "快递单号")
private String trackingNumber;
/**
* 收货姓名
*/
@ApiModelProperty(value = "收货姓名")
private String userName;
/**
* 收货电话
*/
@ApiModelProperty(value = "收货电话")
private String userPhone;
/**
* 快递公司
*/
@ApiModelProperty(value = "快递公司")
private String trackintCompany;
/**
* 是否发货
*/
@ApiModelProperty(value = "是否发货 1发货 0没")
private Integer sendStatus;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiResponses;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -72,4 +73,6 @@ public interface UserAppApi {
@PostMapping("/back-user/feignListBAccountPage")
List<UserAccountSimpleDTO> feignListBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO, @RequestHeader("token") String token);
@GetMapping("/userPoint/feignChangeUserPoints")
ResultBody feignChangeUserPoints(@RequestHeader("token") String token,@RequestHeader HttpServletRequest request,@RequestParam int changePoint,@RequestParam String reason);
}
......@@ -12,6 +12,7 @@ import com.mmc.oms.model.vo.uav.PayUavWalletVO;
import com.mmc.oms.model.vo.wallet.TopUpOrderVO;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -80,4 +81,12 @@ public class UserAppApiHystrix implements UserAppApi {
log.error("熔断:UserAppApiHystrix.feignListBAccountPage==error==>param:{}", JSONObject.toJSONString(bUserAccountQO));
return null;
}
@Override
public ResultBody feignChangeUserPoints(String token, HttpServletRequest request, int changePoint, String reason) {
log.error("熔断:UserAppApiHystrix.feignChangeUserPoints==error==>param:{}", JSONObject.toJSONString(changePoint));
return null;
}
}
package com.mmc.oms.model.qo;
import com.mmc.oms.common.publicinterface.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GeneralQO {
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.oms.model.qo;
import com.mmc.oms.common.publicinterface.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PointsMallOrderQO {
@ApiModelProperty("是否管理员 0不是 1是")
private int isAdmin;
private Integer userId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.oms.model.vo.mall;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mmc.oms.common.publicinterface.Create;
import com.mmc.oms.entity.mall.PointsMallDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PointsOrderVO {
private Integer id;
/**
* 购买积分商品的用户id
*/
@ApiModelProperty(value = "购买积分商品的用户id")
private Integer userId;
/**
* 积分商城id
*/
@ApiModelProperty(value = "积分商城id ")
private Integer pointsMallId;
/**
* 快递地址
*/
@ApiModelProperty(value = "快递地址")
private String address;
/**
* 快递单号
*/
@ApiModelProperty(value = "快递单号")
private String trackingNumber;
/**
* 收货姓名
*/
@ApiModelProperty(value = "收货姓名")
private String userName;
/**
* 收货电话
*/
@ApiModelProperty(value = "收货电话")
private String userPhone;
/**
* 快递公司
*/
@ApiModelProperty(value = "快递公司")
private String trackintCompany;
/**
* 是否发货
*/
@ApiModelProperty(value = "是否发货 1发货 0没")
private Integer sendStatus;
/**
* 所需积分
*/
@ApiModelProperty(value = "所需积分")
private Integer needPoints;
/**
* 商品名字
*/
@ApiModelProperty(value = "商品名字")
private String goods;
@ApiModelProperty(value = "订单创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 商品图片
*/
@ApiModelProperty(value = "商品图片")
private String goodsUrl;
private static final long serialVersionUID = 1L;
}
......@@ -114,6 +114,7 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
return topUpOrder(commonPaymentVO, token, userAccountId);
case "6":
return payCurriculumOrder(commonPaymentVO, token);
//聊天订单支付
case "7":
return chatOrder(commonPaymentVO, token);
default:
......@@ -253,7 +254,6 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
* @return
*/
private ResultBody publishServicePay(CommonPaymentVO commonPaymentVO, String token, Integer userAccountId, HttpServletRequest request) {
if ("4".equals(commonPaymentVO.getOrderPort().toString())) {
try {
TimeUnit.SECONDS.sleep(1);
......
package com.mmc.oms.service.mall;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.entity.mall.PointsMallDO;
import com.mmc.oms.entity.mall.PointsOrderDO;
import com.mmc.oms.model.qo.GeneralQO;
import com.mmc.oms.model.qo.PointsMallOrderQO;
import javax.servlet.http.HttpServletRequest;
/**
* @author Admin
*/
public interface PointMallService {
/**
* 添加商品
* @param pointsMallDO 参数
* @return {@link ResultBody}
*/
ResultBody insertMall(PointsMallDO pointsMallDO);
ResultBody deleteMall(Integer id);
/**
* 修改商品
* @param pointsMallDO 参数
* @return {@link ResultBody}
*/
ResultBody updateMall(PointsMallDO pointsMallDO);
/**
* 获取积分商品详情
* @param id
* @return {@link ResultBody}
*/
ResultBody getMallInfo(Integer id);
/**
* 获取积分商品列表
* @param qo 参数
* @return {@link ResultBody}
*/
ResultBody getMallList(GeneralQO qo);
ResultBody insertPointsOrder(PointsOrderDO pointsOrderDO, HttpServletRequest request);
ResultBody getOrderList(PointsMallOrderQO qo);
ResultBody updateGoodsOrder(PointsOrderDO param);
}
package com.mmc.oms.service.mall.impl;
import com.mmc.oms.common.result.PageResult;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.dao.mall.PointsMallDao;
import com.mmc.oms.dao.mall.PointsOrderDao;
import com.mmc.oms.entity.mall.PointsMallDO;
import com.mmc.oms.entity.mall.PointsOrderDO;
import com.mmc.oms.feign.UserAppApi;
import com.mmc.oms.model.qo.GeneralQO;
import com.mmc.oms.model.qo.PointsMallOrderQO;
import com.mmc.oms.model.vo.mall.PointsOrderVO;
import com.mmc.oms.service.mall.PointMallService;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author Admin
*/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
@AllArgsConstructor
public class PointsMallServiceImpl implements PointMallService {
private PointsMallDao pointsMallDao;
private PointsOrderDao pointsOrderDao;
private UserAppApi userAppApi;
@Override
public ResultBody insertMall(PointsMallDO pointsMallDO) {
pointsMallDao.insert(pointsMallDO);
return ResultBody.success();
}
@Override
public ResultBody deleteMall(Integer id) {
pointsMallDao.deleteByPrimaryKey(id);
return ResultBody.success();
}
@Override
public ResultBody updateMall(PointsMallDO pointsMallDO) {
pointsMallDao.updateByPrimaryKeySelective(pointsMallDO);
return ResultBody.success();
}
/**
* 获取积分商品详情
*
* @param id
* @return {@link ResultBody}
*/
@Override
public ResultBody getMallInfo(Integer id) {
PointsMallDO pointsMallDO = pointsMallDao.selectByPrimaryKey(id);
return ResultBody.success(pointsMallDO);
}
/**
* 获取积分商品列表
*
* @param qo 参数
* @return {@link ResultBody}
*/
@Override
public ResultBody getMallList(GeneralQO qo) {
int count = pointsMallDao.count();
Integer pageNo = qo.getPageNo();
if(count == 0){
return ResultBody.success(PageResult.buildPage(pageNo,qo.getPageSize(),count,null));
}
qo.buildCurrentPage();
List<PointsMallDO> pointsMallDOS = pointsMallDao.selectAll(qo);
return ResultBody.success(PageResult.buildPage(pageNo,qo.getPageSize(),count,pointsMallDOS));
}
@Override
public ResultBody insertPointsOrder(PointsOrderDO pointsOrderDO, HttpServletRequest request) {
PointsMallDO pointsMallDO = pointsMallDao.selectByPrimaryKey(pointsOrderDO.getPointsMallId());
int changePoint = -pointsMallDO.getNeedPoints();
ResultBody resultBody = userAppApi.feignChangeUserPoints(request.getHeader("token"), request, changePoint, "购买积分商品");
if(!"200".equals(resultBody.getCode())){
return resultBody;
}
pointsOrderDao.insert(pointsOrderDO);
return ResultBody.success();
}
@Override
public ResultBody getOrderList(PointsMallOrderQO qo) {
int count = pointsOrderDao.countOrderList(qo);
if(count == 0){
return ResultBody.success(PageResult.buildPage(qo.getPageNo(),qo.getPageSize(),count,null));
}
Integer pageNo = qo.getPageNo();
qo.buildCurrentPage();
List<PointsOrderVO> orderList = pointsOrderDao.getOrderList(qo);
return ResultBody.success(PageResult.buildPage(pageNo,qo.getPageSize(),count,orderList));
}
@Override
public ResultBody updateGoodsOrder(PointsOrderDO param) {
int i = pointsOrderDao.updateByPrimaryKeySelective(param);
if(i == 0){
return ResultBody.error("更新失败");
}
return ResultBody.success();
}
}
......@@ -7,9 +7,8 @@ spring:
password: IUAV_DEV@2023&MYSQL
redis:
database: 1
host: r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
host: 127.0.0.1
port: 6379
password: MMC@2022&REDIS
jedis:
pool:
max-active: 2
......
<?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.mmc.oms.dao.mall.PointsMallDao">
<resultMap id="BaseResultMap" type="com.mmc.oms.entity.mall.PointsMallDO">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="needPoints" column="need_points" jdbcType="INTEGER"/>
<result property="goods" column="goods" jdbcType="VARCHAR"/>
<result property="goodsUrl" column="goods_url" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,
need_points,goods,goods_url
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from points_mall
where is_delete = 0 and
id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultType="com.mmc.oms.entity.mall.PointsMallDO">
select id,need_points,goods,goods_url from points_mall
where is_delete = 0
limit #{pageNo},#{pageSize}
</select>
<select id="count" resultType="java.lang.Integer">
select count(1) from points_mall where is_delete = 0
</select>
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update points_mall
set is_delete = 1 where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mmc.oms.entity.mall.PointsMallDO" useGeneratedKeys="true">
insert into points_mall
( id
,need_points,goods,goods_url
)
values (#{id,jdbcType=INTEGER}
,#{needPoints,jdbcType=INTEGER},#{goods,jdbcType=VARCHAR},#{goodsUrl,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mmc.oms.entity.mall.PointsMallDO" useGeneratedKeys="true">
insert into points_mall
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="needPoints != null">need_points,</if>
<if test="goods != null">goods,</if>
<if test="goodsUrl != null">goods_url,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
<if test="needPoints != null">#{needPoints,jdbcType=INTEGER},</if>
<if test="goods != null">#{goods,jdbcType=VARCHAR},</if>
<if test="goodsUrl != null">#{goodsUrl,jdbcType=VARCHAR},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.mmc.oms.entity.mall.PointsMallDO">
update points_mall
<set>
<if test="needPoints != null">
need_points = #{needPoints,jdbcType=INTEGER},
</if>
<if test="goods != null">
goods = #{goods,jdbcType=VARCHAR},
</if>
<if test="goodsUrl != null">
goods_url = #{goodsUrl,jdbcType=VARCHAR},
</if>
</set>
where is_delete = 0 and id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.mmc.oms.entity.mall.PointsMallDO">
update points_mall
set
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
need_points = #{needPoints,jdbcType=INTEGER},
goods = #{goods,jdbcType=VARCHAR},
goods_url = #{goodsUrl,jdbcType=VARCHAR}
where is_delete = 0 and id = #{id,jdbcType=INTEGER}
</update>
</mapper>
<?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.mmc.oms.dao.mall.PointsOrderDao">
<resultMap id="BaseResultMap" type="com.mmc.oms.entity.mall.PointsOrderDO">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="pointsMallId" column="points_mall_id" jdbcType="INTEGER"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="trackingNumber" column="tracking_number" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userPhone" column="user_phone" jdbcType="CHAR"/>
<result property="trackintCompany" column="trackint_company" jdbcType="VARCHAR"/>
<result property="sendStatus" column="send_status" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,
user_id,points_mall_id,address,
tracking_number,user_name,user_phone,
trackint_company,send_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from points_order
where id = #{id,jdbcType=INTEGER}
</select>
<select id="countOrderList" resultType="java.lang.Integer">
select count(1)
from points_order
where 1=1
<if test="userId != null">
and user_id = #{userId,jdbcType=INTEGER}
</if>
</select>
<select id="getOrderList" resultType="com.mmc.oms.model.vo.mall.PointsOrderVO">
select
po.id,
user_id,points_mall_id,address,
tracking_number,user_name,user_phone,
trackint_company,send_status,need_points,goods,goods_url,po.create_time
from points_order po
inner join points_mall pm on po.points_mall_id = pm.id
where 1=1
<if test="userId != null">
and user_id = #{userId,jdbcType=INTEGER}
</if>
order by po.create_time desc
limit #{pageNo},#{pageSize}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from points_order
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mmc.oms.entity.mall.PointsOrderDO" useGeneratedKeys="true">
insert into points_order
( id
,user_id,points_mall_id,address
,tracking_number,user_name,user_phone
,trackint_company,send_status)
values (#{id,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER},#{pointsMallId,jdbcType=INTEGER},#{address,jdbcType=VARCHAR}
,#{trackingNumber,jdbcType=VARCHAR},#{userName,jdbcType=VARCHAR},#{userPhone,jdbcType=CHAR}
,#{trackintCompany,jdbcType=VARCHAR},0)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mmc.oms.entity.mall.PointsOrderDO" useGeneratedKeys="true">
insert into points_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="userId != null">user_id,</if>
<if test="pointsMallId != null">points_mall_id,</if>
<if test="address != null">address,</if>
<if test="trackingNumber != null">tracking_number,</if>
<if test="userName != null">user_name,</if>
<if test="userPhone != null">user_phone,</if>
<if test="trackintCompany != null">trackint_company,</if>
<if test="sendStatus != null">send_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
<if test="userId != null">#{userId,jdbcType=INTEGER},</if>
<if test="pointsMallId != null">#{pointsMallId,jdbcType=INTEGER},</if>
<if test="address != null">#{address,jdbcType=VARCHAR},</if>
<if test="trackingNumber != null">#{trackingNumber,jdbcType=VARCHAR},</if>
<if test="userName != null">#{userName,jdbcType=VARCHAR},</if>
<if test="userPhone != null">#{userPhone,jdbcType=CHAR},</if>
<if test="trackintCompany != null">#{trackintCompany,jdbcType=VARCHAR},</if>
<if test="sendStatus != null">#{sendStatus,jdbcType=INTEGER},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.mmc.oms.entity.mall.PointsOrderDO">
update points_order
<set>
update_time = NOW(),
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="pointsMallId != null">
points_mall_id = #{pointsMallId,jdbcType=INTEGER},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="trackingNumber != null">
tracking_number = #{trackingNumber,jdbcType=VARCHAR},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="userPhone != null">
user_phone = #{userPhone,jdbcType=CHAR},
</if>
<if test="trackintCompany != null">
trackint_company = #{trackintCompany,jdbcType=VARCHAR},
</if>
<if test="sendStatus != null">
send_status = #{sendStatus,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.mmc.oms.entity.mall.PointsOrderDO">
update points_order
set
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=INTEGER},
points_mall_id = #{pointsMallId,jdbcType=INTEGER},
address = #{address,jdbcType=VARCHAR},
tracking_number = #{trackingNumber,jdbcType=VARCHAR},
user_name = #{userName,jdbcType=VARCHAR},
user_phone = #{userPhone,jdbcType=CHAR},
trackint_company = #{trackintCompany,jdbcType=VARCHAR},
send_status = #{sendStatus,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论