Merge remote-tracking branch 'origin/dev' into hph

# Conflicts:
#	src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java
This commit is contained in:
韩鹏辉
2024-07-11 09:30:28 +08:00
14 changed files with 402 additions and 298 deletions

View File

@@ -55,7 +55,12 @@ public class LoginFilter implements Filter {
"cashierService/product/productInfo",
"cashierService/notify/**",//登录部分接口不校验
"notify/**",
"cashierService/table/**" //回调部分接口不校验
"cashierService/table/**", //回调部分接口不校验
// 点歌部分不需要登录
"/cashierService/song/detail",
"/cashierService/song/record",
"/cashierService/song"
);
@Autowired

View File

@@ -75,6 +75,19 @@ public class LoginContoller {
return loginService.wxBusinessLogin(openid,shopId);
}
@GetMapping("/wx/business/openId")
public Result getOpenId(
@RequestParam String code
) {
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
String openid = SessionKeyOpenId.getString("openid");
if(Objects.isNull(openid)){
return Result.fail("获取微信id失败");
}
return Result.successWithData(openid);
}
/**
* 小程序登录
*

View File

@@ -147,6 +147,25 @@ public class NotifyController {
return null;
}
/**
* 点歌支付回调
* @param request
* @return
*/
@RequestMapping("songOrderCallBack")
public String songOrderCallBack(HttpServletRequest request) {
Map<String, Object> map = getParameterMap(request);
log.info("点歌支付回调返回信息:{}", JSONUtil.toJsonStr(map));
if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) {
JSONObject object = JSONUtil.parseObj(map.get("bizData"));
if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) {
String orderNo = object.getStr("mchOrderNo");
return payService.songOrderSuccess(orderNo, DateUtils.getTime(new Date()));
}
}
return null;
}
private Map getParameterMap(HttpServletRequest request) {
RequestWrapper requestWrapper = new RequestWrapper(request);

View File

@@ -1,6 +1,5 @@
package com.chaozhanggui.system.cashierservice.controller;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
import com.chaozhanggui.system.cashierservice.service.TbShopSongService;
import com.chaozhanggui.system.cashierservice.sign.Result;
@@ -24,6 +23,7 @@ public class ShopSongController {
/**
* 获取所有歌曲,支持搜索及分页
*
* @param page 页数
* @param size 数量
* @param keyWord 搜索关键字
@@ -42,20 +42,22 @@ public class ShopSongController {
@GetMapping("/detail")
public Result getRecord(
@RequestHeader("openId") String openId,
@RequestParam Integer id
) {
return Result.successWithData(shopSongService.getDetail(TokenUtil.getUserId(), id));
return Result.successWithData(shopSongService.getDetail(openId, id));
}
@GetMapping("/record")
public Result getRecord(
@RequestHeader("openId") String openId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) Integer state,
@RequestParam(defaultValue = "true") boolean isDesc
) {
return Result.successWithData(shopSongService.getRecord(TokenUtil.getUserId(), page, size, state, isDesc));
return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc));
}
@@ -64,6 +66,6 @@ public class ShopSongController {
@RequestHeader("openId") String openId,
@RequestBody SongOrderDTO songOrderDTO
) {
return Result.successWithData(shopSongService.createOrder(TokenUtil.getUserId(), songOrderDTO, openId));
return Result.successWithData(shopSongService.createOrder(songOrderDTO, openId));
}
}

View File

@@ -34,11 +34,11 @@ public interface TbShopSongOrderMapper {
" tb_shop_song_order AS a\n" +
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
" WHERE\n" +
" a.user_id = #{userId}\n" +
" a.open_id = #{openId}\n" +
" <if test=\"state!=null\">AND a.state = #{state}</if></script>")
List<Map<String, Object>> selectByUserId(@Param("userId") Integer userId, @Param("state") Integer state);
List<Map<String, Object>> selectByUserId(@Param("openId") String openId, @Param("state") Integer state);
Map<String, Object> selectByUserIdAndId(@Param("userId") Integer userId, @Param("id") Integer id);
Map<String, Object> selectByUserIdAndId(@Param("openId") String openId, @Param("id") Integer id);
@Select("select * from fycashier.tb_shop_song_order where order_no=#{orderNo};")
TbShopSongOrder selectByOrderNo(@Param("orderNo") String orderNo);

View File

@@ -29,7 +29,7 @@ public class TbShopSongOrder implements Serializable {
/**
* 用户id
*/
private Integer userId;
private String openId;
/**
* 支付金额
@@ -98,7 +98,7 @@ public class TbShopSongOrder implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getSongId() == null ? other.getSongId() == null : this.getSongId().equals(other.getSongId()))
&& (this.getSongName() == null ? other.getSongName() == null : this.getSongName().equals(other.getSongName()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
&& (this.getPayMoney() == null ? other.getPayMoney() == null : this.getPayMoney().equals(other.getPayMoney()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
@@ -118,7 +118,7 @@ public class TbShopSongOrder implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getSongId() == null) ? 0 : getSongId().hashCode());
result = prime * result + ((getSongName() == null) ? 0 : getSongName().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
result = prime * result + ((getPayMoney() == null) ? 0 : getPayMoney().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
@@ -141,7 +141,7 @@ public class TbShopSongOrder implements Serializable {
sb.append(", id=").append(id);
sb.append(", songId=").append(songId);
sb.append(", songName=").append(songName);
sb.append(", userId=").append(userId);
sb.append(", openId=").append(openId);
sb.append(", payMoney=").append(payMoney);
sb.append(", state=").append(state);
sb.append(", createTime=").append(createTime);

View File

@@ -72,6 +72,9 @@ public class PayService {
@Autowired
TbShopPayTypeMapper tbShopPayTypeMapper;
@Autowired
private TbShopSongOrderMapper tbShopSongOrderMapper;
@Value("${ysk.url}")
private String url;
@@ -117,13 +120,15 @@ public class PayService {
private String thirdUrl;
@Value("${thirdPay.callInBack}")
private String callInBack;
@Value("${thirdPay.callFSTBack}")
private String callFSTBack;
@Value("${thirdPay.songOrderBack}")
private String songOrderBack;
@Autowired
ThirdPayService thirdPayService;
@@ -131,7 +136,6 @@ public class PayService {
TbUserInfoMapper tbUserInfoMapper;
@Resource
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
@Autowired
@@ -181,7 +185,6 @@ public class PayService {
}
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
@@ -300,17 +303,10 @@ public class PayService {
}
return Result.fail("失败");
}
@Transactional(rollbackFor = Exception.class)
public Result accountPay(String orderId, String memberId, String token, String pwd) {
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(memberId)) {
@@ -474,8 +470,7 @@ public class PayService {
jsonObject.put("orderId", orderId);
producer.putOrderCollect(jsonObject.toJSONString());
return Result.success(CodeEnum.SUCCESS);
}
else {
} else {
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(orderInfo.getShopId().toString());
if (tbMerchantAccount == null) {
throw new MsgException("生成订单错误");
@@ -513,8 +508,7 @@ public class PayService {
payment.setOrderId(orderInfo.getOrderNo());
payment.setCreatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.insert(payment);
}
else {
} else {
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
@@ -560,8 +554,7 @@ public class PayService {
return Result.fail("支付失败");
}
}
}
else {
} else {
String reqbody = "";
if (body.length() > 15) {
@@ -634,7 +627,6 @@ public class PayService {
}
if ("ysk".equals(thirdPayType)) {
TradeQueryReq req = new TradeQueryReq();
req.setAppId(thirdApply.getAppId());
@@ -681,7 +673,6 @@ public class PayService {
producer.putOrderCollect(jsonObject.toJSONString());
log.info("发送打印数据");
producer.printMechine(orderInfo.getId() + "");
@@ -734,7 +725,6 @@ public class PayService {
producer.putOrderCollect(jsonObject.toJSONString());
log.info("发送打印数据");
producer.printMechine(orderInfo.getId() + "");
sendOrderToClient(orderInfo);
@@ -778,7 +768,6 @@ public class PayService {
}
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
@@ -855,7 +844,6 @@ public class PayService {
}
@Transactional(rollbackFor = Exception.class)
public String callBackPay(String payOrderNO) {
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
@@ -897,7 +885,6 @@ public class PayService {
}
@Transactional(rollbackFor = Exception.class)
public String callBackPayFST(String payOrderNO) {
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
@@ -979,7 +966,6 @@ public class PayService {
}
public Result getShopByMember(String userId, String shopId, int page, int pageSize) {
PageHelper.startPage(page, pageSize);
List<ShopUserListVo> list = tbShopUserMapper.selectByUserId(userId, shopId);
@@ -1005,7 +991,6 @@ public class PayService {
}
/**
* 生成长度为12的随机串
*
@@ -1111,8 +1096,7 @@ public class PayService {
}
public String fstMemberInSuccess(String payOrderNO,String tradeNo) throws Exception{
public String fstMemberInSuccess(String payOrderNO, String tradeNo) {
TbMemberIn memberIn = tbMemberInMapper.selectByOrderNo(payOrderNO);
if (ObjectUtil.isEmpty(memberIn)) {
return "充值记录不存在";
@@ -1223,6 +1207,7 @@ public class PayService {
/**
* 点歌支付成功
*
* @param mchOrderNo 商户订单编号
* @param orderNo
* @return
@@ -1245,6 +1230,75 @@ public class PayService {
return "success";
}
public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException {
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
return Result.fail("付款用户[openId]参数不能为空");
}
TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByPrimaryKey(Long.valueOf(orderId));
if (songOrder.getState() != 0 && songOrder.getState() != -1) {
return Result.fail("订单状态异常,不允许支付");
}
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(songOrder.getOrderNo());
if (ObjectUtil.isEmpty(payment) || payment == null) {
payment = new TbOrderPayment();
payment.setPayTypeId("ysk");
payment.setAmount(songOrder.getPayMoney());
payment.setPaidAmount(songOrder.getPayMoney());
payment.setHasRefundAmount(BigDecimal.ZERO);
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
payment.setReceived(payment.getAmount());
payment.setChangeFee(BigDecimal.ZERO);
payment.setShopId(shopId);
payment.setOrderId(songOrder.getOrderNo());
payment.setCreatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.insert(payment);
} else {
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKey(payment);
}
String reqbody = "点歌:" + songOrder.getSongName();
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(),
reqbody, reqbody, payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
"WECHAT", thirdApply.getSmallAppid(), openId, ip, songOrder.getOrderNo(), thirdApply.getStoreId(),
songOrderBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();
if ("TRADE_AWAIT".equals(wxScanPayResp.getState())) {
payment.setTradeNumber(wxScanPayResp.getPayOrderId());
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
ObjectMapper mapper = new ObjectMapper();
return Result.success(CodeEnum.SUCCESS, mapper.readTree(wxScanPayResp.getPayInfo()));
} else {
return Result.fail(publicResp.getMsg());
}
}
}
return Result.fail("失败");
}
@Transactional(rollbackFor = Exception.class)
public String songOrderSuccess(String mchOrderNo, String orderNo) {
TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByOrderNo(mchOrderNo);
if (ObjectUtil.isEmpty(songOrder)) {
return "订单信息不存在";
}
log.info("更新点歌订单:{}", songOrder);
shopSongOrderService.successPay(mchOrderNo);
return "SUCCESS";
}
// public Result returnOrder(){
//
@@ -1295,7 +1349,4 @@ public class PayService {
// }
}

View File

@@ -25,24 +25,23 @@ public interface TbShopSongService {
*/
PageInfo<?> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc);
Object getRecord(Integer userId, Integer page, Integer size, Integer state, boolean isDesc);
Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc);
/**
* 创建订单
*
* @param userId 用户id
* @param songOrderDTO 订单信息
* @param openId
* @return 支付信息
*/
JsonNode createOrder(Integer userId, SongOrderDTO songOrderDTO, String openId);
JsonNode createOrder(SongOrderDTO songOrderDTO, String openId);
/**
* 订单详情
*
* @param userId 用户id
* @param openId 用户id
* @param id 订单id
* @return 订单信息
*/
Map<String, Object> getDetail(Integer userId, Integer id);
Map<String, Object> getDetail(String openId, Integer id);
}

