feat:增加奖状证书模块

This commit is contained in:
2026-04-01 23:24:30 +08:00
parent 638a1a9186
commit 17b20a3d4b
61 changed files with 425 additions and 71 deletions

View File

@@ -3,7 +3,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; import com.cxx.common.WriteView;
import com.cxx.common.dto.StatsChartDto; 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.cxx.home.service.AnniversaryService;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@@ -2,7 +2,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.cxx.home.service.AssetService;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@@ -1,16 +1,8 @@
package com.cxx.home.controller; package com.cxx.home.controller;
import cn.dev33.satoken.stp.StpUtil; 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.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; 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 org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;

View File

@@ -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);
}
}

View File

@@ -2,7 +2,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.service.HealthService;
import com.cxx.home.vo.HealthQueryVo; import com.cxx.home.vo.HealthQueryVo;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;

View File

@@ -3,7 +3,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.service.JournalService;
import com.cxx.home.vo.JournalQueryVo; import com.cxx.home.vo.JournalQueryVo;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;

View File

@@ -2,7 +2,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.service.KpiService;
import com.cxx.home.vo.KpiQueryVo; import com.cxx.home.vo.KpiQueryVo;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;

View File

@@ -2,7 +2,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.cxx.home.service.LedgerService;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@@ -2,7 +2,7 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.service.PasswordService;
import com.cxx.home.vo.PasswordQueryVo; import com.cxx.home.vo.PasswordQueryVo;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;

View File

@@ -1,9 +1,8 @@
package com.cxx.home.controller; package com.cxx.home.controller;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
import com.cxx.common.WriteView; 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.service.ProductService;
import com.cxx.home.vo.ProductQueryVo; import com.cxx.home.vo.ProductQueryVo;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;

View File

@@ -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);
}

View File

@@ -1,6 +1,6 @@
package com.cxx.home.converter; 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 com.cxx.home.entity.HealthRecord;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.converter; 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 com.cxx.home.entity.Journal;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.converter; 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 com.cxx.home.entity.Kpi;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.converter; 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 com.cxx.home.entity.Product;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;

View File

@@ -1,7 +1,7 @@
package com.cxx.home.dao; package com.cxx.home.dao;
import com.cxx.common.dto.StatsChartDto; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.dao; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View 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);
}

View File

@@ -1,6 +1,6 @@
package com.cxx.home.dao; 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 com.cxx.home.vo.JournalQueryVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.dao; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.dao; 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 com.cxx.home.vo.PasswordQueryVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -9,7 +9,7 @@ import java.util.List;
@Mapper @Mapper
public interface PasswordDao { public interface PasswordDao {
List<PasswordDto> query(@Param("query") PasswordQueryVo query); List<PasswordDto> queryPasswordList(@Param("query") PasswordQueryVo query);
List<String> queryCategory(); List<String> queryCategory();
} }

View File

@@ -1,6 +1,6 @@
package com.cxx.home.dao; 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 com.cxx.home.vo.ProductQueryVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.anniversary; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.asset; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View 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;
}

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.health; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;
@@ -9,7 +9,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
@Getter @Getter

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.journal; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.kpi; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.ledger; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.password; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View File

@@ -1,4 +1,4 @@
package com.cxx.home.dto.product; package com.cxx.home.dto;
import com.cxx.common.PlainView; import com.cxx.common.PlainView;
import com.cxx.common.ReadView; import com.cxx.common.ReadView;

View 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;
}

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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> {
}

View File

@@ -1,7 +1,7 @@
package com.cxx.home.service; package com.cxx.home.service;
import com.cxx.common.dto.StatsChartDto; import com.cxx.common.dto.StatsChartDto;
import com.cxx.home.dto.anniversary.AnniversaryDto; import com.cxx.home.dto.AnniversaryDto;
import java.util.List; import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service; package com.cxx.home.service;
import com.cxx.home.dto.asset.AssetDto; import com.cxx.home.dto.AssetDto;
import java.util.List; import java.util.List;

View File

@@ -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);
}

View File

@@ -1,7 +1,7 @@
package com.cxx.home.service; 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 com.cxx.home.vo.HealthQueryVo;
import java.util.List; import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service; 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 com.cxx.home.vo.JournalQueryVo;
import java.util.List; import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service; 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 com.cxx.home.vo.KpiQueryVo;
import java.util.List; import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service; package com.cxx.home.service;
import com.cxx.home.dto.ledger.LedgerDto; import com.cxx.home.dto.LedgerDto;
import java.util.List; import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service; 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 com.cxx.home.vo.PasswordQueryVo;
import java.util.List; import java.util.List;

View File

@@ -1,7 +1,7 @@
package com.cxx.home.service; 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 com.cxx.home.vo.ProductQueryVo;
import java.util.List; import java.util.List;

