diff --git a/enlish-service/pom.xml b/enlish-service/pom.xml index f8aeb28..2b47dd8 100644 --- a/enlish-service/pom.xml +++ b/enlish-service/pom.xml @@ -75,6 +75,21 @@ commons-pool2 + + org.apache.poi + poi + + + + org.apache.poi + poi-ooxml + + + + org.apache.logging.log4j + log4j-core + + diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/UnitDO.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/UnitDO.java new file mode 100644 index 0000000..629e9b5 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/UnitDO.java @@ -0,0 +1,37 @@ +package com.yinlihupo.enlish.service.domain.dataobject; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.Date; + +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +public class UnitDO { + /** + * 主键 + */ + private Integer id; + + /** + * 年级/单元 + */ + private String title; + + /** + * 版本 + */ + private String version; + + /** + * 创建时间 + */ + private LocalDateTime createAt; + + +} \ No newline at end of file diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/VocabularyBankDO.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/VocabularyBankDO.java new file mode 100644 index 0000000..f07a287 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/dataobject/VocabularyBankDO.java @@ -0,0 +1,23 @@ +package com.yinlihupo.enlish.service.domain.dataobject; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +public class VocabularyBankDO { + private Integer id; + + private String word; + + private String definition; + + private String pronunciation; + + private Integer unitId; + +} \ No newline at end of file diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/UnitDOMapper.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/UnitDOMapper.java new file mode 100644 index 0000000..c09acf1 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/UnitDOMapper.java @@ -0,0 +1,21 @@ +package com.yinlihupo.enlish.service.domain.mapper; + +import com.yinlihupo.enlish.service.domain.dataobject.UnitDO; + +public interface UnitDOMapper { + int deleteByPrimaryKey(Integer id); + + // 插入并返回 id + int insert(UnitDO record); + + // 插入并返回 id + int insertSelective(UnitDO record); + + UnitDO selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(UnitDO record); + + int updateByPrimaryKey(UnitDO record); + + UnitDO selectByTitle(String title); +} \ No newline at end of file diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/VocabularyBankDOMapper.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/VocabularyBankDOMapper.java new file mode 100644 index 0000000..db03dd2 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/VocabularyBankDOMapper.java @@ -0,0 +1,17 @@ +package com.yinlihupo.enlish.service.domain.mapper; + +import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO; + +public interface VocabularyBankDOMapper { + int deleteByPrimaryKey(Integer id); + + int insert(VocabularyBankDO record); + + int insertSelective(VocabularyBankDO record); + + VocabularyBankDO selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(VocabularyBankDO record); + + int updateByPrimaryKey(VocabularyBankDO record); +} \ No newline at end of file diff --git a/enlish-service/src/main/resources/generatorConfig.xml b/enlish-service/src/main/resources/generatorConfig.xml index ce7de36..98b5ad0 100644 --- a/enlish-service/src/main/resources/generatorConfig.xml +++ b/enlish-service/src/main/resources/generatorConfig.xml @@ -45,7 +45,7 @@ targetProject="src/main/java"/> - + + + + + + + + + + + id, title, version, create_at + + + + + + delete from unit + where id = #{id,jdbcType=INTEGER} + + + + insert into unit (title, version, create_at) + values (#{title,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR}, #{createAt,jdbcType=TIMESTAMP}) + + + + insert into unit + + + id, + + + title, + + + version, + + + create_at, + + + + + #{id,jdbcType=INTEGER}, + + + #{title,jdbcType=VARCHAR}, + + + #{version,jdbcType=VARCHAR}, + + + #{createAt,jdbcType=TIMESTAMP}, + + + + + + update unit + + + title = #{title,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=VARCHAR}, + + + create_at = #{createAt,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + + update unit + set title = #{title,jdbcType=VARCHAR}, + version = #{version,jdbcType=VARCHAR}, + create_at = #{createAt,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml b/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml new file mode 100644 index 0000000..4e17f8e --- /dev/null +++ b/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + id, word, `definition`, pronunciation, unit_id + + + + + + delete from vocabulary_bank + where id = #{id,jdbcType=INTEGER} + + + + insert into vocabulary_bank (id, word, `definition`, pronunciation, unit_id) + values (#{id,jdbcType=INTEGER}, #{word,jdbcType=VARCHAR}, #{definition,jdbcType=VARCHAR}, + #{pronunciation,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}) + + + + insert into vocabulary_bank + + + id, + + + word, + + + `definition`, + + + pronunciation, + + + unit_id, + + + + + #{id,jdbcType=INTEGER}, + + + #{word,jdbcType=VARCHAR}, + + + #{definition,jdbcType=VARCHAR}, + + + #{pronunciation,jdbcType=VARCHAR}, + + + #{unitId,jdbcType=INTEGER}, + + + + + + update vocabulary_bank + + + word = #{word,jdbcType=VARCHAR}, + + + `definition` = #{definition,jdbcType=VARCHAR}, + + + pronunciation = #{pronunciation,jdbcType=VARCHAR}, + + + unit_id = #{unitId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + + update vocabulary_bank + set word = #{word,jdbcType=VARCHAR}, + `definition` = #{definition,jdbcType=VARCHAR}, + pronunciation = #{pronunciation,jdbcType=VARCHAR}, + unit_id = #{unitId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f02ec3c..30b9eca 100644 --- a/pom.xml +++ b/pom.xml @@ -85,6 +85,24 @@ ${revision} + + org.apache.poi + poi + 5.2.3 + + + + org.apache.poi + poi-ooxml + 5.2.3 + + + + org.apache.logging.log4j + log4j-core + 2.20.0 + + org.projectlombok