View File

@@ -9,11 +9,14 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopSong;
import com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder;
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.service.PayService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongOrderService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongService;
import com.chaozhanggui.system.cashierservice.dao.TbShopSongMapper;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil;
import com.chaozhanggui.system.cashierservice.util.PayUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -47,14 +50,16 @@ public class TbShopSongServiceImpl implements TbShopSongService{
private final PayUtils payUtils;
private final TbShopSongMapper shopSongMapper;
private final PayService payService;
public TbShopSongServiceImpl(RedisTemplate<String, Object> redisTemplate, @Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService, TbShopSongOrderMapper shopSongOrderMapper, TbMerchantThirdApplyMapper tbMerchantThirdApplyMapper, PayUtils payUtils, TbShopSongMapper shopSongMapper) {
public TbShopSongServiceImpl(RedisTemplate<String, Object> redisTemplate, @Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService, TbShopSongOrderMapper shopSongOrderMapper, TbMerchantThirdApplyMapper tbMerchantThirdApplyMapper, PayUtils payUtils, TbShopSongMapper shopSongMapper, PayService payService) {
this.redisTemplate = redisTemplate;
this.shopSongOrderService = shopSongOrderService;
this.shopSongOrderMapper = shopSongOrderMapper;
this.tbMerchantThirdApplyMapper = tbMerchantThirdApplyMapper;
this.payUtils = payUtils;
this.shopSongMapper = shopSongMapper;
this.payService = payService;
}
@Override
@@ -65,9 +70,9 @@ public class TbShopSongServiceImpl implements TbShopSongService{
}
@Override
public Object getRecord(Integer userId, Integer page, Integer size, Integer state, boolean isDesc) {
public Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc) {
PageHelper.startPage(page, size);
List<Map<String, Object>> songOrders = shopSongOrderMapper.selectByUserId(userId, state);
List<Map<String, Object>> songOrders = shopSongOrderMapper.selectByUserId(openId, state);
ArrayList<Map<String, Object>> infos = new ArrayList<>();
for (int i = 0; i < songOrders.size(); i++) {
@@ -80,14 +85,14 @@ public class TbShopSongServiceImpl implements TbShopSongService{
@Override
@Transactional
public JsonNode createOrder(Integer userId, SongOrderDTO songOrderDTO, String openId) {
public JsonNode createOrder(SongOrderDTO songOrderDTO, String openId) {
TbShopSong song = shopSongMapper.selectById(songOrderDTO.getSongId());
if (song == null) {
throw new MsgException("歌曲不存在, 歌曲id: {}", songOrderDTO.getSongId());
}
String orderNo = "WX" + DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS")+ RandomUtil.randomInt(1000, 9999);
String orderNo = "SONG" + DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS")+ RandomUtil.randomInt(1000, 9999);
TbShopSongOrder shopSongOrder = new TbShopSongOrder();
shopSongOrder.setUserId(userId);
shopSongOrder.setOpenId(openId);
shopSongOrder.setOrderNo(orderNo);
shopSongOrder.setCreateTime(DateUtil.date());
shopSongOrder.setSongId(song.getId());
@@ -97,7 +102,8 @@ public class TbShopSongServiceImpl implements TbShopSongService{
shopSongOrder.setFromName(shopSongOrder.getFromName());
shopSongOrder.setToName(shopSongOrder.getToName());
shopSongOrder.setNote(songOrderDTO.getNote());
shopSongOrder.setShopId(shopSongOrder.getShopId());
shopSongOrder.setShopId(songOrderDTO.getShopId());
shopSongOrder.setPayMoney(song.getPrice());
shopSongOrderMapper.insert(shopSongOrder);
TbMerchantThirdApply tbMerchantThirdApply = tbMerchantThirdApplyMapper.selectByShopId(songOrderDTO.getShopId());
@@ -105,13 +111,18 @@ public class TbShopSongServiceImpl implements TbShopSongService{
throw new MsgException("三方支付参数不存在");
}
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
return payUtils.getWxPay(IpUtil.getIpAddr(attr.getRequest()), orderNo, userId, "", songOrderDTO.getShopId(), song.getPrice(),tbMerchantThirdApply.getId(),
openId, tbMerchantThirdApply);
try {
Result result = payService.paySongOrder(openId, String.valueOf(shopSongOrder.getShopId()), shopSongOrder.getId(), IpUtil.getIpAddr(attr.getRequest()), tbMerchantThirdApply);
return (JsonNode) result.getData();
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
@Override
public Map<String, Object> getDetail(Integer userId, Integer id) {
Map<String, Object> map = shopSongOrderMapper.selectByUserIdAndId(userId, id);
public Map<String, Object> getDetail(String openId, Integer id) {
Map<String, Object> map = shopSongOrderMapper.selectByUserIdAndId(openId, id);
if (map == null) {
throw new MsgException("订单不存在");
}

View File

@@ -55,6 +55,7 @@ ysk:
thirdPay:
callInBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/fstmemberInCallBack
callFSTBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/notifyfstCallBack
songOrderBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/songOrderCallBack
server:
port: 9888
prod: dev1

View File

@@ -53,6 +53,7 @@ ysk:
thirdPay:
callInBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/fstmemberInCallBack
callFSTBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/notifyfstCallBack
songOrderBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/songOrderCallBack
server:
port: 9889
prod: devyhq

View File

@@ -54,6 +54,7 @@ ysk:
thirdPay:
callInBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/fstmemberInCallBack
callFSTBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/notifyfstCallBack
songOrderBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/songOrderCallBack
prod: prod1
queue: cart_queue_putprod1
subscribe:

View File

@@ -54,6 +54,7 @@ ysk:
thirdPay:
callInBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/fstmemberInCallBack
callFSTBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/notifyfstCallBack
songOrderBack: https://cashier.sxczgkj.cn${server.servlet.context-path}notify/songOrderCallBack
prod: prod2
queue: cart_queue_putprod2

View File

@@ -8,7 +8,7 @@
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="songId" column="song_id" jdbcType="INTEGER"/>
<result property="songName" column="song_name" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="openId" column="open_id" jdbcType="INTEGER"/>
<result property="payMoney" column="pay_money" jdbcType="DECIMAL"/>
<result property="state" column="state" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@@ -23,7 +23,7 @@
<sql id="Base_Column_List">
id,song_id,song_name,
user_id,pay_money,state,
open_id,pay_money,state,
create_time,client_type,order_no,
from_name,to_name,note,
shop_id,real_money
@@ -43,12 +43,12 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true">
insert into tb_shop_song_order
( id,song_id,song_name
,user_id,pay_money,state
,open_id,pay_money,state
,create_time,client_type,order_no
,from_name,to_name,note
,shop_id,real_money)
values (#{id,jdbcType=INTEGER},#{songId,jdbcType=INTEGER},#{songName,jdbcType=VARCHAR}
,#{userId,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{state,jdbcType=TINYINT}
,#{openId,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{state,jdbcType=TINYINT}
,#{createTime,jdbcType=TIMESTAMP},#{clientType,jdbcType=TINYINT},#{orderNo,jdbcType=VARCHAR}
,#{fromName,jdbcType=VARCHAR},#{toName,jdbcType=VARCHAR},#{note,jdbcType=VARCHAR}
,#{shopId,jdbcType=INTEGER},#{realMoney,jdbcType=DECIMAL})
@@ -59,7 +59,7 @@
<if test="id != null">id,</if>
<if test="songId != null">song_id,</if>
<if test="songName != null">song_name,</if>
<if test="userId != null">user_id,</if>
<if test="openId != null">open_id,</if>
<if test="payMoney != null">pay_money,</if>
<if test="state != null">state,</if>
<if test="createTime != null">create_time,</if>
@@ -75,7 +75,7 @@
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="songId != null">#{songId,jdbcType=INTEGER},</if>
<if test="songName != null">#{songName,jdbcType=VARCHAR},</if>
<if test="userId != null">#{userId,jdbcType=INTEGER},</if>
<if test="openId != null">#{openId,jdbcType=INTEGER},</if>
<if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
<if test="state != null">#{state,jdbcType=TINYINT},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
@@ -97,8 +97,8 @@
<if test="songName != null">
song_name = #{songName,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
<if test="openId != null">
open_id = #{openId,jdbcType=INTEGER},
</if>
<if test="payMoney != null">
pay_money = #{payMoney,jdbcType=DECIMAL},
@@ -138,7 +138,7 @@
set
song_id = #{songId,jdbcType=INTEGER},
song_name = #{songName,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=INTEGER},
open_id = #{openId,jdbcType=INTEGER},
pay_money = #{payMoney,jdbcType=DECIMAL},
state = #{state,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
@@ -159,7 +159,7 @@
tb_shop_song_order AS a
LEFT JOIN tb_shop_song AS b ON a.song_id = b.id
WHERE
a.user_id = #{userId}
a.open_id = #{openId}
AND a.id=#{id}
</select>
</mapper>