54219 字
约 180 分钟
32
appendix_L
2026-09-26
无标签
附录L 代码生成器模块源码详解
模块概览(面向 0 基础读者):
- 对 MyBatis-Plus Generator 做统一封装,一键生成 CRUD 代码。
- 提供多套模板(Velocity/FreeMarker/Beetl)方便团队定制。
- 支持按模块细分生成入口,快速同步数据库结构到代码。
核心目录:
xuecheng-plus-generator/src/main/java/com/xuecheng/generatorxuecheng-plus-generator/src/main/resources/templatesxuecheng-plus-generator/pom.xml
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CourseBaseController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseBaseService; // 导入 CourseBaseService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseBase") // 使用注解 @RequestMapping("courseBase")
public class CourseBaseController { // 定义 class CourseBaseController
@Autowired // 使用注解 @Autowired
private CourseBaseService courseBaseService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CourseCategoryController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseCategoryService; // 导入 CourseCategoryService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseCategory") // 使用注解 @RequestMapping("courseCategory")
public class CourseCategoryController { // 定义 class CourseCategoryController
@Autowired // 使用注解 @Autowired
private CourseCategoryService courseCategoryService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CourseMarketController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseMarketService; // 导入 CourseMarketService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseMarket") // 使用注解 @RequestMapping("courseMarket")
public class CourseMarketController { // 定义 class CourseMarketController
@Autowired // 使用注解 @Autowired
private CourseMarketService courseMarketService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CoursePublishController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CoursePublishService; // 导入 CoursePublishService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("coursePublish") // 使用注解 @RequestMapping("coursePublish")
public class CoursePublishController { // 定义 class CoursePublishController
@Autowired // 使用注解 @Autowired
private CoursePublishService coursePublishService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CoursePublishPreController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CoursePublishPreService; // 导入 CoursePublishPreService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("coursePublishPre") // 使用注解 @RequestMapping("coursePublishPre")
public class CoursePublishPreController { // 定义 class CoursePublishPreController
@Autowired // 使用注解 @Autowired
private CoursePublishPreService coursePublishPreService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/CourseTeacherController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseTeacherService; // 导入 CourseTeacherService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseTeacher") // 使用注解 @RequestMapping("courseTeacher")
public class CourseTeacherController { // 定义 class CourseTeacherController
@Autowired // 使用注解 @Autowired
private CourseTeacherService courseTeacherService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/TeachplanController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.TeachplanService; // 导入 TeachplanService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("teachplan") // 使用注解 @RequestMapping("teachplan")
public class TeachplanController { // 定义 class TeachplanController
@Autowired // 使用注解 @Autowired
private TeachplanService teachplanService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/controller/TeachplanMediaController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.TeachplanMediaService; // 导入 TeachplanMediaService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("teachplanMedia") // 使用注解 @RequestMapping("teachplanMedia")
public class TeachplanMediaController { // 定义 class TeachplanMediaController
@Autowired // 使用注解 @Autowired
private TeachplanMediaService teachplanMediaService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseBaseMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseBaseMapper extends BaseMapper<CourseBase> { // 定义 interface CourseBaseMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseBaseMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseBaseMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseBase"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="change_date" property="changeDate" /> <!-- 字段与属性的映射规则 -->
<result column="create_people" property="createPeople" /> <!-- 字段与属性的映射规则 -->
<result column="change_people" property="changePeople" /> <!-- 字段与属性的映射规则 -->
<result column="audit_status" property="auditStatus" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, mt, st, grade, teachmode, description, pic, create_date, change_date, create_people, change_people, audit_status, status <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseCategoryMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseCategoryMapper extends BaseMapper<CourseCategory> { // 定义 interface CourseCategoryMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseCategoryMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseCategoryMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseCategory"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="label" property="label" /> <!-- 字段与属性的映射规则 -->
<result column="parentid" property="parentid" /> <!-- 字段与属性的映射规则 -->
<result column="is_show" property="isShow" /> <!-- 字段与属性的映射规则 -->
<result column="orderby" property="orderby" /> <!-- 字段与属性的映射规则 -->
<result column="is_leaf" property="isLeaf" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, name, label, parentid, is_show, orderby, is_leaf <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseMarketMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseMarketMapper extends BaseMapper<CourseMarket> { // 定义 interface CourseMarketMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseMarketMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseMarketMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseMarket"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="qq" property="qq" /> <!-- 字段与属性的映射规则 -->
<result column="wechat" property="wechat" /> <!-- 字段与属性的映射规则 -->
<result column="phone" property="phone" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, charge, price, original_price, qq, wechat, phone, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CoursePublishMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishMapper extends BaseMapper<CoursePublish> { // 定义 interface CoursePublishMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CoursePublishMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CoursePublishMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CoursePublish"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="username" property="username" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="mt_name" property="mtName" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="st_name" property="stName" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="market" property="market" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan" property="teachplan" /> <!-- 字段与属性的映射规则 -->
<result column="teachers" property="teachers" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="online_date" property="onlineDate" /> <!-- 字段与属性的映射规则 -->
<result column="offline_date" property="offlineDate" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="remark" property="remark" /> <!-- 字段与属性的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, username, mt, mt_name, st, st_name, grade, teachmode, pic, description, market, teachplan, teachers, create_date, online_date, offline_date, status, remark, charge, price, original_price, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CoursePublishPreMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishPreMapper extends BaseMapper<CoursePublishPre> { // 定义 interface CoursePublishPreMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CoursePublishPreMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CoursePublishPreMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CoursePublishPre"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="username" property="username" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="mt_name" property="mtName" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="st_name" property="stName" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="market" property="market" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan" property="teachplan" /> <!-- 字段与属性的映射规则 -->
<result column="teachers" property="teachers" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="audit_date" property="auditDate" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="remark" property="remark" /> <!-- 字段与属性的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, username, mt, mt_name, st, st_name, grade, teachmode, pic, description, market, teachplan, teachers, create_date, audit_date, status, remark, charge, price, original_price, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseTeacherMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseTeacherMapper extends BaseMapper<CourseTeacher> { // 定义 interface CourseTeacherMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/CourseTeacherMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseTeacherMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseTeacher"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="teacher_name" property="teacherName" /> <!-- 字段与属性的映射规则 -->
<result column="position" property="position" /> <!-- 字段与属性的映射规则 -->
<result column="introduction" property="introduction" /> <!-- 字段与属性的映射规则 -->
<result column="photograph" property="photograph" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, course_id, teacher_name, position, introduction, photograph, create_date <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/TeachplanMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMapper extends BaseMapper<Teachplan> { // 定义 interface TeachplanMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/TeachplanMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.TeachplanMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.Teachplan"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="pname" property="pname" /> <!-- 字段与属性的映射规则 -->
<result column="parentid" property="parentid" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="media_type" property="mediaType" /> <!-- 字段与属性的映射规则 -->
<result column="start_time" property="startTime" /> <!-- 字段与属性的映射规则 -->
<result column="end_time" property="endTime" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="timelength" property="timelength" /> <!-- 字段与属性的映射规则 -->
<result column="orderby" property="orderby" /> <!-- 字段与属性的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="course_pub_id" property="coursePubId" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="is_preview" property="isPreview" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="change_date" property="changeDate" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, pname, parentid, grade, media_type, start_time, end_time, description, timelength, orderby, course_id, course_pub_id, status, is_preview, create_date, change_date <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/TeachplanMediaMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMediaMapper extends BaseMapper<TeachplanMedia> { // 定义 interface TeachplanMediaMapper
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/mapper/TeachplanMediaMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.TeachplanMediaMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.TeachplanMedia"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="media_id" property="mediaId" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan_id" property="teachplanId" /> <!-- 字段与属性的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="media_fileName" property="mediaFilename" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="create_people" property="createPeople" /> <!-- 字段与属性的映射规则 -->
<result column="change_people" property="changePeople" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, media_id, teachplan_id, course_id, media_fileName, create_date, create_people, change_people <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CourseBase.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_base") // 使用注解 @TableName("course_base")
public class CourseBase implements Serializable { // 定义 class CourseBase
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 机构名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 课程标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式(common普通,record 录播,live直播等) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 修改时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT_UPDATE) // 使用注解 @TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime changeDate; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String createPeople; // 执行语句
/** // 保留原作者写的块注释
* 更新人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String changePeople; // 执行语句
/** // 保留原作者写的块注释
* 审核状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String auditStatus; // 执行语句
/** // 保留原作者写的块注释
* 课程发布状态 未发布 已发布 下线 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CourseCategory.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_category") // 使用注解 @TableName("course_category")
public class CourseCategory implements Serializable { // 定义 class CourseCategory
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String id; // 执行语句
/** // 保留原作者写的块注释
* 分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 分类标签默认和名称一样 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String label; // 执行语句
/** // 保留原作者写的块注释
* 父结点id(第一级的父节点是0,自关联字段id) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String parentid; // 执行语句
/** // 保留原作者写的块注释
* 是否显示 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer isShow; // 执行语句
/** // 保留原作者写的块注释
* 排序字段 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer orderby; // 执行语句
/** // 保留原作者写的块注释
* 是否叶子 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer isLeaf; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CourseMarket.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_market") // 使用注解 @TableName("course_market")
public class CourseMarket implements Serializable { // 定义 class CourseMarket
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键,课程id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 咨询qq // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String qq; // 执行语句
/** // 保留原作者写的块注释
* 微信 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String wechat; // 执行语句
/** // 保留原作者写的块注释
* 电话 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String phone; // 执行语句
/** // 保留原作者写的块注释
* 有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CoursePublish.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_publish") // 使用注解 @TableName("course_publish")
public class CoursePublish implements Serializable { // 定义 class CoursePublish
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 公司名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String username; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 大分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mtName; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 小分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String stName; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程营销信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String market; // 执行语句
/** // 保留原作者写的块注释
* 所有课程计划,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachplan; // 执行语句
/** // 保留原作者写的块注释
* 教师信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachers; // 执行语句
/** // 保留原作者写的块注释
* 发布时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 上架时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime onlineDate; // 执行语句
/** // 保留原作者写的块注释
* 下架时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime offlineDate; // 执行语句
/** // 保留原作者写的块注释
* 发布状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
/** // 保留原作者写的块注释
* 备注 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String remark; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典--203 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 课程有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CoursePublishPre.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_publish_pre") // 使用注解 @TableName("course_publish_pre")
public class CoursePublishPre implements Serializable { // 定义 class CoursePublishPre
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 公司名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String username; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 大分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mtName; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 小分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String stName; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程营销信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String market; // 执行语句
/** // 保留原作者写的块注释
* 所有课程计划,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachplan; // 执行语句
/** // 保留原作者写的块注释
* 教师信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachers; // 执行语句
/** // 保留原作者写的块注释
* 提交时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 审核时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime auditDate; // 执行语句
/** // 保留原作者写的块注释
* 状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
/** // 保留原作者写的块注释
* 备注 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String remark; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典--203 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 课程有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/CourseTeacher.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_teacher") // 使用注解 @TableName("course_teacher")
public class CourseTeacher implements Serializable { // 定义 class CourseTeacher
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 教师标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teacherName; // 执行语句
/** // 保留原作者写的块注释
* 教师职位 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String position; // 执行语句
/** // 保留原作者写的块注释
* 教师简介 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String introduction; // 执行语句
/** // 保留原作者写的块注释
* 照片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String photograph; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/Teachplan.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("teachplan") // 使用注解 @TableName("teachplan")
public class Teachplan implements Serializable { // 定义 class Teachplan
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 课程计划名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pname; // 执行语句
/** // 保留原作者写的块注释
* 课程计划父级Id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long parentid; // 执行语句
/** // 保留原作者写的块注释
* 层级,分为1、2、3级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer grade; // 执行语句
/** // 保留原作者写的块注释
* 课程类型:1视频、2文档 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mediaType; // 执行语句
/** // 保留原作者写的块注释
* 开始直播时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime startTime; // 执行语句
/** // 保留原作者写的块注释
* 直播结束时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime endTime; // 执行语句
/** // 保留原作者写的块注释
* 章节及课程时介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 时长,单位时:分:秒 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String timelength; // 执行语句
/** // 保留原作者写的块注释
* 排序字段 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer orderby; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 课程发布标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long coursePubId; // 执行语句
/** // 保留原作者写的块注释
* 状态(1正常 0删除) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer status; // 执行语句
/** // 保留原作者写的块注释
* 是否支持试学或预览(试看) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String isPreview; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 修改时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT_UPDATE) // 使用注解 @TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime changeDate; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/model/po/TeachplanMedia.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("teachplan_media") // 使用注解 @TableName("teachplan_media")
public class TeachplanMedia implements Serializable { // 定义 class TeachplanMedia
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 媒资文件id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mediaId; // 执行语句
/** // 保留原作者写的块注释
* 课程计划标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long teachplanId; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 媒资文件原始名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField("media_fileName") // 使用注解 @TableField("media_fileName")
private String mediaFilename; // 执行语句
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String createPeople; // 执行语句
/** // 保留原作者写的块注释
* 修改人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String changePeople; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CourseBaseService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseBaseService extends IService<CourseBase> { // 定义 interface CourseBaseService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CourseCategoryService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseCategoryService extends IService<CourseCategory> { // 定义 interface CourseCategoryService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CourseMarketService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseMarketService extends IService<CourseMarket> { // 定义 interface CourseMarketService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CoursePublishPreService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishPreService extends IService<CoursePublishPre> { // 定义 interface CoursePublishPreService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CoursePublishService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishService extends IService<CoursePublish> { // 定义 interface CoursePublishService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/CourseTeacherService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseTeacherService extends IService<CourseTeacher> { // 定义 interface CourseTeacherService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CourseBaseServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.xuecheng.content.mapper.CourseBaseMapper; // 导入 CourseBaseMapper 类
import com.xuecheng.content.service.CourseBaseService; // 导入 CourseBaseService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseBaseServiceImpl extends ServiceImpl<CourseBaseMapper, CourseBase> implements CourseBaseService { // 定义 class CourseBaseServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CourseCategoryServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.xuecheng.content.mapper.CourseCategoryMapper; // 导入 CourseCategoryMapper 类
import com.xuecheng.content.service.CourseCategoryService; // 导入 CourseCategoryService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseCategoryServiceImpl extends ServiceImpl<CourseCategoryMapper, CourseCategory> implements CourseCategoryService { // 定义 class CourseCategoryServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CourseMarketServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.xuecheng.content.mapper.CourseMarketMapper; // 导入 CourseMarketMapper 类
import com.xuecheng.content.service.CourseMarketService; // 导入 CourseMarketService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketMapper, CourseMarket> implements CourseMarketService { // 定义 class CourseMarketServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CoursePublishPreServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.xuecheng.content.mapper.CoursePublishPreMapper; // 导入 CoursePublishPreMapper 类
import com.xuecheng.content.service.CoursePublishPreService; // 导入 CoursePublishPreService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CoursePublishPreServiceImpl extends ServiceImpl<CoursePublishPreMapper, CoursePublishPre> implements CoursePublishPreService { // 定义 class CoursePublishPreServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CoursePublishServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.xuecheng.content.mapper.CoursePublishMapper; // 导入 CoursePublishMapper 类
import com.xuecheng.content.service.CoursePublishService; // 导入 CoursePublishService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CoursePublishServiceImpl extends ServiceImpl<CoursePublishMapper, CoursePublish> implements CoursePublishService { // 定义 class CoursePublishServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/CourseTeacherServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.xuecheng.content.mapper.CourseTeacherMapper; // 导入 CourseTeacherMapper 类
import com.xuecheng.content.service.CourseTeacherService; // 导入 CourseTeacherService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseTeacherServiceImpl extends ServiceImpl<CourseTeacherMapper, CourseTeacher> implements CourseTeacherService { // 定义 class CourseTeacherServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/TeachplanMediaServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.xuecheng.content.mapper.TeachplanMediaMapper; // 导入 TeachplanMediaMapper 类
import com.xuecheng.content.service.TeachplanMediaService; // 导入 TeachplanMediaService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class TeachplanMediaServiceImpl extends ServiceImpl<TeachplanMediaMapper, TeachplanMedia> implements TeachplanMediaService { // 定义 class TeachplanMediaServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/impl/TeachplanServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.xuecheng.content.mapper.TeachplanMapper; // 导入 TeachplanMapper 类
import com.xuecheng.content.service.TeachplanService; // 导入 TeachplanService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class TeachplanServiceImpl extends ServiceImpl<TeachplanMapper, Teachplan> implements TeachplanService { // 定义 class TeachplanServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/TeachplanMediaService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMediaService extends IService<TeachplanMedia> { // 定义 interface TeachplanMediaService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/content/service/TeachplanService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanService extends IService<Teachplan> { // 定义 interface TeachplanService
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/BankCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class BankCodeGenerator { // 定义 class BankCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "bank1"; // 把 "bank1" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "root"; // 把 "root" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"account_info", // 代码逻辑
"de_duplication", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://localhost:3306/" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setParent("com.xuecheng.rocketmq"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/CommonCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class CommonCodeGenerator { // 定义 class CommonCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "comments"; // 把 "comments" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "root"; // 把 "root" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"comment", // 代码逻辑
"comment_reply", // 代码逻辑
"comment_target", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = true; // 把 true 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://localhost:3306/" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/ContentCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class ContentCodeGenerator { // 定义 class ContentCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "content"; // 把 "content" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
// "mq_message", // 保留原作者写的行内注释
// "mq_message_history" // 保留原作者写的行内注释
"course_base", // 代码逻辑
"course_market", // 代码逻辑
"course_teacher", // 代码逻辑
"course_category", // 代码逻辑
"teachplan", // 代码逻辑
"teachplan_media", // 代码逻辑
"course_publish", // 代码逻辑
"course_publish_pre" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xc402_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/LearningCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class LearningCodeGenerator { // 定义 class LearningCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "learning"; // 把 "learning" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"xc_learn_record" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/MediaCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class MediaCodeGenerator { // 定义 class MediaCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "media"; // 把 "media" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"media_files", // 代码逻辑
"media_process", // 代码逻辑
"media_process_history", // 代码逻辑
"mq_message", // 代码逻辑
"mq_message_history" // 代码逻辑
// "live_course", // 保留原作者写的行内注释
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_media" // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
//此项是将生成的po类名中去掉pc.getModuleName() + "_" // 保留原作者写的行内注释
// strategy.setTablePrefix(pc.getModuleName() + "_"); // 保留原作者写的行内注释
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/MessageCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class MessageCodeGenerator { // 定义 class MessageCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "messagesdk"; // 把 "messagesdk" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"mq_message", // 代码逻辑
"mq_message_history" // 代码逻辑
// "course_base", // 保留原作者写的行内注释
// "course_market", // 保留原作者写的行内注释
// "teachplan", // 保留原作者写的行内注释
// "teachplan_media", // 保留原作者写的行内注释
// "course_teacher", // 保留原作者写的行内注释
// "course_pub", // 保留原作者写的行内注释
// "course_pub_pre" // 保留原作者写的行内注释
// "course_category" // 保留原作者写的行内注释
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_content" // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/OrderCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class OrderCodeGenerator { // 定义 class OrderCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "orders"; // 把 "orders" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
// "mq_message", // 保留原作者写的行内注释
// "mq_message_history", // 保留原作者写的行内注释
"xc_orders", // 代码逻辑
"xc_orders_goods", // 代码逻辑
"xc_pay_record" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/SystemCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class SystemCodeGenerator { // 定义 class SystemCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "system"; // 把 "system" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"course_category", // 代码逻辑
"dictionary", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/main/com/xuecheng/generator/UcenterCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class UcenterCodeGenerator { // 定义 class UcenterCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "ucenter"; // 把 "ucenter" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"xc_company", // 代码逻辑
"xc_company_user", // 代码逻辑
"xc_menu", // 代码逻辑
"xc_permission", // 代码逻辑
"xc_role", // 代码逻辑
"xc_teacher", // 代码逻辑
"xc_user", // 代码逻辑
"xc_user_role" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_users" // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <!-- SQL 语句片段 -->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <!-- SQL 语句片段 -->
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <!-- SQL 语句片段 -->
<parent> <!-- SQL 语句片段 -->
<artifactId>xuecheng-plus-parent</artifactId> <!-- SQL 语句片段 -->
<groupId>com.xuecheng</groupId> <!-- SQL 语句片段 -->
<version>0.0.1-SNAPSHOT</version> <!-- SQL 语句片段 -->
<relativePath>../xuecheng-plus-parent</relativePath> <!-- SQL 语句片段 -->
</parent> <!-- SQL 语句片段 -->
<modelVersion>4.0.0</modelVersion> <!-- SQL 语句片段 -->
<artifactId>xuecheng-plus-generator</artifactId> <!-- SQL 语句片段 -->
<dependencies> <!-- SQL 语句片段 -->
<!-- 日志相关配置 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>org.springframework.boot</groupId> <!-- SQL 语句片段 -->
<artifactId>spring-boot-starter</artifactId> <!-- SQL 语句片段 -->
<exclusions> <!-- SQL 语句片段 -->
<exclusion> <!-- SQL 语句片段 -->
<groupId>org.springframework.boot</groupId> <!-- SQL 语句片段 -->
<artifactId>spring-boot-starter-logging</artifactId> <!-- SQL 语句片段 -->
</exclusion> <!-- SQL 语句片段 -->
</exclusions> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>org.springframework.boot</groupId> <!-- SQL 语句片段 -->
<artifactId>spring-boot-starter-log4j2</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- mp 的 Spring boot 启动器 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>com.baomidou</groupId> <!-- SQL 语句片段 -->
<artifactId>mybatis-plus-boot-starter</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- mp 代码生成器 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>com.baomidou</groupId> <!-- SQL 语句片段 -->
<artifactId>mybatis-plus-generator</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- spring boot 的 freemark 模板引擎 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>org.springframework.boot</groupId> <!-- SQL 语句片段 -->
<artifactId>spring-boot-starter-freemarker</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- 数据库连接池 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>com.alibaba</groupId> <!-- SQL 语句片段 -->
<artifactId>druid-spring-boot-starter</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- 数据库驱动包 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>mysql</groupId> <!-- SQL 语句片段 -->
<artifactId>mysql-connector-java</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- lombok -->
<dependency> <!-- SQL 语句片段 -->
<groupId>org.projectlombok</groupId> <!-- SQL 语句片段 -->
<artifactId>lombok</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<!-- 只用swagger注解, 缩小依赖的lib包 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>io.swagger</groupId> <!-- SQL 语句片段 -->
<artifactId>swagger-annotations</artifactId> <!-- SQL 语句片段 -->
<version>1.5.20</version> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
<dependency> <!-- SQL 语句片段 -->
<groupId>org.springframework</groupId> <!-- SQL 语句片段 -->
<artifactId>spring-web</artifactId> <!-- SQL 语句片段 -->
</dependency> <!-- SQL 语句片段 -->
</dependencies> <!-- SQL 语句片段 -->
</project> <!-- SQL 语句片段 -->
文件:xuecheng-plus-generator/resources/templates/resources/templates/controller.java.ftl
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
import ${package.Service}.${table.serviceName};
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
/**
* <p>
* ${table.comment!} 前端控制器
* </p>
*
* @author ${author}
*/
@Slf4j
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
@RequestMapping("${entity?uncap_first}")
public class ${table.controllerName} {
</#if>
@Autowired
private ${table.serviceName} ${table.serviceName?uncap_first};
}
</#if>
文件:xuecheng-plus-generator/resources/templates/resources/templates/entity.java.ftl
package ${package.Entity};
<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
</#if>
import com.baomidou.mybatisplus.annotation.TableName;
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
*/
<#if entityLombokModel>
@Data
</#if>
<#if !swagger2>
@TableName("${table.name}")
</#if>
<#if swagger2>
@ApiModel(value="${entity}", description="${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#else>
public class ${entity} implements Serializable {
</#if>
private static final long serialVersionUID = 1L;
<#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
<#if swagger2>
@ApiModelProperty(value = "${field.comment}")
<#else>
/**
* ${field.comment}
*/
</#if>
</#if>
<#if !swagger2>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.name}", type = IdType.AUTO)
<#elseif idType??>
@TableId(value = "${field.name}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.name}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.name}")
</#if>
</#if>
<#-- 乐观锁注解 -->
<#if (versionFieldName!"") == field.name>
@Version
</#if>
<#-- 逻辑删除注解 -->
<#if (logicDeleteFieldName!"") == field.name>
@TableLogic
</#if>
private ${field.propertyType} ${field.propertyName};
</#list>
<#------------ END 字段循环遍历 ---------->
<#if !entityLombokModel>
<#list table.fields as field>
<#if field.propertyType == "boolean">
<#assign getprefix="is"/>
<#else>
<#assign getprefix="get"/>
</#if>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<#if entityBuilderModel>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<#else>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
</#if>
this.${field.propertyName} = ${field.propertyName};
<#if entityBuilderModel>
return this;
</#if>
}
</#list>
</#if>
<#if entityColumnConstant>
<#list table.fields as field>
public static final String ${field.name?upper_case} = "${field.name}";
</#list>
</#if>
<#if activeRecord>
@Override
protected Serializable pkVal() {
<#if keyPropertyName??>
return this.${keyPropertyName};
<#else>
return null;
</#if>
}
</#if>
<#if !entityLombokModel>
@Override
public String toString() {
return "${entity}{" +
<#list table.fields as field>
<#if field_index==0>
"${field.propertyName}=" + ${field.propertyName} +
<#else>
", ${field.propertyName}=" + ${field.propertyName} +
</#if>
</#list>
"}";
}
</#if>
}
文件:xuecheng-plus-generator/resources/templates/resources/templates/mapper.java.ftl
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.springframework.stereotype.Repository;
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
*/
<#if kotlin>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<#else>
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
</#if>
文件:xuecheng-plus-generator/resources/templates/resources/templates/serviceImpl.java.ftl
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
*/
@Slf4j
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
</#if>
文件:xuecheng-plus-generator/resources/templates/templates/default/controller.btl
package ${entity.controllerPackage};
import cn.exrick.xboot.base.XbootBaseController;
import cn.exrick.xboot.common.utils.PageUtil;
import cn.exrick.xboot.common.utils.ResultUtil;
import cn.exrick.xboot.common.vo.PageVo;
import cn.exrick.xboot.common.vo.Result;
import ${entity.entityPackage}.${entity.className};
import ${entity.servicePackage}.${entity.className}Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.springframework.transaction.annotation.Transactional;
/**
* @author ${entity.author}
*/
@Slf4j
@RestController
@Api(description = "${entity.description}管理接口")
@RequestMapping("/xboot/${entity.classNameLowerCase}")
@Transactional
public class ${entity.className}Controller extends XbootBaseController<${entity.className}, ${entity.primaryKeyType}>{
@Autowired
private ${entity.className}Service ${entity.classNameLowerCase}Service;
@Override
public ${entity.className}Service getService() {
return ${entity.classNameLowerCase}Service;
}
}
文件:xuecheng-plus-generator/resources/templates/templates/default/controller.java.btl
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
<% if(restControllerStyle){ %>
import org.springframework.web.bind.annotation.RestController;
<% }else{ %>
import org.springframework.stereotype.Controller;
<% } %>
<% if(isNotEmpty(superControllerClassPackage)){ %>
import ${superControllerClassPackage};
<% } %>
/**
* <p>
* ${table.comment!} 前端控制器
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(restControllerStyle){ %>
@RestController
<% }else{ %>
@Controller
<% } %>
@RequestMapping("<% if(isNotEmpty(package.ModuleName)){ %>/${package.ModuleName}<% } %>/<% if(isNotEmpty(controllerMappingHyphenStyle)){ %>${controllerMappingHyphen}<% }else{ %>${table.entityPath}<% } %>")
<% if(kotlin){ %>
class ${table.controllerName}<% if(isNotEmpty(superControllerClass)){ %> : ${superControllerClass}()<% } %>
<% }else{ %>
<% if(isNotEmpty(superControllerClass)){ %>
public class ${table.controllerName} extends ${superControllerClass} {
<% }else{ %>
public class ${table.controllerName} {
<% } %>
}
<% } %>
文件:xuecheng-plus-generator/resources/templates/templates/default/controller.java.ftl
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
/**
* <p>
* ${table.comment!} 前端控制器
* </p>
*
* @author ${author}
*/
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
}
</#if>
文件:xuecheng-plus-generator/resources/templates/templates/default/controller.java.vm
package ${package.Controller};
import org.springframework.web.bind.annotation.RequestMapping;
#if(${restControllerStyle})
import org.springframework.web.bind.annotation.RestController;
#else
import org.springframework.stereotype.Controller;
#end
#if(${superControllerClassPackage})
import ${superControllerClassPackage};
#end
/**
* <p>
* $!{table.comment} 前端控制器
* </p>
*
* @author ${author}
* @since ${date}
*/
#if(${restControllerStyle})
@RestController
#else
@Controller
#end
@RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end")
#if(${kotlin})
class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end
#else
#if(${superControllerClass})
public class ${table.controllerName} extends ${superControllerClass} {
#else
public class ${table.controllerName} {
#end
}
#end
文件:xuecheng-plus-generator/resources/templates/templates/default/dao.btl
package ${entity.daoPackage};
import cn.exrick.xboot.base.XbootBaseDao;
import ${entity.entityPackage}.${entity.className};
import java.util.List;
/**
* ${entity.description}数据处理层
* @author ${entity.author}
*/
public interface ${entity.className}Dao extends XbootBaseDao<${entity.className},${entity.primaryKeyType}> {
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.btl
package ${entity.entityPackage};
import cn.exrick.xboot.base.XbootBaseEntity;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author ${entity.author}
*/
@Data
@Entity
@Table(name = "${entity.tableName}")
@TableName("${entity.tableName}")
@ApiModel(value = "${entity.description}")
public class ${entity.className} extends XbootBaseEntity {
private static final long serialVersionUID = 1L;
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.java.btl
package ${package.Entity};
<% for(pkg in table.importPackages){ %>
import ${pkg};
<% } %>
<% if(swagger2){ %>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
<% } %>
<% if(entityLombokModel){ %>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
<% } %>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(entityLombokModel){ %>
@Data
<% if(isNotEmpty(superEntityClass)){ %>
@EqualsAndHashCode(callSuper = true)
<% }else{ %>
@EqualsAndHashCode(callSuper = false)
<% } %>
@Accessors(chain = true)
<% } %>
<% if(table.convert){ %>
@TableName("${table.name}")
<% } %>
<% if(swagger2){ %>
@ApiModel(value="${entity}对象", description="${table.comment!''}")
<% } %>
<% if(isNotEmpty(superEntityClass)){ %>
public class ${entity} extends ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{
<% }else if(activeRecord){ %>
public class ${entity} extends Model<${entity}> {
<% }else{ %>
public class ${entity} implements Serializable {
<% } %>
<% if(entitySerialVersionUID){ %>
private static final long serialVersionUID = 1L;
<% } %>
<% /** -----------BEGIN 字段循环遍历----------- **/ %>
<% for(field in table.fields){ %>
<%
if(field.keyFlag){
var keyPropertyName = field.propertyName;
}
%>
<% if(isNotEmpty(field.comment)){ %>
<% if(swagger2){ %>
@ApiModelProperty(value = "${field.comment}")
<% }else{ %>
/**
* ${field.comment}
*/
<% } %>
<% } %>
<% if(field.keyFlag){ %>
<%
/*主键*/
%>
<% if(field.keyIdentityFlag){ %>
@TableId(value = "${field.name}", type = IdType.AUTO)
<% }else if(isNotEmpty(idType)){ %>
@TableId(value = "${field.name}", type = IdType.${idType})
<% }else if(field.convert){ %>
@TableId("${field.name}")
<% } %>
<%
/*普通字段*/
%>
<% }else if(isNotEmpty(field.fill)){ %>
<% if(field.convert){ %>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<% }else{ %>
@TableField(fill = FieldFill.${field.fill})
<% } %>
<% }else if(field.convert){ %>
@TableField("${field.name}")
<% } %>
<%
/*乐观锁注解*/
%>
<% if(versionFieldName!'' == field.name){ %>
@Version
<% } %>
<%
/*逻辑删除注解*/
%>
<% if(logicDeleteFieldName!'' == field.name){ %>
@TableLogic
<% } %>
private ${field.propertyType} ${field.propertyName};
<% } %>
<% /** -----------END 字段循环遍历----------- **/ %>
<% if(!entityLombokModel){ %>
<% for(field in table.fields){ %>
<%
var getprefix ='';
if(field.propertyType=='boolean'){
getprefix='is';
}else{
getprefix='get';
}
%>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<% if(entityBuilderModel){ %>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<% }else{ %>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<% } %>
this.${field.propertyName} = ${field.propertyName};
<% if(entityBuilderModel){ %>
return this;
<% } %>
}
<% } %>
<% } %>
<% if(entityColumnConstant){ %>
<% for(field in table.fields){ %>
public static final String ${strutil.toUpperCase(field.name)} = "${field.name}";
<% } %>
<% } %>
<% if(activeRecord){ %>
@Override
protected Serializable pkVal() {
<% if(isNotEmpty(keyPropertyName)){ %>
return this.${keyPropertyName};
<% }else{ %>
return null;
<% } %>
}
<% } %>
<% if(!entityLombokModel){ %>
@Override
public String toString() {
return "${entity}{" +
<% for(field in table.fields){ %>
<% if(fieldLP.index==0){ %>
"${field.propertyName}=" + ${field.propertyName} +
<% }else{ %>
", ${field.propertyName}=" + ${field.propertyName} +
<% } %>
<% } %>
"}";
}
<% } %>
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.java.ftl
package ${package.Entity};
<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
</#if>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
*/
<#if entityLombokModel>
@Data
<#if superEntityClass??>
@EqualsAndHashCode(callSuper = true)
<#else>
@EqualsAndHashCode(callSuper = false)
</#if>
@Accessors(chain = true)
</#if>
<#if table.convert>
@TableName("${table.name}")
</#if>
<#if swagger2>
@ApiModel(value="${entity}对象", description="${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#else>
public class ${entity} implements Serializable {
</#if>
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L;
</#if>
<#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
<#if swagger2>
@ApiModelProperty(value = "${field.comment}")
<#else>
/**
* ${field.comment}
*/
</#if>
</#if>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.name}", type = IdType.AUTO)
<#elseif idType??>
@TableId(value = "${field.name}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.name}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.name}")
</#if>
<#-- 乐观锁注解 -->
<#if (versionFieldName!"") == field.name>
@Version
</#if>
<#-- 逻辑删除注解 -->
<#if (logicDeleteFieldName!"") == field.name>
@TableLogic
</#if>
private ${field.propertyType} ${field.propertyName};
</#list>
<#------------ END 字段循环遍历 ---------->
<#if !entityLombokModel>
<#list table.fields as field>
<#if field.propertyType == "boolean">
<#assign getprefix="is"/>
<#else>
<#assign getprefix="get"/>
</#if>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<#if entityBuilderModel>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<#else>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
</#if>
this.${field.propertyName} = ${field.propertyName};
<#if entityBuilderModel>
return this;
</#if>
}
</#list>
</#if>
<#if entityColumnConstant>
<#list table.fields as field>
public static final String ${field.name?upper_case} = "${field.name}";
</#list>
</#if>
<#if activeRecord>
@Override
protected Serializable pkVal() {
<#if keyPropertyName??>
return this.${keyPropertyName};
<#else>
return null;
</#if>
}
</#if>
<#if !entityLombokModel>
@Override
public String toString() {
return "${entity}{" +
<#list table.fields as field>
<#if field_index==0>
"${field.propertyName}=" + ${field.propertyName} +
<#else>
", ${field.propertyName}=" + ${field.propertyName} +
</#if>
</#list>
"}";
}
</#if>
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.java.vm
package ${package.Entity};
#foreach($pkg in ${table.importPackages})
import ${pkg};
#end
#if(${swagger2})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
#end
/**
* <p>
* $!{table.comment}
* </p>
*
* @author ${author}
* @since ${date}
*/
#if(${entityLombokModel})
@Data
#if(${superEntityClass})
@EqualsAndHashCode(callSuper = true)
#else
@EqualsAndHashCode(callSuper = false)
#end
@Accessors(chain = true)
#end
#if(${table.convert})
@TableName("${table.name}")
#end
#if(${swagger2})
@ApiModel(value="${entity}对象", description="$!{table.comment}")
#end
#if(${superEntityClass})
public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
public class ${entity} extends Model<${entity}> {
#else
public class ${entity} implements Serializable {
#end
#if(${entitySerialVersionUID})
private static final long serialVersionUID=1L;
#end
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in ${table.fields})
#if(${field.keyFlag})
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${swagger2})
@ApiModelProperty(value = "${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
#if(${field.keyFlag})
## 主键
#if(${field.keyIdentityFlag})
@TableId(value = "${field.name}", type = IdType.AUTO)
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
@TableId(value = "${field.name}", type = IdType.${idType})
#elseif(${field.convert})
@TableId("${field.name}")
#end
## 普通字段
#elseif(${field.fill})
## ----- 存在字段填充设置 -----
#if(${field.convert})
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
#else
@TableField(fill = FieldFill.${field.fill})
#end
#elseif(${field.convert})
@TableField("${field.name}")
#end
## 乐观锁注解
#if(${versionFieldName}==${field.name})
@Version
#end
## 逻辑删除注解
#if(${logicDeleteFieldName}==${field.name})
@TableLogic
#end
private ${field.propertyType} ${field.propertyName};
#end
## ---------- END 字段循环遍历 ----------
#if(!${entityLombokModel})
#foreach($field in ${table.fields})
#if(${field.propertyType.equals("boolean")})
#set($getprefix="is")
#else
#set($getprefix="get")
#end
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
#if(${entityBuilderModel})
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
#else
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
#end
this.${field.propertyName} = ${field.propertyName};
#if(${entityBuilderModel})
return this;
#end
}
#end
#end
#if(${entityColumnConstant})
#foreach($field in ${table.fields})
public static final String ${field.name.toUpperCase()} = "${field.name}";
#end
#end
#if(${activeRecord})
@Override
protected Serializable pkVal() {
#if(${keyPropertyName})
return this.${keyPropertyName};
#else
return null;
#end
}
#end
#if(!${entityLombokModel})
@Override
public String toString() {
return "${entity}{" +
#foreach($field in ${table.fields})
#if($!{foreach.index}==0)
"${field.propertyName}=" + ${field.propertyName} +
#else
", ${field.propertyName}=" + ${field.propertyName} +
#end
#end
"}";
}
#end
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.kt.btl
package ${package.Entity}
<% for(pkg in table.importPackages){ %>
import ${pkg}
<% } %>
<% if(swagger2){ %>
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
<% } %>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(table.convert){ %>
@TableName("${table.name}")
<% } %>
<% if(swagger2){ %>
@ApiModel(value="${entity}对象", description="${table.comment!''}")
<% } %>
<% if(isNotEmpty(superEntityClass)){ %>
class ${entity} : ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{
<% }else if(activeRecord){ %>
class ${entity} : Model<${entity}> {
<% }else{ %>
class ${entity} : Serializable {
<% } %>
<% /** -----------BEGIN 字段循环遍历----------- **/ %>
<% for(field in table.fields){ %>
<%
if(field.keyFlag){
var keyPropertyName = field.propertyName;
}
%>
<% if(isNotEmpty(field.comment)){ %>
<% if(swagger2){ %>
@ApiModelProperty(value = "${field.comment}")
<% }else{ %>
/**
* ${field.comment}
*/
<% } %>
<% } %>
<% if(field.keyFlag){ %>
<%
/*主键*/
%>
<% if(field.keyIdentityFlag){ %>
@TableId(value = "${field.name}", type = IdType.AUTO)
<% }else if(isNotEmpty(idType)){ %>
@TableId(value = "${field.name}", type = IdType.${idType})
<% }else if(field.convert){ %>
@TableId("${field.name}")
<% } %>
<%
/*普通字段*/
%>
<% }else if(isNotEmpty(field.fill)){ %>
<% if(field.convert){ %>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<% }else{ %>
@TableField(fill = FieldFill.${field.fill})
<% } %>
<% }else if(field.convert){ %>
@TableField("${field.name}")
<% } %>
<%
/*乐观锁注解*/
%>
<% if(versionFieldName!'' == field.name){ %>
@Version
<% } %>
<%
/*逻辑删除注解*/
%>
<% if(logicDeleteFieldName!'' == field.name){ %>
@TableLogic
<% } %>
<% if(field.propertyType == 'Integer'){ %>
var ${field.propertyName}: Int ? = null
<% }else{ %>
var ${field.propertyName}: ${field.propertyType} ? = null
<% } %>
<% } %>
<% /** -----------END 字段循环遍历----------- **/ %>
<% if(entityColumnConstant){ %>
companion object {
<% for(field in table.fields){ %>
const val ${strutil.toUpperCase(field.name)} : String = "${field.name}"
<% } %>
}
<% } %>
<% if(activeRecord){ %>
@Override
override fun pkVal(): Serializable? {
<% if(isNotEmpty(keyPropertyName)){ %>
return this.${keyPropertyName}
<% }else{ %>
return null;
<% } %>
}
<% } %>
<% if(!entityLombokModel){ %>
@Override
override fun toString(): String {
return "${entity}{" +
<% for(field in table.fields){ %>
<% if(fieldLP.index==0){ %>
"${field.propertyName}=" + ${field.propertyName} +
<% }else{ %>
", ${field.propertyName}=" + ${field.propertyName} +
<% } %>
<% } %>
"}"
}
<% } %>
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.kt.ftl
package ${package.Entity}
<#list table.importPackages as pkg>
import ${pkg}
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
/**
* <p>
* ${table.comment}
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if table.convert>
@TableName("${table.name}")
</#if>
<#if swagger2>
@ApiModel(value="${entity}对象", description="${table.comment!}")
</#if>
<#if superEntityClass??>
class ${entity} : ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
class ${entity} : Model<${entity}>() {
<#else>
class ${entity} : Serializable {
</#if>
<#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
<#if swagger2>
@ApiModelProperty(value = "${field.comment}")
<#else>
/**
* ${field.comment}
*/
</#if>
</#if>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.name}", type = IdType.AUTO)
<#elseif idType ??>
@TableId(value = "${field.name}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.name}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.name}")
</#if>
<#-- 乐观锁注解 -->
<#if (versionFieldName!"") == field.name>
@Version
</#if>
<#-- 逻辑删除注解 -->
<#if (logicDeleteFieldName!"") == field.name>
@TableLogic
</#if>
<#if field.propertyType == "Integer">
var ${field.propertyName}: Int? = null
<#else>
var ${field.propertyName}: ${field.propertyType}? = null
</#if>
</#list>
<#-- ---------- END 字段循环遍历 ---------->
<#if entityColumnConstant>
companion object {
<#list table.fields as field>
const val ${field.name.toUpperCase()} : String = "${field.name}"
</#list>
}
</#if>
<#if activeRecord>
override fun pkVal(): Serializable? {
<#if keyPropertyName??>
return ${keyPropertyName}
<#else>
return null
</#if>
}
</#if>
override fun toString(): String {
return "${entity}{" +
<#list table.fields as field>
<#if field_index==0>
"${field.propertyName}=" + ${field.propertyName} +
<#else>
", ${field.propertyName}=" + ${field.propertyName} +
</#if>
</#list>
"}"
}
}
文件:xuecheng-plus-generator/resources/templates/templates/default/entity.kt.vm
package ${package.Entity};
#foreach($pkg in ${table.importPackages})
import ${pkg};
#end
#if(${swagger2})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
/**
* <p>
* $!{table.comment}
* </p>
*
* @author ${author}
* @since ${date}
*/
#if(${table.convert})
@TableName("${table.name}")
#end
#if(${swagger2})
@ApiModel(value="${entity}对象", description="$!{table.comment}")
#end
#if(${superEntityClass})
class ${entity} : ${superEntityClass}#if(${activeRecord})<${entity}>#end() {
#elseif(${activeRecord})
class ${entity} : Model<${entity}>() {
#else
class ${entity} : Serializable {
#end
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in ${table.fields})
#if(${field.keyFlag})
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${swagger2})
@ApiModelProperty(value = "${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
#if(${field.keyFlag})
## 主键
#if(${field.keyIdentityFlag})
@TableId(value = "${field.name}", type = IdType.AUTO)
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
@TableId(value = "${field.name}", type = IdType.${idType})
#elseif(${field.convert})
@TableId("${field.name}")
#end
## 普通字段
#elseif(${field.fill})
## ----- 存在字段填充设置 -----
#if(${field.convert})
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
#else
@TableField(fill = FieldFill.${field.fill})
#end
#elseif(${field.convert})
@TableField("${field.name}")
#end
## 乐观锁注解
#if(${versionFieldName}==${field.name})
@Version
#end
## 逻辑删除注解
#if(${logicDeleteFieldName}==${field.name})
@TableLogic
#end
#if(${field.propertyType} == "Integer")
var ${field.propertyName}: Int? = null
#else
var ${field.propertyName}: ${field.propertyType}? = null
#end
#end
## ---------- END 字段循环遍历 ----------
#if(${entityColumnConstant})
companion object {
#foreach($field in ${table.fields})
const val ${field.name.toUpperCase()} : String = "${field.name}"
#end
}
#end
#if(${activeRecord})
override fun pkVal(): Serializable? {
#if(${keyPropertyName})
return ${keyPropertyName}
#else
return null
#end
}
#end
override fun toString(): String {
return "${entity}{" +
#foreach($field in ${table.fields})
#if($!{foreach.index}==0)
"${field.propertyName}=" + ${field.propertyName} +
#else
", ${field.propertyName}=" + ${field.propertyName} +
#end
#end
"}"
}
}
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.java.btl
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
* @since ${date}
*/
<% if(kotlin){ %>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<% }else{ %>
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
<% } %>
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.java.ftl
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
*/
<#if kotlin>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<#else>
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
</#if>
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.java.vm
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
/**
* <p>
* $!{table.comment} Mapper 接口
* </p>
*
* @author ${author}
* @since ${date}
*/
#if(${kotlin})
interface ${table.mapperName} : ${superMapperClass}<${entity}>
#else
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
#end
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.xml.btl
<?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="${package.Mapper}.${table.mapperName}">
<% if(enableCache){ %>
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
<% } %>
<% if(baseResultMap){ %>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
<% for(field in table.fields){ %>
<% /** 生成主键排在第一位 **/ %>
<% if(field.keyFlag){ %>
<id column="${field.name}" property="${field.propertyName}" />
<% } %>
<% } %>
<% for(field in table.commonFields){ %>
<% /** 生成公共字段 **/ %>
<result column="${field.name}" property="${field.propertyName}" />
<% } %>
<% for(field in table.fields){ %>
<% /** 生成普通字段 **/ %>
<% if(!field.keyFlag){ %>
<result column="${field.name}" property="${field.propertyName}" />
<% } %>
<% } %>
</resultMap>
<% } %>
<% if(baseColumnList){ %>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
<% for(field in table.commonFields){ %>
${field.name},
<% } %>
${table.fieldNames}
</sql>
<% } %>
</mapper>
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.xml.ftl
<?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="${package.Mapper}.${table.mapperName}">
<#if enableCache>
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
</#if>
<#if baseResultMap>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
<#list table.fields as field>
<#if field.keyFlag><#--生成主键排在第一位-->
<id column="${field.name}" property="${field.propertyName}" />
</#if>
</#list>
<#list table.commonFields as field><#--生成公共字段 -->
<result column="${field.name}" property="${field.propertyName}" />
</#list>
<#list table.fields as field>
<#if !field.keyFlag><#--生成普通字段 -->
<result column="${field.name}" property="${field.propertyName}" />
</#if>
</#list>
</resultMap>
</#if>
<#if baseColumnList>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
<#list table.commonFields as field>
${field.name},
</#list>
${table.fieldNames}
</sql>
</#if>
</mapper>
文件:xuecheng-plus-generator/resources/templates/templates/default/mapper.xml.vm
<?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="${package.Mapper}.${table.mapperName}">
#if(${enableCache})
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
#end
#if(${baseResultMap})
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
#foreach($field in ${table.fields})
#if(${field.keyFlag})##生成主键排在第一位
<id column="${field.name}" property="${field.propertyName}" />
#end
#end
#foreach($field in ${table.commonFields})##生成公共字段
<result column="${field.name}" property="${field.propertyName}" />
#end
#foreach($field in ${table.fields})
#if(!${field.keyFlag})##生成普通字段
<result column="${field.name}" property="${field.propertyName}" />
#end
#end
</resultMap>
#end
#if(${baseColumnList})
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
#foreach($field in ${table.commonFields})
${field.name},
#end
${table.fieldNames}
</sql>
#end
</mapper>
文件:xuecheng-plus-generator/resources/templates/templates/default/service.java.btl
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/**
* <p>
* ${table.comment!} 服务类
* </p>
*
* @author ${author}
*/
<% if(kotlin){ %>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<% }else{ %>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
<% } %>
文件:xuecheng-plus-generator/resources/templates/templates/default/service.java.ftl
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/**
* <p>
* ${table.comment!} 服务类
* </p>
*
* @author ${author}
*/
<#if kotlin>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<#else>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
</#if>
文件:xuecheng-plus-generator/resources/templates/templates/default/service.java.vm
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
/**
* <p>
* $!{table.comment} 服务类
* </p>
*
* @author ${author}
*/
#if(${kotlin})
interface ${table.serviceName} : ${superServiceClass}<${entity}>
#else
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
#end
文件:xuecheng-plus-generator/resources/templates/templates/default/serviceImpl.btl
package ${entity.serviceImplPackage};
import ${entity.daoPackage}.${entity.className}Dao;
import ${entity.entityPackage}.${entity.className};
import ${entity.servicePackage}.${entity.className}Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* ${entity.description}接口实现
* @author ${entity.author}
*/
@Slf4j
@Service
@Transactional
public class ${entity.className}ServiceImpl implements ${entity.className}Service {
@Autowired
private ${entity.className}Dao ${entity.classNameLowerCase}Dao;
@Override
public ${entity.className}Dao getRepository() {
return ${entity.classNameLowerCase}Dao;
}
}
文件:xuecheng-plus-generator/resources/templates/templates/default/serviceImpl.java.btl
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<% if(kotlin){ %>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<% }else{ %>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
<% } %>
文件:xuecheng-plus-generator/resources/templates/templates/default/serviceImpl.java.ftl
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
*/
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
</#if>
文件:xuecheng-plus-generator/resources/templates/templates/default/serviceImpl.java.vm
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
/**
* <p>
* $!{table.comment} 服务实现类
* </p>
*
* @author ${author}
* @since ${date}
*/
@Service
#if(${kotlin})
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
#else
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
}
#end
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CourseBaseController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseBaseService; // 导入 CourseBaseService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseBase") // 使用注解 @RequestMapping("courseBase")
public class CourseBaseController { // 定义 class CourseBaseController
@Autowired // 使用注解 @Autowired
private CourseBaseService courseBaseService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CourseCategoryController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseCategoryService; // 导入 CourseCategoryService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseCategory") // 使用注解 @RequestMapping("courseCategory")
public class CourseCategoryController { // 定义 class CourseCategoryController
@Autowired // 使用注解 @Autowired
private CourseCategoryService courseCategoryService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CourseMarketController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseMarketService; // 导入 CourseMarketService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseMarket") // 使用注解 @RequestMapping("courseMarket")
public class CourseMarketController { // 定义 class CourseMarketController
@Autowired // 使用注解 @Autowired
private CourseMarketService courseMarketService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CoursePublishController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CoursePublishService; // 导入 CoursePublishService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("coursePublish") // 使用注解 @RequestMapping("coursePublish")
public class CoursePublishController { // 定义 class CoursePublishController
@Autowired // 使用注解 @Autowired
private CoursePublishService coursePublishService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CoursePublishPreController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CoursePublishPreService; // 导入 CoursePublishPreService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("coursePublishPre") // 使用注解 @RequestMapping("coursePublishPre")
public class CoursePublishPreController { // 定义 class CoursePublishPreController
@Autowired // 使用注解 @Autowired
private CoursePublishPreService coursePublishPreService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/CourseTeacherController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.CourseTeacherService; // 导入 CourseTeacherService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("courseTeacher") // 使用注解 @RequestMapping("courseTeacher")
public class CourseTeacherController { // 定义 class CourseTeacherController
@Autowired // 使用注解 @Autowired
private CourseTeacherService courseTeacherService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/TeachplanController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.TeachplanService; // 导入 TeachplanService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("teachplan") // 使用注解 @RequestMapping("teachplan")
public class TeachplanController { // 定义 class TeachplanController
@Autowired // 使用注解 @Autowired
private TeachplanService teachplanService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/controller/TeachplanMediaController.java
package com.xuecheng.content.controller; // 声明类所在的包路径
import org.springframework.web.bind.annotation.RequestMapping; // 导入 RequestMapping 类
import org.springframework.web.bind.annotation.RestController; // 导入 RestController 类
import com.xuecheng.content.service.TeachplanMediaService; // 导入 TeachplanMediaService 类
import io.swagger.annotations.Api; // 导入 Api 类
import io.swagger.annotations.ApiOperation; // 导入 ApiOperation 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 前端控制器 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@RestController // 使用注解 @RestController
@RequestMapping("teachplanMedia") // 使用注解 @RequestMapping("teachplanMedia")
public class TeachplanMediaController { // 定义 class TeachplanMediaController
@Autowired // 使用注解 @Autowired
private TeachplanMediaService teachplanMediaService; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseBaseMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseBaseMapper extends BaseMapper<CourseBase> { // 定义 interface CourseBaseMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseBaseMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseBaseMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseBase"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="change_date" property="changeDate" /> <!-- 字段与属性的映射规则 -->
<result column="create_people" property="createPeople" /> <!-- 字段与属性的映射规则 -->
<result column="change_people" property="changePeople" /> <!-- 字段与属性的映射规则 -->
<result column="audit_status" property="auditStatus" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, mt, st, grade, teachmode, description, pic, create_date, change_date, create_people, change_people, audit_status, status <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseCategoryMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseCategoryMapper extends BaseMapper<CourseCategory> { // 定义 interface CourseCategoryMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseCategoryMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseCategoryMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseCategory"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="label" property="label" /> <!-- 字段与属性的映射规则 -->
<result column="parentid" property="parentid" /> <!-- 字段与属性的映射规则 -->
<result column="is_show" property="isShow" /> <!-- 字段与属性的映射规则 -->
<result column="orderby" property="orderby" /> <!-- 字段与属性的映射规则 -->
<result column="is_leaf" property="isLeaf" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, name, label, parentid, is_show, orderby, is_leaf <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseMarketMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseMarketMapper extends BaseMapper<CourseMarket> { // 定义 interface CourseMarketMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseMarketMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseMarketMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseMarket"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="qq" property="qq" /> <!-- 字段与属性的映射规则 -->
<result column="wechat" property="wechat" /> <!-- 字段与属性的映射规则 -->
<result column="phone" property="phone" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, charge, price, original_price, qq, wechat, phone, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CoursePublishMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishMapper extends BaseMapper<CoursePublish> { // 定义 interface CoursePublishMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CoursePublishMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CoursePublishMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CoursePublish"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="username" property="username" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="mt_name" property="mtName" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="st_name" property="stName" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="market" property="market" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan" property="teachplan" /> <!-- 字段与属性的映射规则 -->
<result column="teachers" property="teachers" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="online_date" property="onlineDate" /> <!-- 字段与属性的映射规则 -->
<result column="offline_date" property="offlineDate" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="remark" property="remark" /> <!-- 字段与属性的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, username, mt, mt_name, st, st_name, grade, teachmode, pic, description, market, teachplan, teachers, create_date, online_date, offline_date, status, remark, charge, price, original_price, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CoursePublishPreMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishPreMapper extends BaseMapper<CoursePublishPre> { // 定义 interface CoursePublishPreMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CoursePublishPreMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CoursePublishPreMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CoursePublishPre"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="company_id" property="companyId" /> <!-- 字段与属性的映射规则 -->
<result column="company_name" property="companyName" /> <!-- 字段与属性的映射规则 -->
<result column="name" property="name" /> <!-- 字段与属性的映射规则 -->
<result column="users" property="users" /> <!-- 字段与属性的映射规则 -->
<result column="tags" property="tags" /> <!-- 字段与属性的映射规则 -->
<result column="username" property="username" /> <!-- 字段与属性的映射规则 -->
<result column="mt" property="mt" /> <!-- 字段与属性的映射规则 -->
<result column="mt_name" property="mtName" /> <!-- 字段与属性的映射规则 -->
<result column="st" property="st" /> <!-- 字段与属性的映射规则 -->
<result column="st_name" property="stName" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="teachmode" property="teachmode" /> <!-- 字段与属性的映射规则 -->
<result column="pic" property="pic" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="market" property="market" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan" property="teachplan" /> <!-- 字段与属性的映射规则 -->
<result column="teachers" property="teachers" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="audit_date" property="auditDate" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="remark" property="remark" /> <!-- 字段与属性的映射规则 -->
<result column="charge" property="charge" /> <!-- 字段与属性的映射规则 -->
<result column="price" property="price" /> <!-- 字段与属性的映射规则 -->
<result column="original_price" property="originalPrice" /> <!-- 字段与属性的映射规则 -->
<result column="valid_days" property="validDays" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, company_id, company_name, name, users, tags, username, mt, mt_name, st, st_name, grade, teachmode, pic, description, market, teachplan, teachers, create_date, audit_date, status, remark, charge, price, original_price, valid_days <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseTeacherMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseTeacherMapper extends BaseMapper<CourseTeacher> { // 定义 interface CourseTeacherMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/CourseTeacherMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.CourseTeacherMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.CourseTeacher"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="teacher_name" property="teacherName" /> <!-- 字段与属性的映射规则 -->
<result column="position" property="position" /> <!-- 字段与属性的映射规则 -->
<result column="introduction" property="introduction" /> <!-- 字段与属性的映射规则 -->
<result column="photograph" property="photograph" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, course_id, teacher_name, position, introduction, photograph, create_date <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/TeachplanMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMapper extends BaseMapper<Teachplan> { // 定义 interface TeachplanMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/TeachplanMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.TeachplanMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.Teachplan"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="pname" property="pname" /> <!-- 字段与属性的映射规则 -->
<result column="parentid" property="parentid" /> <!-- 字段与属性的映射规则 -->
<result column="grade" property="grade" /> <!-- 字段与属性的映射规则 -->
<result column="media_type" property="mediaType" /> <!-- 字段与属性的映射规则 -->
<result column="start_time" property="startTime" /> <!-- 字段与属性的映射规则 -->
<result column="end_time" property="endTime" /> <!-- 字段与属性的映射规则 -->
<result column="description" property="description" /> <!-- 字段与属性的映射规则 -->
<result column="timelength" property="timelength" /> <!-- 字段与属性的映射规则 -->
<result column="orderby" property="orderby" /> <!-- 字段与属性的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="course_pub_id" property="coursePubId" /> <!-- 字段与属性的映射规则 -->
<result column="status" property="status" /> <!-- 字段与属性的映射规则 -->
<result column="is_preview" property="isPreview" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="change_date" property="changeDate" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, pname, parentid, grade, media_type, start_time, end_time, description, timelength, orderby, course_id, course_pub_id, status, is_preview, create_date, change_date <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/TeachplanMediaMapper.java
package com.xuecheng.content.mapper; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.baomidou.mybatisplus.core.mapper.BaseMapper; // 导入 BaseMapper 类
import org.springframework.stereotype.Repository; // 导入 Repository 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* Mapper 接口 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMediaMapper extends BaseMapper<TeachplanMedia> { // 定义 interface TeachplanMediaMapper
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/mapper/TeachplanMediaMapper.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- XML 声明 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- SQL 语句片段 -->
<mapper namespace="com.xuecheng.content.mapper.TeachplanMediaMapper"> <!-- MyBatis 映射文件的根标签 -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xuecheng.content.model.po.TeachplanMedia"> <!-- 定义结果映射 -->
<id column="id" property="id" /> <!-- 主键列的映射规则 -->
<result column="media_id" property="mediaId" /> <!-- 字段与属性的映射规则 -->
<result column="teachplan_id" property="teachplanId" /> <!-- 字段与属性的映射规则 -->
<result column="course_id" property="courseId" /> <!-- 字段与属性的映射规则 -->
<result column="media_fileName" property="mediaFilename" /> <!-- 字段与属性的映射规则 -->
<result column="create_date" property="createDate" /> <!-- 字段与属性的映射规则 -->
<result column="create_people" property="createPeople" /> <!-- 字段与属性的映射规则 -->
<result column="change_people" property="changePeople" /> <!-- 字段与属性的映射规则 -->
</resultMap> <!-- 结束 resultMap 区块 -->
<!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <!-- 声明可复用的 SQL 片段 -->
id, media_id, teachplan_id, course_id, media_fileName, create_date, create_people, change_people <!-- SQL 语句片段 -->
</sql> <!-- 结束 SQL 片段 -->
</mapper> <!-- 结束 mapper 标签 -->
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CourseBase.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_base") // 使用注解 @TableName("course_base")
public class CourseBase implements Serializable { // 定义 class CourseBase
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 机构名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 课程标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式(common普通,record 录播,live直播等) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 修改时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT_UPDATE) // 使用注解 @TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime changeDate; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String createPeople; // 执行语句
/** // 保留原作者写的块注释
* 更新人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String changePeople; // 执行语句
/** // 保留原作者写的块注释
* 审核状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String auditStatus; // 执行语句
/** // 保留原作者写的块注释
* 课程发布状态 未发布 已发布 下线 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CourseCategory.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_category") // 使用注解 @TableName("course_category")
public class CourseCategory implements Serializable { // 定义 class CourseCategory
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String id; // 执行语句
/** // 保留原作者写的块注释
* 分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 分类标签默认和名称一样 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String label; // 执行语句
/** // 保留原作者写的块注释
* 父结点id(第一级的父节点是0,自关联字段id) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String parentid; // 执行语句
/** // 保留原作者写的块注释
* 是否显示 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer isShow; // 执行语句
/** // 保留原作者写的块注释
* 排序字段 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer orderby; // 执行语句
/** // 保留原作者写的块注释
* 是否叶子 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer isLeaf; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CourseMarket.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_market") // 使用注解 @TableName("course_market")
public class CourseMarket implements Serializable { // 定义 class CourseMarket
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键,课程id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 咨询qq // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String qq; // 执行语句
/** // 保留原作者写的块注释
* 微信 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String wechat; // 执行语句
/** // 保留原作者写的块注释
* 电话 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String phone; // 执行语句
/** // 保留原作者写的块注释
* 有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CoursePublish.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_publish") // 使用注解 @TableName("course_publish")
public class CoursePublish implements Serializable { // 定义 class CoursePublish
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 公司名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String username; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 大分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mtName; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 小分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String stName; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程营销信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String market; // 执行语句
/** // 保留原作者写的块注释
* 所有课程计划,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachplan; // 执行语句
/** // 保留原作者写的块注释
* 教师信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachers; // 执行语句
/** // 保留原作者写的块注释
* 发布时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 上架时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime onlineDate; // 执行语句
/** // 保留原作者写的块注释
* 下架时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime offlineDate; // 执行语句
/** // 保留原作者写的块注释
* 发布状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
/** // 保留原作者写的块注释
* 备注 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String remark; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典--203 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 课程有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CoursePublishPre.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_publish_pre") // 使用注解 @TableName("course_publish_pre")
public class CoursePublishPre implements Serializable { // 定义 class CoursePublishPre
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 机构ID // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long companyId; // 执行语句
/** // 保留原作者写的块注释
* 公司名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String companyName; // 执行语句
/** // 保留原作者写的块注释
* 课程名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String name; // 执行语句
/** // 保留原作者写的块注释
* 适用人群 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String users; // 执行语句
/** // 保留原作者写的块注释
* 标签 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String tags; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String username; // 执行语句
/** // 保留原作者写的块注释
* 大分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mt; // 执行语句
/** // 保留原作者写的块注释
* 大分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mtName; // 执行语句
/** // 保留原作者写的块注释
* 小分类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String st; // 执行语句
/** // 保留原作者写的块注释
* 小分类名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String stName; // 执行语句
/** // 保留原作者写的块注释
* 课程等级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String grade; // 执行语句
/** // 保留原作者写的块注释
* 教育模式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachmode; // 执行语句
/** // 保留原作者写的块注释
* 课程图片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pic; // 执行语句
/** // 保留原作者写的块注释
* 课程介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 课程营销信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String market; // 执行语句
/** // 保留原作者写的块注释
* 所有课程计划,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachplan; // 执行语句
/** // 保留原作者写的块注释
* 教师信息,json格式 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teachers; // 执行语句
/** // 保留原作者写的块注释
* 提交时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 审核时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime auditDate; // 执行语句
/** // 保留原作者写的块注释
* 状态 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String status; // 执行语句
/** // 保留原作者写的块注释
* 备注 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String remark; // 执行语句
/** // 保留原作者写的块注释
* 收费规则,对应数据字典--203 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String charge; // 执行语句
/** // 保留原作者写的块注释
* 现价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float price; // 执行语句
/** // 保留原作者写的块注释
* 原价 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Float originalPrice; // 执行语句
/** // 保留原作者写的块注释
* 课程有效期天数 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer validDays; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/CourseTeacher.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("course_teacher") // 使用注解 @TableName("course_teacher")
public class CourseTeacher implements Serializable { // 定义 class CourseTeacher
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 教师标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String teacherName; // 执行语句
/** // 保留原作者写的块注释
* 教师职位 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String position; // 执行语句
/** // 保留原作者写的块注释
* 教师简介 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String introduction; // 执行语句
/** // 保留原作者写的块注释
* 照片 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String photograph; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/Teachplan.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("teachplan") // 使用注解 @TableName("teachplan")
public class Teachplan implements Serializable { // 定义 class Teachplan
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 课程计划名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String pname; // 执行语句
/** // 保留原作者写的块注释
* 课程计划父级Id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long parentid; // 执行语句
/** // 保留原作者写的块注释
* 层级,分为1、2、3级 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer grade; // 执行语句
/** // 保留原作者写的块注释
* 课程类型:1视频、2文档 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mediaType; // 执行语句
/** // 保留原作者写的块注释
* 开始直播时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime startTime; // 执行语句
/** // 保留原作者写的块注释
* 直播结束时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private LocalDateTime endTime; // 执行语句
/** // 保留原作者写的块注释
* 章节及课程时介绍 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String description; // 执行语句
/** // 保留原作者写的块注释
* 时长,单位时:分:秒 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String timelength; // 执行语句
/** // 保留原作者写的块注释
* 排序字段 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer orderby; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 课程发布标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long coursePubId; // 执行语句
/** // 保留原作者写的块注释
* 状态(1正常 0删除) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Integer status; // 执行语句
/** // 保留原作者写的块注释
* 是否支持试学或预览(试看) // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String isPreview; // 执行语句
/** // 保留原作者写的块注释
* 创建时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 修改时间 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField(fill = FieldFill.INSERT_UPDATE) // 使用注解 @TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime changeDate; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/model/po/TeachplanMedia.java
package com.xuecheng.content.model.po; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.IdType; // 导入 IdType 类
import com.baomidou.mybatisplus.annotation.TableId; // 导入 TableId 类
import java.time.LocalDateTime; // 导入 LocalDateTime 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.annotation.TableField; // 导入 TableField 类
import java.io.Serializable; // 导入 Serializable 类
import lombok.Data; // 导入 Data 类
import com.baomidou.mybatisplus.annotation.TableName; // 导入 TableName 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Data // 使用注解 @Data
@TableName("teachplan_media") // 使用注解 @TableName("teachplan_media")
public class TeachplanMedia implements Serializable { // 定义 class TeachplanMedia
private static final long serialVersionUID = 1L; // 把 1L 赋值给 serialVersionUID
/** // 保留原作者写的块注释
* 主键 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableId(value = "id", type = IdType.AUTO) // 使用注解 @TableId(value = "id", type = IdType.AUTO)
private Long id; // 执行语句
/** // 保留原作者写的块注释
* 媒资文件id // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String mediaId; // 执行语句
/** // 保留原作者写的块注释
* 课程计划标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long teachplanId; // 执行语句
/** // 保留原作者写的块注释
* 课程标识 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private Long courseId; // 执行语句
/** // 保留原作者写的块注释
* 媒资文件原始名称 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@TableField("media_fileName") // 使用注解 @TableField("media_fileName")
private String mediaFilename; // 执行语句
@TableField(fill = FieldFill.INSERT) // 使用注解 @TableField(fill = FieldFill.INSERT)
private LocalDateTime createDate; // 执行语句
/** // 保留原作者写的块注释
* 创建人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String createPeople; // 执行语句
/** // 保留原作者写的块注释
* 修改人 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
private String changePeople; // 执行语句
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CourseBaseService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseBaseService extends IService<CourseBase> { // 定义 interface CourseBaseService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CourseCategoryService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseCategoryService extends IService<CourseCategory> { // 定义 interface CourseCategoryService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CourseMarketService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseMarketService extends IService<CourseMarket> { // 定义 interface CourseMarketService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CoursePublishPreService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishPreService extends IService<CoursePublishPre> { // 定义 interface CoursePublishPreService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CoursePublishService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CoursePublishService extends IService<CoursePublish> { // 定义 interface CoursePublishService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/CourseTeacherService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface CourseTeacherService extends IService<CourseTeacher> { // 定义 interface CourseTeacherService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CourseBaseServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseBase; // 导入 CourseBase 类
import com.xuecheng.content.mapper.CourseBaseMapper; // 导入 CourseBaseMapper 类
import com.xuecheng.content.service.CourseBaseService; // 导入 CourseBaseService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程基本信息 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseBaseServiceImpl extends ServiceImpl<CourseBaseMapper, CourseBase> implements CourseBaseService { // 定义 class CourseBaseServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CourseCategoryServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseCategory; // 导入 CourseCategory 类
import com.xuecheng.content.mapper.CourseCategoryMapper; // 导入 CourseCategoryMapper 类
import com.xuecheng.content.service.CourseCategoryService; // 导入 CourseCategoryService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程分类 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseCategoryServiceImpl extends ServiceImpl<CourseCategoryMapper, CourseCategory> implements CourseCategoryService { // 定义 class CourseCategoryServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CourseMarketServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseMarket; // 导入 CourseMarket 类
import com.xuecheng.content.mapper.CourseMarketMapper; // 导入 CourseMarketMapper 类
import com.xuecheng.content.service.CourseMarketService; // 导入 CourseMarketService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程营销信息 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseMarketServiceImpl extends ServiceImpl<CourseMarketMapper, CourseMarket> implements CourseMarketService { // 定义 class CourseMarketServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CoursePublishPreServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublishPre; // 导入 CoursePublishPre 类
import com.xuecheng.content.mapper.CoursePublishPreMapper; // 导入 CoursePublishPreMapper 类
import com.xuecheng.content.service.CoursePublishPreService; // 导入 CoursePublishPreService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CoursePublishPreServiceImpl extends ServiceImpl<CoursePublishPreMapper, CoursePublishPre> implements CoursePublishPreService { // 定义 class CoursePublishPreServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CoursePublishServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CoursePublish; // 导入 CoursePublish 类
import com.xuecheng.content.mapper.CoursePublishMapper; // 导入 CoursePublishMapper 类
import com.xuecheng.content.service.CoursePublishService; // 导入 CoursePublishService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程发布 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CoursePublishServiceImpl extends ServiceImpl<CoursePublishMapper, CoursePublish> implements CoursePublishService { // 定义 class CoursePublishServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/CourseTeacherServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.CourseTeacher; // 导入 CourseTeacher 类
import com.xuecheng.content.mapper.CourseTeacherMapper; // 导入 CourseTeacherMapper 类
import com.xuecheng.content.service.CourseTeacherService; // 导入 CourseTeacherService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程-教师关系表 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class CourseTeacherServiceImpl extends ServiceImpl<CourseTeacherMapper, CourseTeacher> implements CourseTeacherService { // 定义 class CourseTeacherServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/TeachplanMediaServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.xuecheng.content.mapper.TeachplanMediaMapper; // 导入 TeachplanMediaMapper 类
import com.xuecheng.content.service.TeachplanMediaService; // 导入 TeachplanMediaService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class TeachplanMediaServiceImpl extends ServiceImpl<TeachplanMediaMapper, TeachplanMedia> implements TeachplanMediaService { // 定义 class TeachplanMediaServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/impl/TeachplanServiceImpl.java
package com.xuecheng.content.service.impl; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.xuecheng.content.mapper.TeachplanMapper; // 导入 TeachplanMapper 类
import com.xuecheng.content.service.TeachplanService; // 导入 TeachplanService 类
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 导入 ServiceImpl 类
import lombok.extern.slf4j.Slf4j; // 导入 Slf4j 类
import org.springframework.stereotype.Service; // 导入 Service 类
import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 类
import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 服务实现类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
*/ // 保留原作者写的块注释
@Slf4j // 使用注解 @Slf4j
@Service // 使用注解 @Service
public class TeachplanServiceImpl extends ServiceImpl<TeachplanMapper, Teachplan> implements TeachplanService { // 定义 class TeachplanServiceImpl
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/TeachplanMediaService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.TeachplanMedia; // 导入 TeachplanMedia 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanMediaService extends IService<TeachplanMedia> { // 定义 interface TeachplanMediaService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/content/service/TeachplanService.java
package com.xuecheng.content.service; // 声明类所在的包路径
import com.xuecheng.content.model.po.Teachplan; // 导入 Teachplan 类
import com.baomidou.mybatisplus.extension.service.IService; // 导入 IService 类
/** // 保留原作者写的块注释
* <p> // 保留原作者写的块注释
* 课程计划 服务类 // 保留原作者写的块注释
* </p> // 保留原作者写的块注释
* // 保留原作者写的块注释
* @author itcast // 保留原作者写的块注释
* @since 2023-02-11 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public interface TeachplanService extends IService<Teachplan> { // 定义 interface TeachplanService
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/BankCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class BankCodeGenerator { // 定义 class BankCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "bank1"; // 把 "bank1" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "root"; // 把 "root" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"account_info", // 代码逻辑
"de_duplication", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://localhost:3306/" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setParent("com.xuecheng.rocketmq"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/CommonCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class CommonCodeGenerator { // 定义 class CommonCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "comments"; // 把 "comments" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "root"; // 把 "root" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"comment", // 代码逻辑
"comment_reply", // 代码逻辑
"comment_target", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = true; // 把 true 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://localhost:3306/" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/ContentCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class ContentCodeGenerator { // 定义 class ContentCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "content"; // 把 "content" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
// "mq_message", // 保留原作者写的行内注释
// "mq_message_history" // 保留原作者写的行内注释
"course_base", // 代码逻辑
"course_market", // 代码逻辑
"course_teacher", // 代码逻辑
"course_category", // 代码逻辑
"teachplan", // 代码逻辑
"teachplan_media", // 代码逻辑
"course_publish", // 代码逻辑
"course_publish_pre" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xc402_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/LearningCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class LearningCodeGenerator { // 定义 class LearningCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "learning"; // 把 "learning" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"xc_learn_record" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/MediaCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class MediaCodeGenerator { // 定义 class MediaCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "media"; // 把 "media" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"media_files", // 代码逻辑
"media_process", // 代码逻辑
"media_process_history", // 代码逻辑
"mq_message", // 代码逻辑
"mq_message_history" // 代码逻辑
// "live_course", // 保留原作者写的行内注释
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_media" // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
//此项是将生成的po类名中去掉pc.getModuleName() + "_" // 保留原作者写的行内注释
// strategy.setTablePrefix(pc.getModuleName() + "_"); // 保留原作者写的行内注释
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/MessageCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class MessageCodeGenerator { // 定义 class MessageCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "messagesdk"; // 把 "messagesdk" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"mq_message", // 代码逻辑
"mq_message_history" // 代码逻辑
// "course_base", // 保留原作者写的行内注释
// "course_market", // 保留原作者写的行内注释
// "teachplan", // 保留原作者写的行内注释
// "teachplan_media", // 保留原作者写的行内注释
// "course_teacher", // 保留原作者写的行内注释
// "course_pub", // 保留原作者写的行内注释
// "course_pub_pre" // 保留原作者写的行内注释
// "course_category" // 保留原作者写的行内注释
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_content" // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/OrderCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class OrderCodeGenerator { // 定义 class OrderCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "orders"; // 把 "orders" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
// "mq_message", // 保留原作者写的行内注释
// "mq_message_history", // 保留原作者写的行内注释
"xc_orders", // 代码逻辑
"xc_orders_goods", // 代码逻辑
"xc_pay_record" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/SystemCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class SystemCodeGenerator { // 定义 class SystemCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "system"; // 把 "system" 赋值给 SERVICE_NAME
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"course_category", // 代码逻辑
"dictionary", // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_" + SERVICE_NAME // 代码逻辑
+ "?useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 true&useSSL=false&characterEncoding=utf8") 赋值给 "?useUnicode
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
文件:xuecheng-plus-generator/src/main/java/com/xuecheng/generator/UcenterCodeGenerator.java
package com.xuecheng.generator; // 声明类所在的包路径
import com.baomidou.mybatisplus.annotation.DbType; // 导入 DbType 类
import com.baomidou.mybatisplus.annotation.FieldFill; // 导入 FieldFill 类
import com.baomidou.mybatisplus.generator.AutoGenerator; // 导入 AutoGenerator 类
import com.baomidou.mybatisplus.generator.config.*; // 导入 * 类
import com.baomidou.mybatisplus.generator.config.po.TableFill; // 导入 TableFill 类
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // 导入 NamingStrategy 类
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; // 导入 FreemarkerTemplateEngine 类
import java.util.Arrays; // 导入 Arrays 类
/** // 保留原作者写的块注释
* MyBatis-Plus 代码生成类 // 保留原作者写的块注释
*/ // 保留原作者写的块注释
public class UcenterCodeGenerator { // 定义 class UcenterCodeGenerator
// TODO 修改服务名以及数据表名 // 保留原作者写的行内注释
private static final String SERVICE_NAME = "ucenter"; // 把 "ucenter" 赋值给 SERVICE_NAME
//数据库账号 // 保留原作者写的行内注释
private static final String DATA_SOURCE_USER_NAME = "root"; // 把 "root" 赋值给 DATA_SOURCE_USER_NAME
//数据库密码 // 保留原作者写的行内注释
private static final String DATA_SOURCE_PASSWORD = "mysql"; // 把 "mysql" 赋值给 DATA_SOURCE_PASSWORD
//生成的表 // 保留原作者写的行内注释
private static final String[] TABLE_NAMES = new String[]{ // 代码逻辑
"xc_company", // 代码逻辑
"xc_company_user", // 代码逻辑
"xc_menu", // 代码逻辑
"xc_permission", // 代码逻辑
"xc_role", // 代码逻辑
"xc_teacher", // 代码逻辑
"xc_user", // 代码逻辑
"xc_user_role" // 代码逻辑
}; // 执行语句
// TODO 默认生成entity,需要生成DTO修改此变量 // 保留原作者写的行内注释
// 一般情况下要先生成 DTO类 然后修改此参数再生成 PO 类。 // 保留原作者写的行内注释
private static final Boolean IS_DTO = false; // 把 false 赋值给 IS_DTO
public static void main(String[] args) { // 定义方法 main(...)
// 代码生成器 // 保留原作者写的行内注释
AutoGenerator mpg = new AutoGenerator(); // 创建 AutoGenerator 对象并赋值给 mpg
// 选择 freemarker 引擎,默认 Velocity // 保留原作者写的行内注释
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // 执行语句
// 全局配置 // 保留原作者写的行内注释
GlobalConfig gc = new GlobalConfig(); // 创建 GlobalConfig 对象并赋值给 gc
gc.setFileOverride(true); // 执行语句
//生成路径 // 保留原作者写的行内注释
gc.setOutputDir(System.getProperty("user.dir") + "/xuecheng-plus-generator/src/main/java"); // 执行语句
gc.setAuthor("itcast"); // 执行语句
gc.setOpen(false); // 执行语句
gc.setSwagger2(false); // 执行语句
gc.setServiceName("%sService"); // 执行语句
gc.setBaseResultMap(true); // 执行语句
gc.setBaseColumnList(true); // 执行语句
if (IS_DTO) { // 定义方法 方法(...)
gc.setSwagger2(true); // 执行语句
gc.setEntityName("%sDTO"); // 执行语句
} // 代码块结束
mpg.setGlobalConfig(gc); // 执行语句
// 数据库配置 // 保留原作者写的行内注释
DataSourceConfig dsc = new DataSourceConfig(); // 创建 DataSourceConfig 对象并赋值给 dsc
dsc.setDbType(DbType.MYSQL); // 执行语句
dsc.setUrl("jdbc:mysql://192.168.101.65:3306/xcplus_users" // 代码逻辑
+ "?serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=utf8"); // 把 UTC&useUnicode=true&useSSL=false&characterEncoding=utf8") 赋值给 "?serverTimezone
// dsc.setDriverName("com.mysql.jdbc.Driver"); // 保留原作者写的行内注释
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // 执行语句
dsc.setUsername(DATA_SOURCE_USER_NAME); // 执行语句
dsc.setPassword(DATA_SOURCE_PASSWORD); // 执行语句
mpg.setDataSource(dsc); // 执行语句
// 包配置 // 保留原作者写的行内注释
PackageConfig pc = new PackageConfig(); // 创建 PackageConfig 对象并赋值给 pc
pc.setModuleName(SERVICE_NAME); // 执行语句
pc.setParent("com.xuecheng"); // 执行语句
pc.setServiceImpl("service.impl"); // 执行语句
pc.setXml("mapper"); // 执行语句
pc.setEntity("model.po"); // 执行语句
mpg.setPackageInfo(pc); // 执行语句
// 设置模板 // 保留原作者写的行内注释
TemplateConfig tc = new TemplateConfig(); // 创建 TemplateConfig 对象并赋值给 tc
mpg.setTemplate(tc); // 执行语句
// 策略配置 // 保留原作者写的行内注释
StrategyConfig strategy = new StrategyConfig(); // 创建 StrategyConfig 对象并赋值给 strategy
strategy.setNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // 执行语句
strategy.setEntityLombokModel(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
strategy.setInclude(TABLE_NAMES); // 执行语句
strategy.setControllerMappingHyphenStyle(true); // 执行语句
strategy.setTablePrefix(pc.getModuleName() + "_"); // 执行语句
// Boolean类型字段是否移除is前缀处理 // 保留原作者写的行内注释
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // 执行语句
strategy.setRestControllerStyle(true); // 执行语句
// 自动填充字段配置 // 保留原作者写的行内注释
strategy.setTableFillList(Arrays.asList( // 代码逻辑
new TableFill("create_date", FieldFill.INSERT), // 代码逻辑
new TableFill("change_date", FieldFill.INSERT_UPDATE), // 代码逻辑
new TableFill("modify_date", FieldFill.UPDATE) // 代码逻辑
)); // 执行语句
mpg.setStrategy(strategy); // 执行语句
mpg.execute(); // 执行语句
} // 代码块结束
} // 代码块结束
评论
0 条
还没有评论,先写一条吧。