Browse Source

奖学金类型维护

dzx 1 year ago
parent
commit
972443375f
15 changed files with 880 additions and 28 deletions
  1. 104 0
      src/main/java/com/xjrsoft/module/student/controller/BaseStudentScholarshipCategoryController.java
  2. 69 0
      src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentScholarshipCategoryDto.java
  3. 48 0
      src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentScholarshipLevelDto.java
  4. 26 0
      src/main/java/com/xjrsoft/module/student/dto/BaseStudentScholarshipCategoryPageDto.java
  5. 33 0
      src/main/java/com/xjrsoft/module/student/dto/UpdateBaseStudentScholarshipCategoryDto.java
  6. 120 0
      src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipCategory.java
  7. 98 0
      src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipLevel.java
  8. 17 0
      src/main/java/com/xjrsoft/module/student/mapper/BaseStudentScholarshipCategoryMapper.java
  9. 17 0
      src/main/java/com/xjrsoft/module/student/mapper/BaseStudentScholarshipLevelMapper.java
  10. 40 0
      src/main/java/com/xjrsoft/module/student/service/IBaseStudentScholarshipCategoryService.java
  11. 88 0
      src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentScholarshipCategoryServiceImpl.java
  12. 61 0
      src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipCategoryPageVo.java
  13. 70 0
      src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipCategoryVo.java
  14. 49 0
      src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipLevelVo.java
  15. 40 28
      src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

+ 104 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentScholarshipCategoryController.java

@@ -0,0 +1,104 @@
+package com.xjrsoft.module.student.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.yulichang.toolkit.MPJWrappers;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipCategoryDto;
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipCategoryPageDto;
+import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipCategoryDto;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
+import com.xjrsoft.module.student.service.IBaseStudentScholarshipCategoryService;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipCategoryPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipCategoryVo;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@RestController
+@RequestMapping("/student" + "/baseStudentScholarshipCategory")
+@Api(value = "/student"  + "/baseStudentScholarshipCategory",tags = "奖学金类别代码")
+@AllArgsConstructor
+public class BaseStudentScholarshipCategoryController {
+
+
+    private final IBaseStudentScholarshipCategoryService baseStudentScholarshipCategoryService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value="奖学金类别列表(分页)")
+    @SaCheckPermission("basestudentscholarshipcategory:detail")
+    public RT<PageOutput<BaseStudentScholarshipCategoryPageVo>> page(@Valid BaseStudentScholarshipCategoryPageDto dto){
+        IPage<BaseStudentScholarshipCategoryPageVo> page = baseStudentScholarshipCategoryService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentScholarshipCategoryPageVo.class,
+                MPJWrappers.<BaseStudentScholarshipCategory>lambdaJoin()
+                        .select(BaseStudentScholarshipCategory::getId)
+                        .selectAs(DictionaryDetail::getName, BaseStudentScholarshipCategoryPageVo::getScholarshipSourceCn)
+                        .select(BaseStudentScholarshipCategory.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentScholarshipCategoryPageVo.class).contains(x.getProperty()))
+                        .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentScholarshipCategory::getScholarshipSource)
+        );
+
+        PageOutput<BaseStudentScholarshipCategoryPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipCategoryPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询奖学金类别信息")
+    @SaCheckPermission("basestudentscholarshipcategory:detail")
+    public RT<BaseStudentScholarshipCategoryVo> info(@RequestParam Long id){
+        BaseStudentScholarshipCategory baseStudentScholarshipCategory = baseStudentScholarshipCategoryService.getByIdDeep(id);
+        if (baseStudentScholarshipCategory == null) {
+           return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(baseStudentScholarshipCategory, BaseStudentScholarshipCategoryVo.class));
+    }
+
+
+    @PostMapping
+    @ApiOperation(value = "新增奖学金类别")
+    @SaCheckPermission("basestudentscholarshipcategory:add")
+    public RT<Boolean> add(@Valid @RequestBody AddBaseStudentScholarshipCategoryDto dto){
+        BaseStudentScholarshipCategory baseStudentScholarshipCategory = BeanUtil.toBean(dto, BaseStudentScholarshipCategory.class);
+        boolean isSuccess = baseStudentScholarshipCategoryService.add(baseStudentScholarshipCategory);
+        return RT.ok(isSuccess);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改奖学金类别")
+    @SaCheckPermission("basestudentscholarshipcategory:edit")
+    public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentScholarshipCategoryDto dto){
+
+        BaseStudentScholarshipCategory baseStudentScholarshipCategory = BeanUtil.toBean(dto, BaseStudentScholarshipCategory.class);
+        return RT.ok(baseStudentScholarshipCategoryService.update(baseStudentScholarshipCategory));
+
+    }
+
+    @DeleteMapping
+    @ApiOperation(value = "删除奖学金类别")
+    @SaCheckPermission("basestudentscholarshipcategory:delete")
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        return RT.ok(baseStudentScholarshipCategoryService.delete(ids));
+
+    }
+
+}

