feat: 用户储值代码生产
This commit is contained in:
parent
c30ceeb719
commit
43c300b1e6
|
@ -3,11 +3,11 @@ package cn.bunny.common.generator.generator;
|
||||||
import cn.bunny.common.generator.entity.BaseField;
|
import cn.bunny.common.generator.entity.BaseField;
|
||||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||||
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingAddDto;
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
|
||||||
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto;
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
|
||||||
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingUpdateDto;
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
|
||||||
import cn.bunny.dao.entity.financial.DebtTracking;
|
import cn.bunny.dao.entity.financial.SavingGoal;
|
||||||
import cn.bunny.dao.vo.financial.DebtTrackingVo;
|
import cn.bunny.dao.vo.financial.SavingGoalVo;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -52,11 +52,11 @@ public class WebGeneratorCode {
|
||||||
public static String resourceMapperPath = "D:\\MyFolder\\auth\\financial-web-server\\service\\src\\main\\resources\\mapper\\financial\\";
|
public static String resourceMapperPath = "D:\\MyFolder\\auth\\financial-web-server\\service\\src\\main\\resources\\mapper\\financial\\";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Class<?> originalClass = DebtTracking.class;
|
Class<?> originalClass = SavingGoal.class;
|
||||||
Class<?> dtoClass = DebtTrackingDto.class;
|
Class<?> dtoClass = SavingGoalDto.class;
|
||||||
Class<?> addDtoClass = DebtTrackingAddDto.class;
|
Class<?> addDtoClass = SavingGoalAddDto.class;
|
||||||
Class<?> updateDtoClass = DebtTrackingUpdateDto.class;
|
Class<?> updateDtoClass = SavingGoalUpdateDto.class;
|
||||||
Class<?> voClass = DebtTrackingVo.class;
|
Class<?> voClass = SavingGoalVo.class;
|
||||||
|
|
||||||
// 设置velocity资源加载器
|
// 设置velocity资源加载器
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package cn.bunny.dao.dto.financial.savingGoal;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "SavingGoalAddDto对象", title = "用户储值添加", description = "用户储值添加")
|
||||||
|
public class SavingGoalAddDto {
|
||||||
|
|
||||||
|
@Schema(name = "userId", title = "绑定的用户id")
|
||||||
|
@NotNull(message = "用户id不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(name = "statusType", title = "完成状态")
|
||||||
|
@NotNull(message = "完成状态不能为空")
|
||||||
|
@NotBlank(message = "完成状态不能为空")
|
||||||
|
private String statusType;
|
||||||
|
|
||||||
|
@Schema(name = "savingGoalName", title = "储值目标名称")
|
||||||
|
@NotNull(message = "储值目标名称不能为空")
|
||||||
|
@NotBlank(message = "储值目标名称不能为空")
|
||||||
|
private String savingGoalName;
|
||||||
|
|
||||||
|
@Schema(name = "amount", title = "目标金额")
|
||||||
|
@NotNull(message = "目标金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "目标时长")
|
||||||
|
@NotNull(message = "目标时长不能为空")
|
||||||
|
@NotBlank(message = "目标时长不能为空")
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.bunny.dao.dto.financial.savingGoal;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "SavingGoalDto对象", title = "用户储值查询", description = "用户储值查询")
|
||||||
|
public class SavingGoalDto {
|
||||||
|
|
||||||
|
@Schema(name = "id", title = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(name = "userId", title = "绑定的用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(name = "statusType", title = "完成状态")
|
||||||
|
private String statusType;
|
||||||
|
|
||||||
|
@Schema(name = "savingGoalName", title = "储值目标名称")
|
||||||
|
private String savingGoalName;
|
||||||
|
|
||||||
|
@Schema(name = "amount", title = "目标金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "目标时长")
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package cn.bunny.dao.dto.financial.savingGoal;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "SavingGoalUpdateDto对象", title = "用户储值更新", description = "用户储值更新")
|
||||||
|
public class SavingGoalUpdateDto {
|
||||||
|
|
||||||
|
@Schema(name = "id", title = "主键")
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(name = "userId", title = "绑定的用户id")
|
||||||
|
@NotNull(message = "用户id不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(name = "statusType", title = "完成状态")
|
||||||
|
@NotNull(message = "完成状态不能为空")
|
||||||
|
@NotBlank(message = "完成状态不能为空")
|
||||||
|
private String statusType;
|
||||||
|
|
||||||
|
@Schema(name = "savingGoalName", title = "储值目标名称")
|
||||||
|
@NotNull(message = "储值目标名称不能为空")
|
||||||
|
@NotBlank(message = "储值目标名称不能为空")
|
||||||
|
private String savingGoalName;
|
||||||
|
|
||||||
|
@Schema(name = "amount", title = "目标金额")
|
||||||
|
@NotNull(message = "目标金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "目标时长")
|
||||||
|
@NotNull(message = "目标时长不能为空")
|
||||||
|
@NotBlank(message = "目标时长不能为空")
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
}
|
|
@ -1,18 +1,14 @@
|
||||||
package cn.bunny.dao.entity.financial;
|
package cn.bunny.dao.entity.financial;
|
||||||
|
|
||||||
import cn.bunny.dao.common.entity.BaseEntity;
|
import cn.bunny.dao.common.entity.BaseEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户储值
|
* 用户储值
|
||||||
|
@ -25,22 +21,24 @@ import lombok.experimental.Accessors;
|
||||||
@Setter
|
@Setter
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("t_saving_goal")
|
@TableName("t_saving_goal")
|
||||||
@ApiModel(value = "SavingGoal对象", description = "用户储值")
|
@Schema(name = "SavingGoal对象", title = "用户储值", description = "用户储值")
|
||||||
public class SavingGoal extends BaseEntity {
|
public class SavingGoal extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty("绑定的用户id")
|
@Schema(name = "userId", title = "绑定的用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@ApiModelProperty("完成状态")
|
@Schema(name = "statusType", title = "完成状态")
|
||||||
private String statusType;
|
private String statusType;
|
||||||
|
|
||||||
@ApiModelProperty("储值目标名称")
|
@Schema(name = "savingGoalName", title = "储值目标名称")
|
||||||
private String savingGoalName;
|
private String savingGoalName;
|
||||||
|
|
||||||
@ApiModelProperty("目标金额")
|
@Schema(name = "amount", title = "目标金额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
@ApiModelProperty("目标时长")
|
@Schema(name = "duration", title = "目标时长")
|
||||||
private String duration;
|
private String duration;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.bunny.dao.vo.financial;
|
||||||
|
|
||||||
|
import cn.bunny.dao.common.vo.BaseVo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "SavingGoalVo对象", title = "用户储值返回内容", description = "用户储值返回内容")
|
||||||
|
public class SavingGoalVo extends BaseVo {
|
||||||
|
|
||||||
|
@Schema(name = "id", title = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(name = "userId", title = "绑定的用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(name = "statusType", title = "完成状态")
|
||||||
|
private String statusType;
|
||||||
|
|
||||||
|
@Schema(name = "savingGoalName", title = "储值目标名称")
|
||||||
|
private String savingGoalName;
|
||||||
|
|
||||||
|
@Schema(name = "amount", title = "目标金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "目标时长")
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
}
|
|
@ -1,18 +1,72 @@
|
||||||
package cn.bunny.services.controller.financial;
|
package cn.bunny.services.controller.financial;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
|
||||||
|
import cn.bunny.dao.entity.financial.SavingGoal;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.pojo.result.Result;
|
||||||
|
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||||
|
import cn.bunny.dao.vo.financial.SavingGoalVo;
|
||||||
|
import cn.bunny.services.service.financial.SavingGoalService;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户储值 前端控制器
|
* 用户储值表 前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-11-11
|
* @since 2024-11-11 16:49:29
|
||||||
*/
|
*/
|
||||||
|
@Tag(name = "用户储值", description = "用户储值相关接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/savingGoal")
|
@RequestMapping("admin/savingGoal")
|
||||||
public class SavingGoalController {
|
public class SavingGoalController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SavingGoalService savingGoalService;
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询用户储值", description = "分页查询用户储值")
|
||||||
|
@GetMapping("getSavingGoalList/{page}/{limit}")
|
||||||
|
public Mono<Result<PageResult<SavingGoalVo>>> getSavingGoalList(
|
||||||
|
@Parameter(name = "page", description = "当前页", required = true)
|
||||||
|
@PathVariable("page") Integer page,
|
||||||
|
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||||
|
@PathVariable("limit") Integer limit,
|
||||||
|
SavingGoalDto dto) {
|
||||||
|
Page<SavingGoal> pageParams = new Page<>(page, limit);
|
||||||
|
PageResult<SavingGoalVo> pageResult = savingGoalService.getSavingGoalList(pageParams, dto);
|
||||||
|
return Mono.just(Result.success(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "添加用户储值", description = "添加用户储值")
|
||||||
|
@PostMapping("addSavingGoal")
|
||||||
|
public Mono<Result<String>> addSavingGoal(@Valid @RequestBody SavingGoalAddDto dto) {
|
||||||
|
savingGoalService.addSavingGoal(dto);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新用户储值", description = "更新用户储值")
|
||||||
|
@PutMapping("updateSavingGoal")
|
||||||
|
public Mono<Result<String>> updateSavingGoal(@Valid @RequestBody SavingGoalUpdateDto dto) {
|
||||||
|
savingGoalService.updateSavingGoal(dto);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除用户储值", description = "删除用户储值")
|
||||||
|
@DeleteMapping("deleteSavingGoal")
|
||||||
|
public Mono<Result<String>> deleteSavingGoal(@RequestBody List<Long> ids) {
|
||||||
|
savingGoalService.deleteSavingGoal(ids);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
package cn.bunny.services.mapper.financial;
|
package cn.bunny.services.mapper.financial;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
|
||||||
import cn.bunny.dao.entity.financial.SavingGoal;
|
import cn.bunny.dao.entity.financial.SavingGoal;
|
||||||
|
import cn.bunny.dao.vo.financial.SavingGoalVo;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -10,9 +17,24 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-11-11
|
* @since 2024-11-11 16:49:29
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SavingGoalMapper extends BaseMapper<SavingGoal> {
|
public interface SavingGoalMapper extends BaseMapper<SavingGoal> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 分页查询用户储值内容
|
||||||
|
*
|
||||||
|
* @param pageParams 用户储值分页参数
|
||||||
|
* @param dto 用户储值查询表单
|
||||||
|
* @return 用户储值分页结果
|
||||||
|
*/
|
||||||
|
IPage<SavingGoalVo> selectListByPage(@Param("page") Page<SavingGoal> pageParams, @Param("dto") SavingGoalDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除用户储值
|
||||||
|
*
|
||||||
|
* @param ids 删除 id 列表
|
||||||
|
*/
|
||||||
|
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
package cn.bunny.services.service.financial;
|
package cn.bunny.services.service.financial;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
|
||||||
import cn.bunny.dao.entity.financial.SavingGoal;
|
import cn.bunny.dao.entity.financial.SavingGoal;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.financial.SavingGoalVo;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -9,8 +18,35 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-11-11
|
* @since 2024-11-11 16:49:29
|
||||||
*/
|
*/
|
||||||
public interface SavingGoalService extends IService<SavingGoal> {
|
public interface SavingGoalService extends IService<SavingGoal> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 获取用户储值列表
|
||||||
|
*
|
||||||
|
* @return 用户储值返回列表
|
||||||
|
*/
|
||||||
|
PageResult<SavingGoalVo> getSavingGoalList(Page<SavingGoal> pageParams, SavingGoalDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 添加用户储值
|
||||||
|
*
|
||||||
|
* @param dto 添加表单
|
||||||
|
*/
|
||||||
|
void addSavingGoal(@Valid SavingGoalAddDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 更新用户储值
|
||||||
|
*
|
||||||
|
* @param dto 更新表单
|
||||||
|
*/
|
||||||
|
void updateSavingGoal(@Valid SavingGoalUpdateDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 删除|批量删除用户储值类型
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
void deleteSavingGoal(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,85 @@
|
||||||
package cn.bunny.services.service.financial.impl;
|
package cn.bunny.services.service.financial.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
|
||||||
|
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
|
||||||
import cn.bunny.dao.entity.financial.SavingGoal;
|
import cn.bunny.dao.entity.financial.SavingGoal;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.financial.SavingGoalVo;
|
||||||
import cn.bunny.services.mapper.financial.SavingGoalMapper;
|
import cn.bunny.services.mapper.financial.SavingGoalMapper;
|
||||||
import cn.bunny.services.service.financial.SavingGoalService;
|
import cn.bunny.services.service.financial.SavingGoalService;
|
||||||
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户储值 服务实现类
|
* 用户储值 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-11-11
|
* @since 2024-11-11 16:49:29
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SavingGoalServiceImpl extends ServiceImpl<SavingGoalMapper, SavingGoal> implements SavingGoalService {
|
public class SavingGoalServiceImpl extends ServiceImpl<SavingGoalMapper, SavingGoal> implements SavingGoalService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 用户储值 服务实现类
|
||||||
|
*
|
||||||
|
* @param pageParams 用户储值分页查询page对象
|
||||||
|
* @param dto 用户储值分页查询对象
|
||||||
|
* @return 查询分页用户储值返回对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<SavingGoalVo> getSavingGoalList(Page<SavingGoal> pageParams, SavingGoalDto dto) {
|
||||||
|
IPage<SavingGoalVo> page = baseMapper.selectListByPage(pageParams, dto);
|
||||||
|
|
||||||
|
return PageResult.<SavingGoalVo>builder()
|
||||||
|
.list(page.getRecords())
|
||||||
|
.pageNo(page.getCurrent())
|
||||||
|
.pageSize(page.getSize())
|
||||||
|
.total(page.getTotal())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户储值
|
||||||
|
*
|
||||||
|
* @param dto 用户储值添加
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addSavingGoal(@Valid SavingGoalAddDto dto) {
|
||||||
|
// 保存数据
|
||||||
|
SavingGoal savingGoal = new SavingGoal();
|
||||||
|
BeanUtils.copyProperties(dto, savingGoal);
|
||||||
|
save(savingGoal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户储值
|
||||||
|
*
|
||||||
|
* @param dto 用户储值更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateSavingGoal(@Valid SavingGoalUpdateDto dto) {
|
||||||
|
// 更新内容
|
||||||
|
SavingGoal savingGoal = new SavingGoal();
|
||||||
|
BeanUtils.copyProperties(dto, savingGoal);
|
||||||
|
updateById(savingGoal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除|批量删除用户储值
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteSavingGoal(List<Long> ids) {
|
||||||
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,64 @@
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.financial.SavingGoal">
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.financial.SavingGoal">
|
||||||
<id column="id" property="id" />
|
<id column="id" property="id"/>
|
||||||
<result column="user_id" property="userId" />
|
<id column="create_time" property="createTime"/>
|
||||||
<result column="status_type" property="statusType" />
|
<id column="update_time" property="updateTime"/>
|
||||||
<result column="saving_goal_name" property="savingGoalName" />
|
<id column="create_user" property="createUser"/>
|
||||||
<result column="amount" property="amount" />
|
<id column="update_user" property="updateUser"/>
|
||||||
<result column="duration" property="duration" />
|
<id column="is_deleted" property="isDeleted"/>
|
||||||
<result column="create_user" property="createUser" />
|
<id column="user_id" property="userId"/>
|
||||||
<result column="create_time" property="createTime" />
|
<id column="status_type" property="statusType"/>
|
||||||
<result column="update_user" property="updateUser" />
|
<id column="saving_goal_name" property="savingGoalName"/>
|
||||||
<result column="update_time" property="updateTime" />
|
<id column="amount" property="amount"/>
|
||||||
<result column="is_deleted" property="isDeleted" />
|
<id column="duration" property="duration"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, user_id, status_type, saving_goal_name, amount, duration, create_user, create_time, update_user, update_time, is_deleted
|
id, create_time, update_time, create_user, update_user, is_deleted, user_id, status_type, saving_goal_name, amount, duration
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询用户储值内容 -->
|
||||||
|
<select id="selectListByPage" resultType="cn.bunny.dao.vo.financial.SavingGoalVo">
|
||||||
|
select
|
||||||
|
base.*,
|
||||||
|
create_user.username as create_username,
|
||||||
|
update_user.username as update_username
|
||||||
|
from t_saving_goal base
|
||||||
|
left join sys_user create_user on create_user.id = base.create_user
|
||||||
|
left join sys_user update_user on update_user.id = base.update_user
|
||||||
|
<where>
|
||||||
|
base.is_deleted = 0
|
||||||
|
<if test="dto.id != null and dto.id != ''">
|
||||||
|
and base.id like CONCAT('%',#{dto.id},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.userId != null and dto.userId != ''">
|
||||||
|
and base.user_id like CONCAT('%',#{dto.userId},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.statusType != null and dto.statusType != ''">
|
||||||
|
and base.status_type like CONCAT('%',#{dto.statusType},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.savingGoalName != null and dto.savingGoalName != ''">
|
||||||
|
and base.saving_goal_name like CONCAT('%',#{dto.savingGoalName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.amount != null and dto.amount != ''">
|
||||||
|
and base.amount like CONCAT('%',#{dto.amount},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.duration != null and dto.duration != ''">
|
||||||
|
and base.duration like CONCAT('%',#{dto.duration},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 物理删除用户储值 -->
|
||||||
|
<delete id="deleteBatchIdsWithPhysics">
|
||||||
|
delete
|
||||||
|
from t_saving_goal
|
||||||
|
where id in
|
||||||
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue