运行不起来了
This commit is contained in:
@@ -128,14 +128,6 @@
|
||||
OR a.room_number LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<!-- 价格区间筛选 -->
|
||||
<if test="param.priceScene != null and param.priceScene.indexOf('~') > -1">
|
||||
<bind name="priceMin" value="param.priceScene.substring(0, param.priceScene.indexOf('~'))" />
|
||||
<bind name="priceMax" value="param.priceScene.substring(param.priceScene.indexOf('~') + 1)" />
|
||||
AND a.monthly_rent >= CAST(#{priceMin} AS DECIMAL(10,2))
|
||||
AND a.monthly_rent <= CAST(#{priceMax} AS DECIMAL(10,2))
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<trim prefix="ORDER BY" suffixOverrides=",">
|
||||
<if test="param.sortScene == '综合排序'">
|
||||
@@ -145,37 +137,24 @@
|
||||
a.create_time desc,
|
||||
</if>
|
||||
<if test="param.sortScene == '价格(低-高)'">
|
||||
CAST(IFNULL(a.monthly_rent, 0) AS DECIMAL(10,2)) asc,
|
||||
a.monthly_rent asc,
|
||||
</if>
|
||||
<if test="param.sortScene == '价格(高-低)'">
|
||||
CAST(IFNULL(a.monthly_rent, 0) AS DECIMAL(10,2)) desc,
|
||||
a.monthly_rent desc,
|
||||
</if>
|
||||
<if test="param.sortScene == '面积(小-大)'">
|
||||
CASE WHEN a.extent IS NULL OR a.extent = '' THEN 1 ELSE 0 END,
|
||||
CAST(COALESCE(NULLIF(a.extent, ''), '0') AS DECIMAL(10,2)) asc,
|
||||
a.extent asc,
|
||||
</if>
|
||||
<if test="param.sortScene == '面积(大-小)'">
|
||||
CASE WHEN a.extent IS NULL OR a.extent = '' THEN 1 ELSE 0 END,
|
||||
CAST(COALESCE(NULLIF(a.extent, ''), '0') AS DECIMAL(10,2)) desc,
|
||||
a.extent desc,
|
||||
</if>
|
||||
<if test="param.priceScene != null and param.priceScene.indexOf('~') == -1">
|
||||
ABS(CAST(COALESCE(a.monthly_rent, 0) AS DECIMAL(10,2)) - CAST(#{param.priceScene} AS DECIMAL(10,2))),
|
||||
<if test="param.priceScene != null">
|
||||
ABS(a.monthly_rent - #{param.priceScene}),
|
||||
</if>
|
||||
<if test="param.extentScene != null and param.extentScene.indexOf('~') == -1">
|
||||
ABS(CAST(COALESCE(NULLIF(a.extent, ''), '0') AS DECIMAL(10,2)) - CAST(#{param.extentScene} AS DECIMAL(10,2))),
|
||||
|
||||
<if test="param.extentScene != null">
|
||||
ABS(a.extent - #{param.extentScene}),
|
||||
</if>
|
||||
<!-- 默认排序:只有在没有指定排序场景时才使用 -->
|
||||
<if test="param.sortScene == null or param.sortScene == '' or param.sortScene == '综合排序'">
|
||||
a.sort_number asc, a.create_time desc
|
||||
</if>
|
||||
<if test="param.sortScene == '最新发布'">
|
||||
<!-- 最新发布已经在上面处理了 -->
|
||||
</if>
|
||||
<if test="param.sortScene != null and param.sortScene != '' and param.sortScene != '综合排序' and param.sortScene != '最新发布' and param.sortScene != '价格(低-高)' and param.sortScene != '价格(高-低)' and param.sortScene != '面积(小-大)' and param.sortScene != '面积(大-小)'">
|
||||
a.create_time desc
|
||||
</if>
|
||||
<!-- 默认排序:推荐优先,然后按创建时间倒序 -->
|
||||
a.recommend desc, a.create_time desc
|
||||
</trim>
|
||||
|
||||
</sql>
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.ShopCouponService;
|
||||
import com.gxwebsoft.shop.entity.ShopCoupon;
|
||||
import com.gxwebsoft.shop.param.ShopCouponParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:01
|
||||
*/
|
||||
@Tag(name = "优惠券管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/shop-coupon")
|
||||
public class ShopCouponController extends BaseController {
|
||||
@Resource
|
||||
private ShopCouponService shopCouponService;
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:list')")
|
||||
@Operation(summary = "分页查询优惠券")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ShopCoupon>> page(ShopCouponParam param) {
|
||||
// 使用关联查询
|
||||
return success(shopCouponService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:list')")
|
||||
@Operation(summary = "查询全部优惠券")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ShopCoupon>> list(ShopCouponParam param) {
|
||||
// 使用关联查询
|
||||
return success(shopCouponService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:list')")
|
||||
@Operation(summary = "根据id查询优惠券")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ShopCoupon> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(shopCouponService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加优惠券")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ShopCoupon shopCoupon) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
shopCoupon.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (shopCouponService.save(shopCoupon)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改优惠券")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ShopCoupon shopCoupon) {
|
||||
if (shopCouponService.updateById(shopCoupon)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除优惠券")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (shopCouponService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加优惠券")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ShopCoupon> list) {
|
||||
if (shopCouponService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改优惠券")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopCoupon> batchParam) {
|
||||
if (batchParam.update(shopCouponService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopCoupon:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除优惠券")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (shopCouponService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDate;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 优惠券
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:00
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(name = "ShopCoupon对象", description = "优惠券")
|
||||
public class ShopCoupon implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "优惠券名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "优惠券描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "满减券-减免金额")
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@Schema(description = "折扣券-折扣率(0-100)")
|
||||
private Integer discount;
|
||||
|
||||
@Schema(description = "最低消费金额")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@Schema(description = "到期类型(10领取后生效 20固定时间)")
|
||||
private Integer expireType;
|
||||
|
||||
@Schema(description = "领取后生效-有效天数")
|
||||
private Integer expireDay;
|
||||
|
||||
@Schema(description = "有效期开始时间")
|
||||
private LocalDate startTime;
|
||||
|
||||
@Schema(description = "有效期结束时间")
|
||||
private LocalDate endTime;
|
||||
|
||||
@Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)")
|
||||
private Integer applyRange;
|
||||
|
||||
@Schema(description = "适用范围配置(json格式)")
|
||||
private String applyRangeConfig;
|
||||
|
||||
@Schema(description = "是否过期(0未过期 1已过期)")
|
||||
private Integer isExpire;
|
||||
|
||||
@Schema(description = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "状态, 0正常, 1禁用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "发放总数量(-1表示无限制)")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "已发放数量")
|
||||
private Integer issuedCount;
|
||||
|
||||
@Schema(description = "每人限领数量(-1表示无限制)")
|
||||
private Integer limitPerUser;
|
||||
|
||||
@Schema(description = "是否启用(0禁用 1启用)")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.ShopCoupon;
|
||||
import com.gxwebsoft.shop.param.ShopCouponParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:00
|
||||
*/
|
||||
public interface ShopCouponMapper extends BaseMapper<ShopCoupon> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ShopCoupon>
|
||||
*/
|
||||
List<ShopCoupon> selectPageRel(@Param("page") IPage<ShopCoupon> page,
|
||||
@Param("param") ShopCouponParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ShopCoupon> selectListRel(@Param("param") ShopCouponParam param);
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
<?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.gxwebsoft.shop.mapper.ShopCouponMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM shop_coupon a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param.description != null">
|
||||
AND a.description LIKE CONCAT('%', #{param.description}, '%')
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.reducePrice != null">
|
||||
AND a.reduce_price = #{param.reducePrice}
|
||||
</if>
|
||||
<if test="param.discount != null">
|
||||
AND a.discount = #{param.discount}
|
||||
</if>
|
||||
<if test="param.minPrice != null">
|
||||
AND a.min_price = #{param.minPrice}
|
||||
</if>
|
||||
<if test="param.expireType != null">
|
||||
AND a.expire_type = #{param.expireType}
|
||||
</if>
|
||||
<if test="param.expireDay != null">
|
||||
AND a.expire_day = #{param.expireDay}
|
||||
</if>
|
||||
<if test="param.startTime != null">
|
||||
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
|
||||
</if>
|
||||
<if test="param.endTime != null">
|
||||
AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%')
|
||||
</if>
|
||||
<if test="param.applyRange != null">
|
||||
AND a.apply_range = #{param.applyRange}
|
||||
</if>
|
||||
<if test="param.applyRangeConfig != null">
|
||||
AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%')
|
||||
</if>
|
||||
<if test="param.isExpire != null">
|
||||
AND a.is_expire = #{param.isExpire}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.totalCount != null">
|
||||
AND a.total_count = #{param.totalCount}
|
||||
</if>
|
||||
<if test="param.issuedCount != null">
|
||||
AND a.issued_count = #{param.issuedCount}
|
||||
</if>
|
||||
<if test="param.limitPerUser != null">
|
||||
AND a.limit_per_user = #{param.limitPerUser}
|
||||
</if>
|
||||
<if test="param.enabled != null">
|
||||
AND a.enabled = #{param.enabled}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopCoupon">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopCoupon">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.gxwebsoft.shop.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 优惠券查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:00
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(name = "ShopCouponParam对象", description = "优惠券查询参数")
|
||||
public class ShopCouponParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "优惠券名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "优惠券描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "满减券-减免金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@Schema(description = "折扣券-折扣率(0-100)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer discount;
|
||||
|
||||
@Schema(description = "最低消费金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@Schema(description = "到期类型(10领取后生效 20固定时间)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer expireType;
|
||||
|
||||
@Schema(description = "领取后生效-有效天数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer expireDay;
|
||||
|
||||
@Schema(description = "有效期开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "有效期结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer applyRange;
|
||||
|
||||
@Schema(description = "适用范围配置(json格式)")
|
||||
private String applyRangeConfig;
|
||||
|
||||
@Schema(description = "是否过期(0未过期 1已过期)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isExpire;
|
||||
|
||||
@Schema(description = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "状态, 0正常, 1禁用")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "发放总数量(-1表示无限制)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "已发放数量")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer issuedCount;
|
||||
|
||||
@Schema(description = "每人限领数量(-1表示无限制)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer limitPerUser;
|
||||
|
||||
@Schema(description = "是否启用(0禁用 1启用)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.gxwebsoft.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.entity.ShopCoupon;
|
||||
import com.gxwebsoft.shop.param.ShopCouponParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:00
|
||||
*/
|
||||
public interface ShopCouponService extends IService<ShopCoupon> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ShopCoupon>
|
||||
*/
|
||||
PageResult<ShopCoupon> pageRel(ShopCouponParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ShopCoupon>
|
||||
*/
|
||||
List<ShopCoupon> listRel(ShopCouponParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id id
|
||||
* @return ShopCoupon
|
||||
*/
|
||||
ShopCoupon getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.gxwebsoft.shop.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.shop.mapper.ShopCouponMapper;
|
||||
import com.gxwebsoft.shop.service.ShopCouponService;
|
||||
import com.gxwebsoft.shop.entity.ShopCoupon;
|
||||
import com.gxwebsoft.shop.param.ShopCouponParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-09 15:48:00
|
||||
*/
|
||||
@Service
|
||||
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
|
||||
|
||||
@Override
|
||||
public PageResult<ShopCoupon> pageRel(ShopCouponParam param) {
|
||||
PageParam<ShopCoupon, ShopCouponParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<ShopCoupon> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopCoupon> listRel(ShopCouponParam param) {
|
||||
List<ShopCoupon> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ShopCoupon, ShopCouponParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopCoupon getByIdRel(Integer id) {
|
||||
ShopCouponParam param = new ShopCouponParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user