+ 69 - 0
src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentScholarshipCategoryDto.java

@@ -0,0 +1,69 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipLevel;
+
+
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class AddBaseStudentScholarshipCategoryDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 名称
+    */
+    @ApiModelProperty("名称")
+    private String name;
+    /**
+    * 奖学金来源(xjr_dictionary_item[scholarship_source])
+    */
+    @ApiModelProperty("奖学金来源(xjr_dictionary_item[scholarship_source])")
+    private String scholarshipSource;
+    /**
+    * 学期ID(base_semester)
+    */
+    @ApiModelProperty("学期ID(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 总金额
+    */
+    @ApiModelProperty("总金额")
+    private Double totalAmount;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer scholarshipLevel;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+
+    /**
+    * baseStudentScholarshipLevel
+    */
+    @ApiModelProperty("baseStudentScholarshipLevel子表")
+    private List<AddBaseStudentScholarshipLevelDto> baseStudentScholarshipLevelList;
+}

+ 48 - 0
src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentScholarshipLevelDto.java

@@ -0,0 +1,48 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 奖学金级别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class AddBaseStudentScholarshipLevelDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 奖学金类别ID(base_student_scholarship_category)
+    */
+    @ApiModelProperty("奖学金类别ID(base_student_scholarship_category)")
+    private Long baseStudentScholarshipCategoryId;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer level;
+    /**
+    * 金额
+    */
+    @ApiModelProperty("金额")
+    private Double amount;
+
+}

+ 26 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentScholarshipCategoryPageDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.student.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* @title: 奖学金类别分页查询入参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseStudentScholarshipCategoryPageDto extends PageInput {
+
+
+}

+ 33 - 0
src/main/java/com/xjrsoft/module/student/dto/UpdateBaseStudentScholarshipCategoryDto.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipLevel;
+
+
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class UpdateBaseStudentScholarshipCategoryDto extends AddBaseStudentScholarshipCategoryDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+}

+ 120 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipCategory.java

@@ -0,0 +1,120 @@
+package com.xjrsoft.module.student.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+@TableName("base_student_scholarship_category")
+@ApiModel(value = "base_student_scholarship_category", description = "奖学金类别")
+public class BaseStudentScholarshipCategory implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 名称
+    */
+    @ApiModelProperty("名称")
+    private String name;
+    /**
+    * 奖学金来源(xjr_dictionary_item[scholarship_source])
+    */
+    @ApiModelProperty("奖学金来源(xjr_dictionary_item[scholarship_source])")
+    private String scholarshipSource;
+    /**
+    * 学期ID(base_semester)
+    */
+    @ApiModelProperty("学期ID(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 总金额
+    */
+    @ApiModelProperty("总金额")
+    private Double totalAmount;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer scholarshipLevel;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+
+    /**
+    * baseStudentScholarshipLevel
+    */
+    @ApiModelProperty("baseStudentScholarshipLevel子表")
+    @TableField(exist = false)
+    @EntityMapping(thisField = "id", joinField = "baseStudentScholarshipCategoryId")
+    private List<BaseStudentScholarshipLevel> baseStudentScholarshipLevelList;
+
+}

+ 98 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipLevel.java

