1
This commit is contained in:
parent
85bfa6d832
commit
c9c87a87b7
@ -4,16 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.member.vo.MemberOrderVO;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@ -25,37 +22,45 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 订单Controller
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/member/order")
|
||||
public class MemberOrderController extends BaseController
|
||||
{
|
||||
public class MemberOrderController extends BaseController {
|
||||
@Autowired
|
||||
private IMemberOrderService memberOrderService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
*/
|
||||
* 订单列表查询
|
||||
*
|
||||
* @param memberOrder {@link MemberOrderVO}
|
||||
* @param pageNum 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 15:24 2025/3/25
|
||||
**/
|
||||
@PreAuthorize("@ss.hasPermi('member:order:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MemberOrder memberOrder)
|
||||
{
|
||||
|
||||
List<MemberOrder> list = memberOrderService.list();
|
||||
public AjaxResult list(MemberOrderVO memberOrder,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<MemberOrder> page = new Page<>(pageNum, pageSize);
|
||||
IPage<MemberOrderVO> list = memberOrderService.queryListPage(memberOrder, page);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:order:export')")
|
||||
@Log(title = "订单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MemberOrder memberOrder)
|
||||
{
|
||||
public void export(HttpServletResponse response, MemberOrder memberOrder) {
|
||||
List<MemberOrder> list = memberOrderService.list();
|
||||
ExcelUtil<MemberOrder> util = new ExcelUtil<MemberOrder>(MemberOrder.class);
|
||||
util.exportExcel(response, list, "订单数据");
|
||||
@ -66,8 +71,7 @@ public class MemberOrderController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:order:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return success(memberOrderService.getById(id));
|
||||
}
|
||||
|
||||
@ -77,8 +81,7 @@ public class MemberOrderController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('member:order:add')")
|
||||
@Log(title = "订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MemberOrder memberOrder)
|
||||
{
|
||||
public AjaxResult add(@RequestBody MemberOrder memberOrder) {
|
||||
return toAjax(memberOrderService.save(memberOrder));
|
||||
}
|
||||
|
||||
@ -88,8 +91,7 @@ public class MemberOrderController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('member:order:edit')")
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MemberOrder memberOrder)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody MemberOrder memberOrder) {
|
||||
return toAjax(memberOrderService.updateById(memberOrder));
|
||||
}
|
||||
|
||||
@ -98,9 +100,8 @@ public class MemberOrderController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:order:remove')")
|
||||
@Log(title = "订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||
return toAjax(memberOrderService.removeByIds(list));
|
||||
}
|
||||
|
@ -1,18 +1,30 @@
|
||||
package com.ruoyi.member.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.ruoyi.member.vo.MemberOrderVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 订单Mapper接口
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberOrderMapper extends BaseMapper<MemberOrder>
|
||||
{
|
||||
public interface MemberOrderMapper extends BaseMapper<MemberOrder> {
|
||||
|
||||
/**
|
||||
* 分页查询订单列表
|
||||
*
|
||||
* @param entity {@link MemberOrderVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.vo.MemberOrderVO>
|
||||
* @author PQZ
|
||||
* @date 15:26 2025/3/25
|
||||
**/
|
||||
IPage<MemberOrderVO> queryListPage(@Param("entity") MemberOrderVO entity, Page<MemberOrder> page);
|
||||
}
|
||||
|
@ -1,16 +1,27 @@
|
||||
package com.ruoyi.member.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.ruoyi.member.vo.MemberOrderVO;
|
||||
|
||||
/**
|
||||
* 订单Service接口
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
public interface IMemberOrderService extends IService<MemberOrder>
|
||||
{
|
||||
public interface IMemberOrderService extends IService<MemberOrder> {
|
||||
|
||||
/**
|
||||
* 分页查询订单列表
|
||||
*
|
||||
* @param memberOrder {@link MemberOrderVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.vo.MemberOrderVO>
|
||||
* @author PQZ
|
||||
* @date 15:25 2025/3/25
|
||||
**/
|
||||
IPage<MemberOrderVO> queryListPage(MemberOrderVO memberOrder, Page<MemberOrder> page);
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package com.ruoyi.member.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.ruoyi.member.mapper.MemberOrderMapper;
|
||||
import com.ruoyi.member.service.IMemberOrderService;
|
||||
import com.ruoyi.member.vo.MemberOrderVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.member.mapper.MemberOrderMapper;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.ruoyi.member.service.IMemberOrderService;
|
||||
|
||||
/**
|
||||
* 订单Service业务层处理
|
||||
@ -22,4 +23,17 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper,Member
|
||||
private MemberOrderMapper memberOrderMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询订单列表
|
||||
*
|
||||
* @param memberOrder {@link MemberOrderVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.vo.MemberOrderVO>
|
||||
* @author PQZ
|
||||
* @date 15:25 2025/3/25
|
||||
**/
|
||||
@Override
|
||||
public IPage<MemberOrderVO> queryListPage(MemberOrderVO memberOrder, Page<MemberOrder> page) {
|
||||
return memberOrderMapper.queryListPage(memberOrder,page);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.ruoyi.member.vo;
|
||||
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MemberOrderVO extends MemberOrder {
|
||||
/**商品名称*/
|
||||
String goodsName;
|
||||
}
|
@ -37,5 +37,17 @@
|
||||
select id, user_id, user_type, nickname, order_no, order_type, goods_id, goods_num, goods_price, pay_time, content, pay_way, is_pay, is_refund, refund_user_id, refund_way, refund_no, refund_apply_time, refund_receive_time, refund_reason, remark, creator, create_time, updater, update_time, del_flag from dl_member_order
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryListPage" parameterType="MemberOrder" resultMap="MemberOrderResult">
|
||||
<include refid="selectMemberOrderVo"/>
|
||||
<where>
|
||||
<if test="entity.nickname != null and entity.nickname != ''"> and nickname like concat('%', #{entity.nickname}, '%')</if>
|
||||
<if test="entity.orderNo != null and entity.orderNo != ''"> and order_no like concat('%', #{entity.orderNo}, '%')</if>
|
||||
<if test="entity.userType != null and entity.userType != ''"> and user_type = #{entity.userType}</if>
|
||||
<if test="entity.orderType != null and entity.orderType != ''"> and order_type = #{entity.orderType}</if>
|
||||
<if test="entity.payWay != null and entity.payWay != ''"> and pay_way = #{entity.payWay}</if>
|
||||
<if test="entity.refundWay != null and entity.refundWay != ''"> and refund_way = #{entity.refundWay}</if>
|
||||
<if test="entity.isPay != null "> and is_pay = #{entity.isPay}</if>
|
||||
<if test="entity.isRefund != null "> and is_refund = #{entity.isRefund}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user