修改数据库密码
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
package com.gxwebsoft.booking.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.booking.service.CouponService;
|
||||
import com.gxwebsoft.booking.entity.Coupon;
|
||||
import com.gxwebsoft.booking.param.CouponParam;
|
||||
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.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 我的优惠券控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-06 07:26:46
|
||||
*/
|
||||
@Api(tags = "我的优惠券管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/booking/coupon")
|
||||
public class CouponController extends BaseController {
|
||||
@Resource
|
||||
private CouponService couponService;
|
||||
|
||||
@ApiOperation("分页查询我的优惠券")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Coupon>> page(CouponParam param) {
|
||||
// 使用关联查询
|
||||
return success(couponService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部我的优惠券")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Coupon>> list(CouponParam param) {
|
||||
// 使用关联查询
|
||||
return success(couponService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('booking:coupon:list')")
|
||||
@ApiOperation("根据id查询我的优惠券")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Coupon> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(couponService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加我的优惠券")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Coupon coupon) {
|
||||
if (couponService.save(coupon)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改我的优惠券")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Coupon coupon) {
|
||||
if (couponService.updateById(coupon)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除我的优惠券")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (couponService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加我的优惠券")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Coupon> list) {
|
||||
if (couponService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改我的优惠券")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Coupon> batchParam) {
|
||||
if (batchParam.update(couponService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除我的优惠券")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (couponService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,6 +55,7 @@ public class UserCouponController extends BaseController {
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserCoupon>> list(UserCouponParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(userCouponService.listRel(param));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.gxwebsoft.booking.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 我的优惠券
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-06 07:26:46
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Coupon对象", description = "我的优惠券")
|
||||
@TableName("booking_coupon")
|
||||
public class Coupon implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "优惠劵id")
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "优惠券名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "优惠券类型(10满减券 20折扣券)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "满减券-减免金额")
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@ApiModelProperty(value = "折扣券-折扣率(0-100)")
|
||||
private Integer discount;
|
||||
|
||||
@ApiModelProperty(value = "最低消费金额")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@ApiModelProperty(value = "到期类型(10领取后生效 20固定时间)")
|
||||
private Integer expireType;
|
||||
|
||||
@ApiModelProperty(value = "领取后生效-有效天数")
|
||||
private Integer expireDay;
|
||||
|
||||
@ApiModelProperty(value = "有效期开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "有效期结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(value = "适用范围(10全部商品 20指定商品)")
|
||||
private Integer applyRange;
|
||||
|
||||
@ApiModelProperty(value = "适用范围配置(json格式)")
|
||||
private String applyRangeConfig;
|
||||
|
||||
@ApiModelProperty(value = "是否过期(0未过期 1已过期)")
|
||||
private Integer isExpire;
|
||||
|
||||
@ApiModelProperty(value = "是否已使用(0未使用 1已使用)")
|
||||
private Integer isUse;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0待使用, 1已使用, 2已失效")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.booking.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.booking.entity.Coupon;
|
||||
import com.gxwebsoft.booking.param.CouponParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 我的优惠券Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-06 07:26:46
|
||||
*/
|
||||
public interface CouponMapper extends BaseMapper<Coupon> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Coupon>
|
||||
*/
|
||||
List<Coupon> selectPageRel(@Param("page") IPage<Coupon> page,
|
||||
@Param("param") CouponParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Coupon> selectListRel(@Param("param") CouponParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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.booking.mapper.CouponMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM booking_coupon a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.couponId != null">
|
||||
AND a.coupon_id = #{param.couponId}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</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.isUse != null">
|
||||
AND a.is_use = #{param.isUse}
|
||||
</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.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Coupon">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Coupon">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.gxwebsoft.booking.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.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 我的优惠券查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-06 07:26:46
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "CouponParam对象", description = "我的优惠券查询参数")
|
||||
public class CouponParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "优惠劵id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "优惠券名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "优惠券类型(10满减券 20折扣券)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "满减券-减免金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@ApiModelProperty(value = "折扣券-折扣率(0-100)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer discount;
|
||||
|
||||
@ApiModelProperty(value = "最低消费金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@ApiModelProperty(value = "到期类型(10领取后生效 20固定时间)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer expireType;
|
||||
|
||||
@ApiModelProperty(value = "领取后生效-有效天数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer expireDay;
|
||||
|
||||
@ApiModelProperty(value = "有效期开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "有效期结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "适用范围(10全部商品 20指定商品)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer applyRange;
|
||||
|
||||
@ApiModelProperty(value = "适用范围配置(json格式)")
|
||||
private String applyRangeConfig;
|
||||
|
||||
@ApiModelProperty(value = "是否过期(0未过期 1已过期)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isExpire;
|
||||
|
||||
@ApiModelProperty(value = "是否已使用(0未使用 1已使用)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isUse;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0待使用, 1已使用, 2已失效")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.booking.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.booking.entity.Coupon;
|
||||
import com.gxwebsoft.booking.param.CouponParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 我的优惠券Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-06 07:26:46
|
||||
*/
|
||||
public interface CouponService extends IService<Coupon> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Coupon>
|
||||
*/
|
||||
PageResult<Coupon> pageRel(CouponParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Coupon>
|
||||
*/
|
||||
List<Coupon> listRel(CouponParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id id
|
||||
* @return Coupon
|
||||
*/
|
||||
Coupon getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.booking.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.booking.mapper.CouponMapper;
|
||||
import com.gxwebsoft.booking.service.CouponService;
|
||||
import com.gxwebsoft.booking.entity.Coupon;
|
||||
import com.gxwebsoft.booking.param.CouponParam;
|
||||
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 2024-07-06 07:26:46
|
||||
*/
|
||||
@Service
|
||||
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {
|
||||
|
||||
@Override
|
||||
public PageResult<Coupon> pageRel(CouponParam param) {
|
||||
PageParam<Coupon, CouponParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Coupon> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Coupon> listRel(CouponParam param) {
|
||||
List<Coupon> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Coupon, CouponParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coupon getByIdRel(Integer id) {
|
||||
CouponParam param = new CouponParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: modules
|
||||
password: FYJGx7s8yt7K8xDH
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: modules
|
||||
password: FYJGx7s8yt7K8xDH
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
|
||||
Reference in New Issue
Block a user