View File

@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
import com.cxx.common.dto.StatsChartDto; import com.cxx.common.dto.StatsChartDto;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.dao.AnniversaryDao; 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.entity.Anniversary;
import com.cxx.home.mapper.AnniversaryMapper; import com.cxx.home.mapper.AnniversaryMapper;
import com.cxx.home.service.AnniversaryService; import com.cxx.home.service.AnniversaryService;
@@ -21,7 +21,6 @@ public class AnniversaryServiceImpl implements AnniversaryService {
@Resource @Resource
private AnniversaryMapper anniversaryMapper; private AnniversaryMapper anniversaryMapper;
@Override @Override
public Boolean addAnniversary(AnniversaryDto anniversaryDto) { public Boolean addAnniversary(AnniversaryDto anniversaryDto) {
Anniversary anniversary = new Anniversary(); Anniversary anniversary = new Anniversary();

View File

@@ -2,7 +2,7 @@ package com.cxx.home.service.impl;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.dao.AssetDao; 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.entity.Asset;
import com.cxx.home.mapper.AssetMapper; import com.cxx.home.mapper.AssetMapper;
import com.cxx.home.service.AssetService; import com.cxx.home.service.AssetService;

View File

@@ -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));
}
}

View File

@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.home.converter.HealthConverter; 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.entity.HealthRecord;
import com.cxx.home.mapper.HealthRecordMapper; import com.cxx.home.mapper.HealthRecordMapper;
import com.cxx.home.service.HealthService; import com.cxx.home.service.HealthService;
@@ -11,9 +11,7 @@ import com.cxx.home.vo.HealthQueryVo;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Service @Service

View File

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.converter.JournalConverter; import com.cxx.home.converter.JournalConverter;
import com.cxx.home.dao.JournalDao; 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.entity.Journal;
import com.cxx.home.mapper.JournalMapper; import com.cxx.home.mapper.JournalMapper;
import com.cxx.home.service.JournalService; import com.cxx.home.service.JournalService;

View File

@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.converter.KpiConverter; 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.entity.Kpi;
import com.cxx.home.mapper.KpiMapper; import com.cxx.home.mapper.KpiMapper;
import com.cxx.home.service.KpiService; import com.cxx.home.service.KpiService;

View File

@@ -2,7 +2,7 @@ package com.cxx.home.service.impl;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.dao.LedgerDao; 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.entity.Ledger;
import com.cxx.home.mapper.LedgerMapper; import com.cxx.home.mapper.LedgerMapper;
import com.cxx.home.service.LedgerService; import com.cxx.home.service.LedgerService;

View File

@@ -3,7 +3,7 @@ package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.dao.PasswordDao; 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.entity.Password;
import com.cxx.home.mapper.PasswordMapper; import com.cxx.home.mapper.PasswordMapper;
import com.cxx.home.service.PasswordService; import com.cxx.home.service.PasswordService;
@@ -61,7 +61,7 @@ public class PasswordServiceImpl implements PasswordService {
@Override @Override
public List<PasswordDto> query(PasswordQueryVo query) { 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()))); passwordList.forEach(item -> item.setPassword(CommonUtils.decryptStr(secretKey, item.getPassword())));
return passwordList; return passwordList;

View File

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.framework.web.CustomException; import com.cxx.framework.web.CustomException;
import com.cxx.home.converter.ProductConverter; import com.cxx.home.converter.ProductConverter;
import com.cxx.home.dao.ProductDao; 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.entity.*;
import com.cxx.home.mapper.*; import com.cxx.home.mapper.*;
import com.cxx.home.service.ProductService; import com.cxx.home.service.ProductService;

View File

@@ -0,0 +1,13 @@
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;
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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, SELECT id AS id,
title AS title, title AS title,
date AS date, date AS date,

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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, SELECT id AS id,
category AS category, category AS category,
NAME AS NAME, NAME AS NAME,

View File

@@ -0,0 +1,46 @@
<?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>
</select>
<insert id="insertAwardImage">
INSERT INTO award_image (award_id, image_url) VALUES
<foreach collection="list" item="item" separator=",">
(#{awardId}, #{item})
</foreach>
</insert>
</mapper>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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, SELECT id AS id,
date AS date, date AS date,
location AS location, location AS location,

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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, SELECT id AS id,
book AS book, book AS book,
category AS category, category AS category,

View File

@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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 SELECT
id AS id, id AS id,
title AS title, title AS title,
website AS website, website AS website,
username AS username, username AS username,
password AS password, password AS password,
category AS category, category AS category,
owner AS owner, owner AS owner,
remark AS remark remark AS remark
FROM FROM
password password
<where> <where>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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 SELECT
id AS id, id AS id,
name AS name, name AS name,