From 4f94774efe52d1ad40f3014abb992c568634d554 Mon Sep 17 00:00:00 2001 From: qinyingjie Date: Thu, 22 Dec 2022 17:40:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:mybatis-plus=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 ++ ...AdsDimFinancialYearWeekInfoController.java | 39 ++++++++ .../entity/AdsDimFinancialYearWeekInfo.java | 90 +++++++++++++++++++ .../AdsDimFinancialYearWeekInfoMapper.java | 19 ++++ .../AdsDimFinancialYearWeekInfoService.java | 15 ++++ ...dsDimFinancialYearWeekInfoServiceImpl.java | 19 ++++ src/main/resources/application.yaml | 4 +- .../mapper/AdsDimFinancialYearWeekInfoDao.xml | 34 +++++++ 8 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/kwan/springbootkwan/controller/AdsDimFinancialYearWeekInfoController.java create mode 100644 src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java create mode 100644 src/main/java/com/kwan/springbootkwan/mapper/AdsDimFinancialYearWeekInfoMapper.java create mode 100644 src/main/java/com/kwan/springbootkwan/service/AdsDimFinancialYearWeekInfoService.java create mode 100644 src/main/java/com/kwan/springbootkwan/service/impl/AdsDimFinancialYearWeekInfoServiceImpl.java create mode 100644 src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml diff --git a/pom.xml b/pom.xml index f9293f9..ea25895 100644 --- a/pom.xml +++ b/pom.xml @@ -124,6 +124,11 @@ org.springframework.boot spring-boot-starter-batch + + com.baomidou + mybatis-plus-extension + 3.5.1 + diff --git a/src/main/java/com/kwan/springbootkwan/controller/AdsDimFinancialYearWeekInfoController.java b/src/main/java/com/kwan/springbootkwan/controller/AdsDimFinancialYearWeekInfoController.java new file mode 100644 index 0000000..355c8a7 --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/controller/AdsDimFinancialYearWeekInfoController.java @@ -0,0 +1,39 @@ +package com.kwan.springbootkwan.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo; +import com.kwan.springbootkwan.service.AdsDimFinancialYearWeekInfoService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * (AdsDimFinancialYearWeekInfo)表控制层 + * + * @author makejava + * @since 2022-12-22 17:25:11 + */ +@RestController +@RequestMapping("adsDimFinancialYearWeekInfo") +public class AdsDimFinancialYearWeekInfoController { + /** + * 服务对象 + */ + @Resource + private AdsDimFinancialYearWeekInfoService adsDimFinancialYearWeekInfoService; + + /** + * 通过主键查询单条数据 + */ + @GetMapping("/{financialYear}/{financialYearWeek}") + public List selectOne(@PathVariable Integer financialYear, @PathVariable Integer financialYearWeek) { + return this.adsDimFinancialYearWeekInfoService.list(new QueryWrapper() + .ne("financial_year", financialYear) + .ne("financial_year_week", financialYearWeek) + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java b/src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java new file mode 100644 index 0000000..a7d0be2 --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java @@ -0,0 +1,90 @@ +package com.kwan.springbootkwan.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +@TableName(value = "ads_dim_financial_year_week_info") +@ApiModel(value = "财年周") +public class AdsDimFinancialYearWeekInfo extends Model { + //财年 + private Integer financialYear; + //第n财年周 + private Integer financialYearWeek; + //财年开始日期 + private Date financialYearStart; + //财年结束日期 + private Date financialYearEnd; + //周开始 + private Date weekStartDay; + //周结束 + private Date weekEndDay; + //财年周所在季节区间,0:跨9月1号,1:3月到8月,2:9月到2月 + private Integer weekInSeason; + + + public Integer getFinancialYear() { + return financialYear; + } + + public void setFinancialYear(Integer financialYear) { + this.financialYear = financialYear; + } + + public Integer getFinancialYearWeek() { + return financialYearWeek; + } + + public void setFinancialYearWeek(Integer financialYearWeek) { + this.financialYearWeek = financialYearWeek; + } + + public Date getFinancialYearStart() { + return financialYearStart; + } + + public void setFinancialYearStart(Date financialYearStart) { + this.financialYearStart = financialYearStart; + } + + public Date getFinancialYearEnd() { + return financialYearEnd; + } + + public void setFinancialYearEnd(Date financialYearEnd) { + this.financialYearEnd = financialYearEnd; + } + + public Date getWeekStartDay() { + return weekStartDay; + } + + public void setWeekStartDay(Date weekStartDay) { + this.weekStartDay = weekStartDay; + } + + public Date getWeekEndDay() { + return weekEndDay; + } + + public void setWeekEndDay(Date weekEndDay) { + this.weekEndDay = weekEndDay; + } + + public Integer getWeekInSeason() { + return weekInSeason; + } + + public void setWeekInSeason(Integer weekInSeason) { + this.weekInSeason = weekInSeason; + } + +} + diff --git a/src/main/java/com/kwan/springbootkwan/mapper/AdsDimFinancialYearWeekInfoMapper.java b/src/main/java/com/kwan/springbootkwan/mapper/AdsDimFinancialYearWeekInfoMapper.java new file mode 100644 index 0000000..9f49252 --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/mapper/AdsDimFinancialYearWeekInfoMapper.java @@ -0,0 +1,19 @@ +package com.kwan.springbootkwan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo; +import org.apache.ibatis.annotations.Mapper; + + +/** + * mapper文件 + * + * @author : qinyingjie + * @version : 2.2.0 + * @date : 2022/12/19 16:12 + */ +@Mapper +public interface AdsDimFinancialYearWeekInfoMapper extends BaseMapper { + +} + diff --git a/src/main/java/com/kwan/springbootkwan/service/AdsDimFinancialYearWeekInfoService.java b/src/main/java/com/kwan/springbootkwan/service/AdsDimFinancialYearWeekInfoService.java new file mode 100644 index 0000000..b0b3e77 --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/service/AdsDimFinancialYearWeekInfoService.java @@ -0,0 +1,15 @@ +package com.kwan.springbootkwan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo; + +/** + * (AdsDimFinancialYearWeekInfo)表服务接口 + * + * @author makejava + * @since 2022-12-22 17:25:11 + */ +public interface AdsDimFinancialYearWeekInfoService extends IService { + +} + diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/AdsDimFinancialYearWeekInfoServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/AdsDimFinancialYearWeekInfoServiceImpl.java new file mode 100644 index 0000000..3e2c638 --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/service/impl/AdsDimFinancialYearWeekInfoServiceImpl.java @@ -0,0 +1,19 @@ +package com.kwan.springbootkwan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo; +import com.kwan.springbootkwan.mapper.AdsDimFinancialYearWeekInfoMapper; +import com.kwan.springbootkwan.service.AdsDimFinancialYearWeekInfoService; +import org.springframework.stereotype.Service; + +/** + * (AdsDimFinancialYearWeekInfo)表服务实现类 + * + * @author makejava + * @since 2022-12-22 17:25:11 + */ +@Service("adsDimFinancialYearWeekInfoService") +public class AdsDimFinancialYearWeekInfoServiceImpl extends ServiceImpl implements AdsDimFinancialYearWeekInfoService { + +} + diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 1de9fb4..a8b9276 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -49,9 +49,9 @@ spring: # mysql datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://120.79.36.53:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + url: jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai username: root - password: 15671628341Qwe. + password: 716288qwe #mybatis-plus配置 mybatis-plus: diff --git a/src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml b/src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml new file mode 100644 index 0000000..ccd4001 --- /dev/null +++ b/src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + insert into kwan.ads_dim_financial_year_week_info(financial_year, financial_year_week, financial_year_start, financial_year_end, week_start_day, week_end_day, week_in_season) + values + + (#{entity.financialYear}, #{entity.financialYearWeek}, #{entity.financialYearStart}, #{entity.financialYearEnd}, #{entity.weekStartDay}, #{entity.weekEndDay}, #{entity.weekInSeason}) + + + + + insert into kwan.ads_dim_financial_year_week_info(financial_year, financial_year_week, financial_year_start, financial_year_end, week_start_day, week_end_day, week_in_season) + values + + (#{entity.financialYear}, #{entity.financialYearWeek}, #{entity.financialYearStart}, #{entity.financialYearEnd}, #{entity.weekStartDay}, #{entity.weekEndDay}, #{entity.weekInSeason}) + + on duplicate key update + financial_year = values(financial_year) , financial_year_week = values(financial_year_week) , financial_year_start = values(financial_year_start) , financial_year_end = values(financial_year_end) , week_start_day = values(week_start_day) , week_end_day = values(week_end_day) , week_in_season = values(week_in_season) + + + -- GitLab