parent
c63f6a3d05
commit
c082fb8656
@ -0,0 +1,93 @@
|
||||
package com.cyl.manager.oms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cyl.manager.oms.domain.WechatPaymentHistory;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.cyl.manager.oms.convert.WechatPaymentHistoryConvert;
|
||||
import com.cyl.manager.oms.pojo.query.WechatPaymentHistoryQuery;
|
||||
import com.cyl.manager.oms.service.WechatPaymentHistoryService;
|
||||
import com.cyl.manager.oms.pojo.vo.WechatPaymentHistoryVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 微信订单表Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2023-07-12
|
||||
*/
|
||||
@Api(description ="微信订单表接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/pms/omsWechatPaymentHistory")
|
||||
public class WechatPaymentHistoryController extends BaseController {
|
||||
@Autowired
|
||||
private WechatPaymentHistoryService service;
|
||||
@Autowired
|
||||
private WechatPaymentHistoryConvert convert;
|
||||
|
||||
@ApiOperation("查询微信订单表列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<WechatPaymentHistory>> list(@RequestBody WechatPaymentHistoryQuery query, Pageable page) {
|
||||
List<WechatPaymentHistory> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出微信订单表列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:export')")
|
||||
@Log(title = "微信订单表", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(WechatPaymentHistoryQuery query) {
|
||||
List<WechatPaymentHistory> list = service.selectList(query, null);
|
||||
ExcelUtil<WechatPaymentHistoryVO> util = new ExcelUtil<>(WechatPaymentHistoryVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "微信订单表数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取微信订单表详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<WechatPaymentHistory> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增微信订单表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:add')")
|
||||
@Log(title = "微信订单表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody WechatPaymentHistory wechatPaymentHistory) {
|
||||
return ResponseEntity.ok(service.insert(wechatPaymentHistory));
|
||||
}
|
||||
|
||||
@ApiOperation("修改微信订单表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:edit')")
|
||||
@Log(title = "微信订单表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody WechatPaymentHistory wechatPaymentHistory) {
|
||||
return ResponseEntity.ok(service.update(wechatPaymentHistory));
|
||||
}
|
||||
|
||||
@ApiOperation("删除微信订单表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:remove')")
|
||||
@Log(title = "微信订单表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cyl.manager.oms.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import com.cyl.manager.oms.domain.WechatPaymentHistory;
|
||||
import com.cyl.manager.oms.pojo.vo.WechatPaymentHistoryVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 微信订单表 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface WechatPaymentHistoryConvert {
|
||||
|
||||
List<WechatPaymentHistoryVO> dos2vos(List<WechatPaymentHistory> list);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.cyl.manager.oms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cyl.manager.oms.domain.WechatPaymentHistory;
|
||||
|
||||
/**
|
||||
* 微信订单表Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface WechatPaymentHistoryMapper extends BaseMapper<WechatPaymentHistory> {
|
||||
/**
|
||||
* 查询微信订单表列表
|
||||
*
|
||||
* @param wechatPaymentHistory 微信订单表
|
||||
* @return 微信订单表集合
|
||||
*/
|
||||
List<WechatPaymentHistory> selectByEntity(WechatPaymentHistory wechatPaymentHistory);
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.cyl.manager.oms.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cyl.manager.oms.domain.WechatPaymentHistory;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.cyl.manager.oms.mapper.WechatPaymentHistoryMapper;
|
||||
import com.cyl.manager.oms.pojo.query.WechatPaymentHistoryQuery;
|
||||
|
||||
/**
|
||||
* 微信订单表Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Service
|
||||
public class WechatPaymentHistoryService {
|
||||
@Autowired
|
||||
private WechatPaymentHistoryMapper wechatPaymentHistoryMapper;
|
||||
|
||||
/**
|
||||
* 查询微信订单表
|
||||
*
|
||||
* @param id 微信订单表主键
|
||||
* @return 微信订单表
|
||||
*/
|
||||
public WechatPaymentHistory selectById(Long id) {
|
||||
return wechatPaymentHistoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微信订单表列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param page 分页条件
|
||||
* @return 微信订单表
|
||||
*/
|
||||
public List<WechatPaymentHistory> selectList(WechatPaymentHistoryQuery query, Pageable page) {
|
||||
if (page != null) {
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||
}
|
||||
QueryWrapper<WechatPaymentHistory> qw = new QueryWrapper<>();
|
||||
String paymentId = query.getPaymentId();
|
||||
if (!StringUtils.isEmpty(paymentId)) {
|
||||
qw.eq("payment_id", paymentId);
|
||||
}
|
||||
Long memberId = query.getMemberId();
|
||||
if (memberId != null) {
|
||||
qw.eq("member_id", memberId);
|
||||
}
|
||||
String openid = query.getOpenid();
|
||||
if (!StringUtils.isEmpty(openid)) {
|
||||
qw.eq("openid", openid);
|
||||
}
|
||||
String realNameLike = query.getRealNameLike();
|
||||
if (!StringUtils.isEmpty(realNameLike)) {
|
||||
qw.like("real_name", realNameLike);
|
||||
}
|
||||
String title = query.getTitle();
|
||||
if (!StringUtils.isEmpty(title)) {
|
||||
qw.eq("title", title);
|
||||
}
|
||||
Long orderId = query.getOrderId();
|
||||
if (orderId != null) {
|
||||
qw.eq("order_id", orderId);
|
||||
}
|
||||
BigDecimal money = query.getMoney();
|
||||
if (money != null) {
|
||||
qw.eq("money", money);
|
||||
}
|
||||
Integer opType = query.getOpType();
|
||||
if (opType != null) {
|
||||
qw.eq("op_type", opType);
|
||||
}
|
||||
Integer paymentStatus = query.getPaymentStatus();
|
||||
if (paymentStatus != null) {
|
||||
qw.eq("payment_status", paymentStatus);
|
||||
}
|
||||
String attach = query.getAttach();
|
||||
if (!StringUtils.isEmpty(attach)) {
|
||||
qw.eq("attach", attach);
|
||||
}
|
||||
String responseBody = query.getResponseBody();
|
||||
if (!StringUtils.isEmpty(responseBody)) {
|
||||
qw.eq("response_body", responseBody);
|
||||
}
|
||||
return wechatPaymentHistoryMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信订单表
|
||||
*
|
||||
* @param wechatPaymentHistory 微信订单表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert(WechatPaymentHistory wechatPaymentHistory) {
|
||||
wechatPaymentHistory.setCreateTime(LocalDateTime.now());
|
||||
return wechatPaymentHistoryMapper.insert(wechatPaymentHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信订单表
|
||||
*
|
||||
* @param wechatPaymentHistory 微信订单表
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(WechatPaymentHistory wechatPaymentHistory) {
|
||||
return wechatPaymentHistoryMapper.updateById(wechatPaymentHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信订单表信息
|
||||
*
|
||||
* @param id 微信订单表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteById(Long id) {
|
||||
return wechatPaymentHistoryMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
<?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.cyl.manager.oms.mapper.WechatPaymentHistoryMapper">
|
||||
|
||||
<resultMap type="WechatPaymentHistory" id="OmsWechatPaymentHistoryResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="paymentId" column="payment_id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="openid" column="openid"/>
|
||||
<result property="realName" column="real_name"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="money" column="money"/>
|
||||
<result property="opType" column="op_type"/>
|
||||
<result property="paymentStatus" column="payment_status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="attach" column="attach"/>
|
||||
<result property="responseBody" column="response_body"/>
|
||||
<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="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsWechatPaymentHistoryVo">
|
||||
select id, payment_id, member_id, openid, real_name, title, order_id, money, op_type, payment_status, remark, attach, response_body, create_by, create_time, update_by, update_time from oms_wechat_payment_history
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="WechatPaymentHistory" resultMap="OmsWechatPaymentHistoryResult">
|
||||
<include refid="selectOmsWechatPaymentHistoryVo"/>
|
||||
<where>
|
||||
<if test="paymentId != null and paymentId != ''"> and payment_id = #{paymentId}</if>
|
||||
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
||||
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="money != null "> and money = #{money}</if>
|
||||
<if test="opType != null "> and op_type = #{opType}</if>
|
||||
<if test="paymentStatus != null "> and payment_status = #{paymentStatus}</if>
|
||||
<if test="attach != null and attach != ''"> and attach = #{attach}</if>
|
||||
<if test="responseBody != null and responseBody != ''"> and response_body = #{responseBody}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表', '3', '1', 'wechatPaymentHistory', 'pms/wechatPaymentHistory/index', 1, 0, 'C', '0', '0', 'pms:wechatPaymentHistory:list', '#', 1, sysdate(), '', null, '微信订单表菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:query', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:add', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:edit', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:remove', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('微信订单表导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:export', '#', 1, sysdate(), '', null, '');
|
||||
Loading…
Reference in new issue