Compare commits
7 Commits
1b56f33a02
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a70fe6c9ef | |||
| 69df40a47d | |||
| fe89d3cc85 | |||
| 20aa820794 | |||
| 17b20a3d4b | |||
| 638a1a9186 | |||
| 1a4b1a8639 |
@@ -3,7 +3,7 @@ package com.cxx.home.controller;
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.home.dto.anniversary.AnniversaryDto;
|
||||
import com.cxx.home.dto.AnniversaryDto;
|
||||
import com.cxx.home.service.AnniversaryService;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.asset.AssetDto;
|
||||
import com.cxx.home.dto.AssetDto;
|
||||
import com.cxx.home.service.AssetService;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
package com.cxx.home.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.home.dto.anniversary.AnniversaryDto;
|
||||
import com.cxx.home.service.AnniversaryService;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.AwardDto;
|
||||
import com.cxx.home.service.AwardService;
|
||||
import com.cxx.home.vo.AwardQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/award")
|
||||
@Tag(name = "证书奖状")
|
||||
public class AwardController {
|
||||
@Resource
|
||||
private AwardService awardService;
|
||||
|
||||
@Operation(summary = "新增证书奖状")
|
||||
@PostMapping("")
|
||||
public Boolean addAward(@RequestBody @JsonView(WriteView.class) @Validated AwardDto dto) {
|
||||
return awardService.addAward(dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新证书奖状")
|
||||
@PutMapping("/{id}")
|
||||
public Boolean updateAward(@PathVariable("id") long id,
|
||||
@RequestBody @JsonView(WriteView.class) @Validated AwardDto dto) {
|
||||
return awardService.updateAward(id, dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除证书奖状")
|
||||
@DeleteMapping("/{id}")
|
||||
public Boolean deleteAward(@PathVariable("id") long id) {
|
||||
return awardService.deleteAward(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有证书奖状")
|
||||
@GetMapping("")
|
||||
public @JsonView(ReadView.class) List<AwardDto> queryAwardList(AwardQueryVo vo) {
|
||||
return awardService.queryAwardList(vo);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询证书奖状")
|
||||
@GetMapping("/{id}")
|
||||
public @JsonView(ReadView.class) AwardDto queryAward(@PathVariable("id") long id) {
|
||||
return awardService.queryAward(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.CarEventDto;
|
||||
import com.cxx.home.service.CarEventService;
|
||||
import com.cxx.home.vo.CarQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/car")
|
||||
@Tag(name = "汽车事件")
|
||||
public class CarEventController {
|
||||
@Resource
|
||||
private CarEventService carEventService;
|
||||
|
||||
@Operation(summary = "新增汽车事件")
|
||||
@PostMapping("")
|
||||
public Boolean addCarEvent(@RequestBody @JsonView(WriteView.class) @Validated CarEventDto dto) {
|
||||
return carEventService.addCarEvent(dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新汽车事件")
|
||||
@PutMapping("/{id}")
|
||||
public Boolean updateCarEvent(@PathVariable("id") long id,
|
||||
@RequestBody @JsonView(WriteView.class) @Validated CarEventDto dto) {
|
||||
return carEventService.updateCarEvent(id, dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除汽车事件")
|
||||
@DeleteMapping("/{id}")
|
||||
public Boolean deleteCarEvent(@PathVariable("id") long id) {
|
||||
return carEventService.deleteCarEvent(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有汽车事件")
|
||||
@GetMapping("")
|
||||
public @JsonView(ReadView.class) List<CarEventDto> queryCarEventList(CarQueryVo query) {
|
||||
return carEventService.queryCarEventList(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.health.HealthRecordDto;
|
||||
import com.cxx.home.dto.HealthRecordDto;
|
||||
import com.cxx.home.service.HealthService;
|
||||
import com.cxx.home.vo.HealthQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.journal.JournalDto;
|
||||
import com.cxx.home.dto.JournalDto;
|
||||
import com.cxx.home.service.JournalService;
|
||||
import com.cxx.home.vo.JournalQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.kpi.KpiDto;
|
||||
import com.cxx.home.dto.KpiDto;
|
||||
import com.cxx.home.service.KpiService;
|
||||
import com.cxx.home.vo.KpiQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.ledger.LedgerDto;
|
||||
import com.cxx.home.dto.LedgerDto;
|
||||
import com.cxx.home.service.LedgerService;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.password.PasswordDto;
|
||||
import com.cxx.home.dto.PasswordDto;
|
||||
import com.cxx.home.service.PasswordService;
|
||||
import com.cxx.home.vo.PasswordQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.home.dto.product.ProductDto;
|
||||
import com.cxx.home.dto.ProductDto;
|
||||
import com.cxx.home.service.ProductService;
|
||||
import com.cxx.home.vo.ProductQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.AwardDto;
|
||||
import com.cxx.home.entity.Award;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface AwardConverter {
|
||||
Award toEntity(AwardDto dto);
|
||||
|
||||
List<Award> toEntities(List<AwardDto> dto);
|
||||
|
||||
AwardDto toDto(Award entities);
|
||||
|
||||
List<AwardDto> toDtos(List<Award> entities);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.CarEventDto;
|
||||
import com.cxx.home.entity.CarEvent;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface CarEventConverter {
|
||||
CarEvent toEntity(CarEventDto dto);
|
||||
|
||||
List<CarEvent> toEntities(List<CarEventDto> dto);
|
||||
|
||||
CarEventDto toDto(CarEvent entities);
|
||||
|
||||
List<CarEventDto> toDtos(List<CarEvent> entities);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.health.HealthRecordDto;
|
||||
import com.cxx.home.dto.HealthRecordDto;
|
||||
import com.cxx.home.entity.HealthRecord;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.journal.JournalDto;
|
||||
import com.cxx.home.dto.JournalDto;
|
||||
import com.cxx.home.entity.Journal;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.kpi.KpiDto;
|
||||
import com.cxx.home.dto.KpiDto;
|
||||
import com.cxx.home.entity.Kpi;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.converter;
|
||||
|
||||
import com.cxx.home.dto.product.ProductDto;
|
||||
import com.cxx.home.dto.ProductDto;
|
||||
import com.cxx.home.entity.Product;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.home.dto.anniversary.AnniversaryDto;
|
||||
import com.cxx.home.dto.AnniversaryDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.asset.AssetDto;
|
||||
import com.cxx.home.dto.AssetDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
16
home-service/src/main/java/com/cxx/home/dao/AwardDao.java
Normal file
16
home-service/src/main/java/com/cxx/home/dao/AwardDao.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.AwardDto;
|
||||
import com.cxx.home.vo.AwardQueryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AwardDao {
|
||||
List<AwardDto> queryAwardList(@Param("query") AwardQueryVo query);
|
||||
|
||||
void insertAwardImage(@Param("awardId") Long awardId,
|
||||
@Param("list") List<String> imageFiles);
|
||||
}
|
||||
13
home-service/src/main/java/com/cxx/home/dao/CarEventDao.java
Normal file
13
home-service/src/main/java/com/cxx/home/dao/CarEventDao.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.CarEventDto;
|
||||
import com.cxx.home.vo.CarQueryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CarEventDao {
|
||||
List<CarEventDto> queryCarEventList(@Param("query") CarQueryVo queryVo);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.journal.JournalDto;
|
||||
import com.cxx.home.dto.JournalDto;
|
||||
import com.cxx.home.vo.JournalQueryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.ledger.LedgerDto;
|
||||
import com.cxx.home.dto.LedgerDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.password.PasswordDto;
|
||||
import com.cxx.home.dto.PasswordDto;
|
||||
import com.cxx.home.vo.PasswordQueryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PasswordDao {
|
||||
List<PasswordDto> query(@Param("query") PasswordQueryVo query);
|
||||
List<PasswordDto> queryPasswordList(@Param("query") PasswordQueryVo query);
|
||||
|
||||
List<String> queryCategory();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.dao;
|
||||
|
||||
import com.cxx.home.dto.product.ProductDto;
|
||||
import com.cxx.home.dto.ProductDto;
|
||||
import com.cxx.home.vo.ProductQueryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.anniversary;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.asset;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
43
home-service/src/main/java/com/cxx/home/dto/AwardDto.java
Normal file
43
home-service/src/main/java/com/cxx/home/dto/AwardDto.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonView(PlainView.class)
|
||||
public class AwardDto {
|
||||
@Schema(description = "id")
|
||||
@JsonView(ReadView.class)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date date;
|
||||
|
||||
@Schema(description = "地点")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "所属人")
|
||||
private String owner;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "图片路径")
|
||||
private List<String> imageList;
|
||||
}
|
||||
53
home-service/src/main/java/com/cxx/home/dto/CarEventDto.java
Normal file
53
home-service/src/main/java/com/cxx/home/dto/CarEventDto.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.PositiveOrZero;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonView(PlainView.class)
|
||||
public class CarEventDto {
|
||||
@Schema(description = "id")
|
||||
@JsonView(ReadView.class)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@NotBlank(message = "汽车名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private LocalDate date;
|
||||
|
||||
@Schema(description = "当前里程")
|
||||
@PositiveOrZero(message = "里程必须大于等于0")
|
||||
private Integer mileage;
|
||||
|
||||
@Schema(description = "cost")
|
||||
@PositiveOrZero(message = "花费必须大于等于0")
|
||||
private Integer cost;
|
||||
|
||||
@Schema(description = "地点")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图片路径")
|
||||
private String imageUrl;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.health;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -9,7 +9,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -29,12 +29,12 @@ public class HealthRecordDto {
|
||||
private Double weight;
|
||||
|
||||
@Schema(description = "睡眠开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime sleepStartTime;
|
||||
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
|
||||
private LocalTime sleepStartTime;
|
||||
|
||||
@Schema(description = "睡眠结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime sleepEndTime;
|
||||
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
|
||||
private LocalTime sleepEndTime;
|
||||
|
||||
@Schema(description = "睡眠时长")
|
||||
private Double sleepDuration;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.journal;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.kpi;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.ledger;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.password;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cxx.home.dto.product;
|
||||
package com.cxx.home.dto;
|
||||
|
||||
import com.cxx.common.PlainView;
|
||||
import com.cxx.common.ReadView;
|
||||
@@ -32,18 +32,10 @@ public class ProductDto {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date expiryDate;
|
||||
|
||||
@Schema(description = "总天数")
|
||||
@JsonView(ReadView.class)
|
||||
private Integer totalDay;
|
||||
|
||||
@Schema(description = "价格")
|
||||
@PositiveOrZero(message = "商品价格必须大于等于0")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "日均价格")
|
||||
@JsonView(ReadView.class)
|
||||
private Double averagePrice;
|
||||
|
||||
@Schema(description = "类别")
|
||||
private String category;
|
||||
|
||||
32
home-service/src/main/java/com/cxx/home/entity/Award.java
Normal file
32
home-service/src/main/java/com/cxx/home/entity/Award.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.cxx.home.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cxx.framework.data.AbstractEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("award")
|
||||
public class Award extends AbstractEntity {
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@TableField("date")
|
||||
private Date date;
|
||||
|
||||
@TableField("location")
|
||||
private String location;
|
||||
|
||||
@TableField("owner")
|
||||
private String owner;
|
||||
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.cxx.home.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("award_image")
|
||||
public class AwardImage {
|
||||
@TableField("award_id")
|
||||
private Long awardId;
|
||||
|
||||
@TableField("image_url")
|
||||
private String imageUrl;
|
||||
}
|
||||
41
home-service/src/main/java/com/cxx/home/entity/CarEvent.java
Normal file
41
home-service/src/main/java/com/cxx/home/entity/CarEvent.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.cxx.home.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.cxx.framework.data.AbstractEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("car_event")
|
||||
public class CarEvent extends AbstractEntity {
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@TableField("date")
|
||||
private LocalDate date;
|
||||
|
||||
@TableField("mileage")
|
||||
private Integer mileage;
|
||||
|
||||
@TableField("cost")
|
||||
private Integer cost;
|
||||
|
||||
@TableField("location")
|
||||
private String location;
|
||||
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
@TableField("image_url")
|
||||
private String imageUrl;
|
||||
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -23,10 +24,10 @@ public class HealthRecord extends AbstractEntity {
|
||||
private Double weight;
|
||||
|
||||
@TableField("sleep_start_time")
|
||||
private LocalDateTime sleepStartTime;
|
||||
private LocalTime sleepStartTime;
|
||||
|
||||
@TableField("sleep_end_time")
|
||||
private LocalDateTime sleepEndTime;
|
||||
private LocalTime sleepEndTime;
|
||||
|
||||
@TableField("sleep_duration")
|
||||
private Double sleepDuration;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.cxx.home.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cxx.home.entity.AwardImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AwardImageMapper extends BaseMapper<AwardImage> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.cxx.home.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cxx.home.entity.Award;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AwardMapper extends BaseMapper<Award> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.cxx.home.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cxx.home.entity.CarEvent;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CarEventMapper extends BaseMapper<CarEvent> {
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.home.dto.anniversary.AnniversaryDto;
|
||||
import com.cxx.home.dto.AnniversaryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.asset.AssetDto;
|
||||
import com.cxx.home.dto.AssetDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.AwardDto;
|
||||
import com.cxx.home.vo.AwardQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AwardService {
|
||||
Boolean addAward(AwardDto dto);
|
||||
|
||||
Boolean updateAward(Long id, AwardDto dto);
|
||||
|
||||
Boolean deleteAward(Long id);
|
||||
|
||||
AwardDto queryAward(Long id);
|
||||
|
||||
List<AwardDto> queryAwardList(AwardQueryVo vo);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
|
||||
import com.cxx.home.dto.CarEventDto;
|
||||
import com.cxx.home.vo.CarQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CarEventService {
|
||||
Boolean addCarEvent(CarEventDto dto);
|
||||
|
||||
Boolean updateCarEvent(Long id, CarEventDto dto);
|
||||
|
||||
Boolean deleteCarEvent(Long id);
|
||||
|
||||
List<CarEventDto> queryCarEventList(CarQueryVo query);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
|
||||
import com.cxx.home.dto.health.HealthRecordDto;
|
||||
import com.cxx.home.dto.HealthRecordDto;
|
||||
import com.cxx.home.vo.HealthQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.journal.JournalDto;
|
||||
import com.cxx.home.dto.JournalDto;
|
||||
import com.cxx.home.vo.JournalQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.kpi.KpiDto;
|
||||
import com.cxx.home.dto.KpiDto;
|
||||
import com.cxx.home.vo.KpiQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.ledger.LedgerDto;
|
||||
import com.cxx.home.dto.LedgerDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
import com.cxx.home.dto.password.PasswordDto;
|
||||
import com.cxx.home.dto.PasswordDto;
|
||||
import com.cxx.home.vo.PasswordQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.cxx.home.service;
|
||||
|
||||
|
||||
import com.cxx.home.dto.product.ProductDto;
|
||||
import com.cxx.home.dto.ProductDto;
|
||||
import com.cxx.home.vo.ProductQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductService {
|
||||
Boolean addProduct(ProductDto productDto);
|
||||
Boolean addProduct(ProductDto dto);
|
||||
|
||||
Boolean updateProduct(Long id, ProductDto productDto);
|
||||
Boolean updateProduct(Long id, ProductDto dto);
|
||||
|
||||
Boolean deleteProduct(Long id);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.dao.AnniversaryDao;
|
||||
import com.cxx.home.dto.anniversary.AnniversaryDto;
|
||||
import com.cxx.home.dto.AnniversaryDto;
|
||||
import com.cxx.home.entity.Anniversary;
|
||||
import com.cxx.home.mapper.AnniversaryMapper;
|
||||
import com.cxx.home.service.AnniversaryService;
|
||||
@@ -21,7 +21,6 @@ public class AnniversaryServiceImpl implements AnniversaryService {
|
||||
@Resource
|
||||
private AnniversaryMapper anniversaryMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean addAnniversary(AnniversaryDto anniversaryDto) {
|
||||
Anniversary anniversary = new Anniversary();
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.service.impl;
|
||||
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.dao.AssetDao;
|
||||
import com.cxx.home.dto.asset.AssetDto;
|
||||
import com.cxx.home.dto.AssetDto;
|
||||
import com.cxx.home.entity.Asset;
|
||||
import com.cxx.home.mapper.AssetMapper;
|
||||
import com.cxx.home.service.AssetService;
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.cxx.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.converter.AwardConverter;
|
||||
import com.cxx.home.dao.AwardDao;
|
||||
import com.cxx.home.dto.AwardDto;
|
||||
import com.cxx.home.entity.Award;
|
||||
import com.cxx.home.entity.AwardImage;
|
||||
import com.cxx.home.mapper.AwardImageMapper;
|
||||
import com.cxx.home.mapper.AwardMapper;
|
||||
import com.cxx.home.service.AwardService;
|
||||
import com.cxx.home.vo.AwardQueryVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AwardServiceImpl implements AwardService {
|
||||
@Resource
|
||||
private AwardDao awardDao;
|
||||
|
||||
@Resource
|
||||
private AwardMapper awardMapper;
|
||||
|
||||
@Resource
|
||||
private AwardImageMapper awardImageMapper;
|
||||
|
||||
@Resource
|
||||
private AwardConverter awardConverter;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean addAward(AwardDto dto) {
|
||||
Award award = awardConverter.toEntity(dto);
|
||||
awardMapper.insert(award);
|
||||
|
||||
insertAwardImage(award.getId(), dto.getImageList());
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateAward(Long id, AwardDto dto) {
|
||||
if (awardMapper.selectById(id) == null) {
|
||||
throw new CustomException("该证书不存在");
|
||||
}
|
||||
|
||||
Award award = awardConverter.toEntity(dto);
|
||||
award.setId(id);
|
||||
|
||||
awardMapper.updateById(award);
|
||||
|
||||
deleteAwardImage(id);
|
||||
insertAwardImage(id, dto.getImageList());
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean deleteAward(Long id) {
|
||||
return awardMapper.deleteById(id) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AwardDto queryAward(Long id) {
|
||||
if (awardMapper.selectById(id) == null) {
|
||||
throw new CustomException("该证书不存在");
|
||||
}
|
||||
|
||||
return awardConverter.toDto(awardMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AwardDto> queryAwardList(AwardQueryVo vo) {
|
||||
return awardDao.queryAwardList(vo);
|
||||
}
|
||||
|
||||
private void insertAwardImage(Long awardId, List<String> imageList) {
|
||||
if (!imageList.isEmpty()) {
|
||||
awardDao.insertAwardImage(awardId, imageList);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteAwardImage(Long id) {
|
||||
awardImageMapper.delete(Wrappers.lambdaQuery(AwardImage.class).eq(AwardImage::getAwardId, id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.cxx.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.cxx.home.converter.CarEventConverter;
|
||||
import com.cxx.home.dao.CarEventDao;
|
||||
import com.cxx.home.dto.CarEventDto;
|
||||
import com.cxx.home.entity.CarEvent;
|
||||
import com.cxx.home.mapper.CarEventMapper;
|
||||
import com.cxx.home.service.CarEventService;
|
||||
import com.cxx.home.vo.CarQueryVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CarEventServiceImpl implements CarEventService {
|
||||
@Resource
|
||||
private CarEventMapper carEventMapper;
|
||||
|
||||
@Resource
|
||||
private CarEventConverter carEventConverter;
|
||||
|
||||
@Resource
|
||||
private CarEventDao carEventDao;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean addCarEvent(CarEventDto dto) {
|
||||
CarEvent carEvent = new CarEvent();
|
||||
BeanUtils.copyProperties(dto, carEvent);
|
||||
return carEventMapper.insert(carEvent) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateCarEvent(Long id, CarEventDto dto) {
|
||||
CarEvent carEvent = new CarEvent();
|
||||
BeanUtils.copyProperties(dto, carEvent);
|
||||
carEvent.setId(id);
|
||||
return carEventMapper.updateById(carEvent) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean deleteCarEvent(Long id) {
|
||||
return carEventMapper.deleteById(id) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarEventDto> queryCarEventList(CarQueryVo query) {
|
||||
return carEventDao.queryCarEventList(query);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cxx.home.converter.HealthConverter;
|
||||
import com.cxx.home.dto.health.HealthRecordDto;
|
||||
import com.cxx.home.dto.HealthRecordDto;
|
||||
import com.cxx.home.entity.HealthRecord;
|
||||
import com.cxx.home.mapper.HealthRecordMapper;
|
||||
import com.cxx.home.service.HealthService;
|
||||
@@ -11,9 +11,7 @@ import com.cxx.home.vo.HealthQueryVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -40,7 +38,6 @@ public class HealthServiceImpl implements HealthService {
|
||||
@Override
|
||||
public Boolean update(Long id, HealthRecordDto dto) {
|
||||
if (id == 0) {
|
||||
setSleepDuration(dto);
|
||||
return healthRecordMapper.insert(healthConverter.toEntity(dto)) == 1;
|
||||
} else {
|
||||
if ((dto.getSportProject() == null || dto.getSportProject().isEmpty())
|
||||
@@ -48,19 +45,10 @@ public class HealthServiceImpl implements HealthService {
|
||||
&& dto.getSportDuration() == 0 && dto.getWeight() == 0) {
|
||||
return healthRecordMapper.deleteById(id) == 1;
|
||||
} else {
|
||||
setSleepDuration(dto);
|
||||
HealthRecord healthRecord = healthConverter.toEntity(dto);
|
||||
healthRecord.setId(id);
|
||||
return healthRecordMapper.updateById(healthRecord) == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setSleepDuration(HealthRecordDto dto) {
|
||||
LocalDateTime startTime = dto.getSleepStartTime();
|
||||
LocalDateTime endTime = dto.getSleepEndTime();
|
||||
if (startTime != null && endTime != null) {
|
||||
dto.setSleepDuration(Duration.between(startTime, endTime).toMinutes() / 60.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.converter.JournalConverter;
|
||||
import com.cxx.home.dao.JournalDao;
|
||||
import com.cxx.home.dto.journal.JournalDto;
|
||||
import com.cxx.home.dto.JournalDto;
|
||||
import com.cxx.home.entity.Journal;
|
||||
import com.cxx.home.mapper.JournalMapper;
|
||||
import com.cxx.home.service.JournalService;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.converter.KpiConverter;
|
||||
import com.cxx.home.dto.kpi.KpiDto;
|
||||
import com.cxx.home.dto.KpiDto;
|
||||
import com.cxx.home.entity.Kpi;
|
||||
import com.cxx.home.mapper.KpiMapper;
|
||||
import com.cxx.home.service.KpiService;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.cxx.home.service.impl;
|
||||
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.dao.LedgerDao;
|
||||
import com.cxx.home.dto.ledger.LedgerDto;
|
||||
import com.cxx.home.dto.LedgerDto;
|
||||
import com.cxx.home.entity.Ledger;
|
||||
import com.cxx.home.mapper.LedgerMapper;
|
||||
import com.cxx.home.service.LedgerService;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.dao.PasswordDao;
|
||||
import com.cxx.home.dto.password.PasswordDto;
|
||||
import com.cxx.home.dto.PasswordDto;
|
||||
import com.cxx.home.entity.Password;
|
||||
import com.cxx.home.mapper.PasswordMapper;
|
||||
import com.cxx.home.service.PasswordService;
|
||||
@@ -61,7 +61,7 @@ public class PasswordServiceImpl implements PasswordService {
|
||||
|
||||
@Override
|
||||
public List<PasswordDto> query(PasswordQueryVo query) {
|
||||
List<PasswordDto> passwordList = passwordDao.query(query);
|
||||
List<PasswordDto> passwordList = passwordDao.queryPasswordList(query);
|
||||
|
||||
passwordList.forEach(item -> item.setPassword(CommonUtils.decryptStr(secretKey, item.getPassword())));
|
||||
return passwordList;
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cxx.framework.web.CustomException;
|
||||
import com.cxx.home.converter.ProductConverter;
|
||||
import com.cxx.home.dao.ProductDao;
|
||||
import com.cxx.home.dto.product.ProductDto;
|
||||
import com.cxx.home.dto.ProductDto;
|
||||
import com.cxx.home.entity.*;
|
||||
import com.cxx.home.mapper.*;
|
||||
import com.cxx.home.service.ProductService;
|
||||
|
||||
@@ -99,8 +99,8 @@ public class TravelServiceImpl implements TravelService {
|
||||
BeanUtils.copyProperties(travelRecordDto, travelRecord);
|
||||
travelRecordMapper.insert(travelRecord);
|
||||
|
||||
insertTravelImage(travelRecord.getTravelId(), travelRecordDto.getImageList());
|
||||
insertTravelVideo(travelRecord.getTravelId(), travelRecordDto.getVideoList());
|
||||
insertTravelImage(travelRecord.getId(), travelRecordDto.getImageList());
|
||||
insertTravelVideo(travelRecord.getId(), travelRecordDto.getVideoList());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
12
home-service/src/main/java/com/cxx/home/vo/AwardQueryVo.java
Normal file
12
home-service/src/main/java/com/cxx/home/vo/AwardQueryVo.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AwardQueryVo {
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
}
|
||||
12
home-service/src/main/java/com/cxx/home/vo/CarQueryVo.java
Normal file
12
home-service/src/main/java/com/cxx/home/vo/CarQueryVo.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CarQueryVo {
|
||||
@Schema(description = "事件类别")
|
||||
private String type;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.cxx.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.cxx.home.dao.AnniversaryDao">
|
||||
<select id="queryAnniversary" resultType="com.cxx.home.dto.anniversary.AnniversaryDto">
|
||||
<select id="queryAnniversary" resultType="com.cxx.home.dto.AnniversaryDto">
|
||||
SELECT id AS id,
|
||||
title AS title,
|
||||
date AS date,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.cxx.home.dao.AssetDao">
|
||||
<select id="queryAsset" resultType="com.cxx.home.dto.asset.AssetDto">
|
||||
<select id="queryAsset" resultType="com.cxx.home.dto.AssetDto">
|
||||
SELECT id AS id,
|
||||
category AS category,
|
||||
NAME AS NAME,
|
||||
|
||||
47
home-service/src/main/resources/mapper/AwardMapper.xml
Normal file
47
home-service/src/main/resources/mapper/AwardMapper.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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.cxx.home.dao.AwardDao">
|
||||
<resultMap id="awardResultMap" type="com.cxx.home.dto.AwardDto">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="date" column="date"/>
|
||||
<result property="location" column="location"/>
|
||||
<result property="owner" column="owner"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<collection property="imageList" ofType="java.lang.String"
|
||||
column="id" select="queryAwardImage"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryAwardImage" resultType="java.lang.String">
|
||||
SELECT image_url AS imageUrl
|
||||
FROM award_image
|
||||
WHERE award_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryAwardList" resultMap="awardResultMap">
|
||||
SELECT
|
||||
id AS id,
|
||||
name AS name,
|
||||
type AS type,
|
||||
date AS date,
|
||||
location AS location,
|
||||
owner AS owner,
|
||||
remark AS remark
|
||||
FROM
|
||||
award
|
||||
<where>
|
||||
<if test="query.type != null and query.type != ''">
|
||||
type = #{query.type}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY date DESC
|
||||
</select>
|
||||
|
||||
<insert id="insertAwardImage">
|
||||
INSERT INTO award_image (award_id, image_url) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{awardId}, #{item})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
25
home-service/src/main/resources/mapper/CarEventMapper.xml
Normal file
25
home-service/src/main/resources/mapper/CarEventMapper.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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.cxx.home.dao.CarEventDao">
|
||||
<select id="queryCarEventList" resultType="com.cxx.home.dto.CarEventDto">
|
||||
SELECT
|
||||
id AS id,
|
||||
name AS name,
|
||||
type AS type,
|
||||
date AS date,
|
||||
mileage AS mileage,
|
||||
cost AS cost,
|
||||
location AS location,
|
||||
description AS description,
|
||||
image_url AS imageUrl,
|
||||
remark AS remark
|
||||
FROM
|
||||
car_event
|
||||
<where>
|
||||
<if test="query.type != null and query.type != ''">
|
||||
type = #{query.type}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY date DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.cxx.home.dao.JournalDao">
|
||||
<select id="queryJournal" resultType="com.cxx.home.dto.journal.JournalDto">
|
||||
<select id="queryJournal" resultType="com.cxx.home.dto.JournalDto">
|
||||
SELECT id AS id,
|
||||
date AS date,
|
||||
location AS location,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.cxx.home.dao.LedgerDao">
|
||||
<select id="queryLedger" resultType="com.cxx.home.dto.ledger.LedgerDto">
|
||||
<select id="queryLedger" resultType="com.cxx.home.dto.LedgerDto">
|
||||
SELECT id AS id,
|
||||
book AS book,
|
||||
category AS category,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?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.cxx.home.dao.PasswordDao">
|
||||
<select id="query" resultType="com.cxx.home.dto.password.PasswordDto">
|
||||
<select id="queryPasswordList" resultType="com.cxx.home.dto.PasswordDto">
|
||||
SELECT
|
||||
id AS id,
|
||||
title AS title,
|
||||
website AS website,
|
||||
username AS username,
|
||||
password AS password,
|
||||
category AS category,
|
||||
owner AS owner,
|
||||
remark AS remark
|
||||
id AS id,
|
||||
title AS title,
|
||||
website AS website,
|
||||
username AS username,
|
||||
password AS password,
|
||||
category AS category,
|
||||
owner AS owner,
|
||||
remark AS remark
|
||||
FROM
|
||||
password
|
||||
<where>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?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.cxx.home.dao.ProductDao">
|
||||
<select id="queryProductList" resultType="com.cxx.home.dto.product.ProductDto">
|
||||
<select id="queryProductList" resultType="com.cxx.home.dto.ProductDto">
|
||||
SELECT
|
||||
id AS id,
|
||||
name AS name,
|
||||
purchase_date AS purchaseDate,
|
||||
expiry_date AS expiryDate,
|
||||
@totalDay := (DATEDIFF(CURDATE(), purchase_date) + 1) AS totalDay,
|
||||
price AS price,
|
||||
ROUND(price / @totalDay, 2) AS averagePrice,
|
||||
category AS category,
|
||||
purchaser AS purchaser,
|
||||
channel AS channel,
|
||||
image_url AS imageUrl
|
||||
id AS id,
|
||||
name AS name,
|
||||
purchase_date AS purchaseDate,
|
||||
expiry_date AS expiryDate,
|
||||
price AS price,
|
||||
category AS category,
|
||||
purchaser AS purchaser,
|
||||
channel AS channel,
|
||||
image_url AS imageUrl
|
||||
FROM
|
||||
product
|
||||
<where>
|
||||
@@ -24,11 +22,8 @@
|
||||
<if test="query.order == 'date' or query.order == '' or query.order == null">
|
||||
ORDER BY purchase_date DESC
|
||||
</if>
|
||||
<if test="query.order == 'day'">
|
||||
ORDER BY totalDay
|
||||
</if>
|
||||
<if test="query.order == 'price'">
|
||||
ORDER BY averagePrice
|
||||
ORDER BY price DESC
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -91,22 +91,24 @@
|
||||
a.router AS router,
|
||||
a.foods AS foods,
|
||||
a.projects AS projects,
|
||||
a.remark AS remake
|
||||
a.remark AS remark
|
||||
FROM travel_spot a
|
||||
WHERE a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryTravelSummary" resultMap="travelSummaryResultMap">
|
||||
SELECT a.id AS id,
|
||||
a.name AS name,
|
||||
a.area AS area,
|
||||
a.recommend_rate AS recommendRate
|
||||
SELECT
|
||||
a.id AS id,
|
||||
a.name AS name,
|
||||
a.area AS area,
|
||||
a.recommend_rate AS recommendRate
|
||||
FROM travel_spot a
|
||||
<where>
|
||||
<if test="query.category != null and query.category != ''">
|
||||
a.city = #{query.category}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryTravelStats" resultType="com.cxx.home.dto.travel.TravelStatsDto">
|
||||
|
||||
Reference in New Issue
Block a user