@@ -0,0 +1,98 @@
+package com.xjrsoft.module.student.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 奖学金级别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+@TableName("base_student_scholarship_level")
+@ApiModel(value = "base_student_scholarship_level", description = "奖学金级别")
+public class BaseStudentScholarshipLevel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 奖学金类别ID(base_student_scholarship_category)
+    */
+    @ApiModelProperty("奖学金类别ID(base_student_scholarship_category)")
+    private Long baseStudentScholarshipCategoryId;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer level;
+    /**
+    * 金额
+    */
+    @ApiModelProperty("金额")
+    private Double amount;
+
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentScholarshipCategoryMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.student.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Mapper
+public interface BaseStudentScholarshipCategoryMapper extends MPJBaseMapper<BaseStudentScholarshipCategory> {
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentScholarshipLevelMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.student.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipLevel;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 奖学金级别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Mapper
+public interface BaseStudentScholarshipLevelMapper extends MPJBaseMapper<BaseStudentScholarshipLevel> {
+
+}

+ 40 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentScholarshipCategoryService.java

@@ -0,0 +1,40 @@
+package com.xjrsoft.module.student.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
+import lombok.Data;
+import java.util.List;
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+
+public interface IBaseStudentScholarshipCategoryService extends MPJBaseService<BaseStudentScholarshipCategory> {
+    /**
+    * 新增
+    *
+    * @param baseStudentScholarshipCategory
+    * @return
+    */
+    Boolean add(BaseStudentScholarshipCategory baseStudentScholarshipCategory);
+
+    /**
+    * 更新
+    *
+    * @param baseStudentScholarshipCategory
+    * @return
+    */
+    Boolean update(BaseStudentScholarshipCategory baseStudentScholarshipCategory);
+
+    /**
+    * 删除
+    *
+    * @param ids
+    * @return
+    */
+    Boolean delete(List<Long> ids);
+}

+ 88 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentScholarshipCategoryServiceImpl.java

@@ -0,0 +1,88 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipLevel;
+import com.xjrsoft.module.student.mapper.BaseStudentScholarshipCategoryMapper;
+import com.xjrsoft.module.student.mapper.BaseStudentScholarshipLevelMapper;
+import com.xjrsoft.module.student.service.IBaseStudentScholarshipCategoryService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+* @title: 奖学金类别
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class BaseStudentScholarshipCategoryServiceImpl extends MPJBaseServiceImpl<BaseStudentScholarshipCategoryMapper, BaseStudentScholarshipCategory> implements IBaseStudentScholarshipCategoryService {
+    private final BaseStudentScholarshipCategoryMapper baseStudentScholarshipCategoryBaseStudentScholarshipCategoryMapper;
+
+    private final BaseStudentScholarshipLevelMapper baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean add(BaseStudentScholarshipCategory baseStudentScholarshipCategory) {
+        baseStudentScholarshipCategoryBaseStudentScholarshipCategoryMapper.insert(baseStudentScholarshipCategory);
+        for (BaseStudentScholarshipLevel baseStudentScholarshipLevel : baseStudentScholarshipCategory.getBaseStudentScholarshipLevelList()) {
+            baseStudentScholarshipLevel.setBaseStudentScholarshipCategoryId(baseStudentScholarshipCategory.getId());
+            baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.insert(baseStudentScholarshipLevel);
+        }
+
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean update(BaseStudentScholarshipCategory baseStudentScholarshipCategory) {
+        baseStudentScholarshipCategoryBaseStudentScholarshipCategoryMapper.updateById(baseStudentScholarshipCategory);
+        //********************************* BaseStudentScholarshipLevel  增删改  开始 *******************************************/
+        {
+            // 查出所有子级的id
+            List<BaseStudentScholarshipLevel> baseStudentScholarshipLevelList = baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.selectList(Wrappers.lambdaQuery(BaseStudentScholarshipLevel.class).eq(BaseStudentScholarshipLevel::getBaseStudentScholarshipCategoryId, baseStudentScholarshipCategory.getId()).select(BaseStudentScholarshipLevel::getId));
+            List<Long> baseStudentScholarshipLevelIds = baseStudentScholarshipLevelList.stream().map(BaseStudentScholarshipLevel::getId).collect(Collectors.toList());
+            //原有子表单 没有被删除的主键
+            List<Long> baseStudentScholarshipLevelOldIds = baseStudentScholarshipCategory.getBaseStudentScholarshipLevelList().stream().map(BaseStudentScholarshipLevel::getId).filter(Objects::nonNull).collect(Collectors.toList());
+            //找到需要删除的id
+            List<Long> baseStudentScholarshipLevelRemoveIds = baseStudentScholarshipLevelIds.stream().filter(item -> !baseStudentScholarshipLevelOldIds.contains(item)).collect(Collectors.toList());
+
+            for (BaseStudentScholarshipLevel baseStudentScholarshipLevel : baseStudentScholarshipCategory.getBaseStudentScholarshipLevelList()) {
+                //如果不等于空则修改
+                if (baseStudentScholarshipLevel.getId() != null) {
+                    baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.updateById(baseStudentScholarshipLevel);
+                }
+                //如果等于空 则新增
+                else {
+                    //已经不存在的id 删除
+                    baseStudentScholarshipLevel.setBaseStudentScholarshipCategoryId(baseStudentScholarshipCategory.getId());
+                    baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.insert(baseStudentScholarshipLevel);
+                }
+            }
+            //已经不存在的id 删除
+            if(baseStudentScholarshipLevelRemoveIds.size() > 0){
+                baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.deleteBatchIds(baseStudentScholarshipLevelRemoveIds);
+            }
+        }
+        //********************************* BaseStudentScholarshipLevel  增删改  结束 *******************************************/
+
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean delete(List<Long> ids) {
+        baseStudentScholarshipCategoryBaseStudentScholarshipCategoryMapper.deleteBatchIds(ids);
+        baseStudentScholarshipCategoryBaseStudentScholarshipLevelMapper.delete(Wrappers.lambdaQuery(BaseStudentScholarshipLevel.class).in(BaseStudentScholarshipLevel::getBaseStudentScholarshipCategoryId, ids));
+
+        return true;
+    }
+}

+ 61 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipCategoryPageVo.java

@@ -0,0 +1,61 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 奖学金类别分页列表出参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class BaseStudentScholarshipCategoryPageVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private String id;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 名称
+    */
+    @ApiModelProperty("名称")
+    private String name;
+    /**
+    * 奖学金来源(xjr_dictionary_item[scholarship_source])
+    */
+    @ApiModelProperty("奖学金来源(xjr_dictionary_item[scholarship_source])")
+    private String scholarshipSource;
+    /**
+     * 奖学金来源-中文
+     */
+    @ApiModelProperty("奖学金来源-中文")
+    private String scholarshipSourceCn;
+    /**
+    * 学期ID(base_semester)
+    */
+    @ApiModelProperty("学期ID(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 总金额
+    */
+    @ApiModelProperty("总金额")
+    private Double totalAmount;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer scholarshipLevel;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+
+}

+ 70 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipCategoryVo.java

@@ -0,0 +1,70 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipLevel;
+
+/**
+* @title: 奖学金类别表单出参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class BaseStudentScholarshipCategoryVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 名称
+    */
+    @ApiModelProperty("名称")
+    private String name;
+    /**
+    * 奖学金来源(xjr_dictionary_item[scholarship_source])
+    */
+    @ApiModelProperty("奖学金来源(xjr_dictionary_item[scholarship_source])")
+    private String scholarshipSource;
+    /**
+    * 学期ID(base_semester)
+    */
+    @ApiModelProperty("学期ID(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 总金额
+    */
+    @ApiModelProperty("总金额")
+    private Double totalAmount;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer scholarshipLevel;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+
+
+    /**
+    * baseStudentScholarshipLevel
+    */
+    @ApiModelProperty("baseStudentScholarshipLevel子表")
+    private List<BaseStudentScholarshipLevelVo> baseStudentScholarshipLevelList;
+
+}

+ 49 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipLevelVo.java

@@ -0,0 +1,49 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+/**
+* @title: 奖学金级别表单出参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class BaseStudentScholarshipLevelVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 奖学金类别ID(base_student_scholarship_category)
+    */
+    @ApiModelProperty("奖学金类别ID(base_student_scholarship_category)")
+    private Long baseStudentScholarshipCategoryId;
+    /**
+    * 奖学金等级 0=无等级
+    */
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer level;
+    /**
+    * 金额
+    */
+    @ApiModelProperty("金额")
+    private Double amount;
+
+
+
+}

+ 40 - 28
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -1,43 +1,17 @@
 package com.xjrsoft.xjrsoftboot;
 
-import cn.dev33.satoken.secure.SaSecureUtil;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.db.ds.simple.SimpleDataSource;
-import cn.hutool.db.meta.Column;
-import cn.hutool.db.meta.MetaUtil;
-import cn.hutool.db.meta.Table;
-import cn.hutool.http.HttpUtil;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.xjrsoft.XjrSoftApplication;
 import com.xjrsoft.common.constant.GlobalConstant;
-import com.xjrsoft.common.utils.DatasourceUtil;
-import com.xjrsoft.common.utils.JdbcToJavaUtil;
-import com.xjrsoft.module.generator.constant.EntityConstant;
 import com.xjrsoft.module.generator.dto.ApiGenerateCodesDto;
-import com.xjrsoft.module.generator.entity.FieldConfig;
-import com.xjrsoft.module.generator.entity.GeneratorConfig;
 import com.xjrsoft.module.generator.entity.TableConfig;
 import com.xjrsoft.module.generator.service.IApiGeneratorService;
 import com.xjrsoft.module.generator.service.impl.ApiGeneratorServiceImpl;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import lombok.AllArgsConstructor;
 import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
-import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
 
 import javax.sql.DataSource;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.List;
 
 public class FreeMarkerGeneratorTest {
 
@@ -730,6 +704,44 @@ public class FreeMarkerGeneratorTest {
         params.setDs(ds);
 
 
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
+
+    /**
+     * 奖学金类型维护
+     */
+    @Test
+    public void gcBaseStudentScholarshipCategory() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("base_student_scholarship_category");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        mainTable = new TableConfig();
+        mainTable.setTableName("base_student_scholarship_level");//init_sql中的表名
+        mainTable.setIsMain(false);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        mainTable.setRelationField("base_student_scholarship_category_id");//设置外键
+        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("student");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);//是否生成分页接口
+        params.setImport(false);//是否生成导入接口
+        params.setExport(false);//是否生成导出接口
+        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+
         IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
 
         apiGeneratorService.generateCodes(params);