mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 19:51:56 +08:00
框架集成 MyBatis-Flex 以真强编码的便捷性
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system;
|
||||
|
||||
import com.github.pagehelper.PageInterceptor;
|
||||
import lombok.var;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
@@ -39,4 +40,14 @@ public class RuoYiSystemApplication
|
||||
public RestTemplate restTemplate(RestTemplateBuilder builder) {
|
||||
// Do any additional configuration here
|
||||
return builder.build(); }
|
||||
//使用自动配置无效,
|
||||
//需要手动注入bean,以让
|
||||
//com.mybatisflex.spring.boot.MybatisFlexAutoConfiguration#MybatisFlexAutoConfiguration
|
||||
//正常获取到com.github.pagehelper.PageInterceptor
|
||||
@Bean public PageInterceptor pageInterceptor(){
|
||||
var i = new PageInterceptor();
|
||||
//转小驼峰用 var i = new MyPageInterceptor();
|
||||
//i.setProperties(null);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class FollowUpController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FollowUp followUp)
|
||||
{
|
||||
return toAjax(followUpService.insertFollowUp(followUp));
|
||||
return toAjax(followUpService.save(followUp));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
@@ -13,6 +15,8 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
* @author ruoyi
|
||||
* @date 2023-07-04
|
||||
*/
|
||||
@Data
|
||||
@Table("building_team_rel")
|
||||
public class BuildingTeamRel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -21,23 +25,23 @@ public class BuildingTeamRel extends BaseEntity
|
||||
private Long id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
|
||||
private String isDeleted;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
|
||||
private Date createdTime;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
|
||||
private String createdBy;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
|
||||
private String modifiedBy;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
|
||||
private Date lastUpdatedTime;
|
||||
|
||||
/** 场馆id */
|
||||
@@ -48,90 +52,4 @@ public class BuildingTeamRel extends BaseEntity
|
||||
@Excel(name = "球队场馆关联表")
|
||||
private Long teamId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setIsDeleted(String isDeleted)
|
||||
{
|
||||
this.isDeleted = isDeleted;
|
||||
}
|
||||
|
||||
public String getIsDeleted()
|
||||
{
|
||||
return isDeleted;
|
||||
}
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
return createdTime;
|
||||
}
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
public void setModifiedBy(String modifiedBy)
|
||||
{
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public String getModifiedBy()
|
||||
{
|
||||
return modifiedBy;
|
||||
}
|
||||
public void setLastUpdatedTime(Date lastUpdatedTime)
|
||||
{
|
||||
this.lastUpdatedTime = lastUpdatedTime;
|
||||
}
|
||||
|
||||
public Date getLastUpdatedTime()
|
||||
{
|
||||
return lastUpdatedTime;
|
||||
}
|
||||
public void setBuildingId(Long buildingId)
|
||||
{
|
||||
this.buildingId = buildingId;
|
||||
}
|
||||
|
||||
public Long getBuildingId()
|
||||
{
|
||||
return buildingId;
|
||||
}
|
||||
public void setTeamId(Long teamId)
|
||||
{
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
public Long getTeamId()
|
||||
{
|
||||
return teamId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("isDeleted", getIsDeleted())
|
||||
.append("createdTime", getCreatedTime())
|
||||
.append("createdBy", getCreatedBy())
|
||||
.append("modifiedBy", getModifiedBy())
|
||||
.append("lastUpdatedTime", getLastUpdatedTime())
|
||||
.append("buildingId", getBuildingId())
|
||||
.append("teamId", getTeamId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -15,11 +18,13 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
* @date 2023-05-07
|
||||
*/
|
||||
@Data
|
||||
@Table("f_follow_up")
|
||||
public class FollowUp extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
/** 客户id */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.ruoyi.system.domain.FollowUp;
|
||||
|
||||
/**
|
||||
@@ -9,7 +11,7 @@ import com.ruoyi.system.domain.FollowUp;
|
||||
* @author ruoyi
|
||||
* @date 2023-05-07
|
||||
*/
|
||||
public interface FollowUpMapper
|
||||
public interface FollowUpMapper extends BaseMapper<FollowUp>
|
||||
{
|
||||
/**
|
||||
* 查询跟进模块-客户跟进记录
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.ruoyi.system.domain.FollowUp;
|
||||
|
||||
/**
|
||||
@@ -9,7 +11,7 @@ import com.ruoyi.system.domain.FollowUp;
|
||||
* @author ruoyi
|
||||
* @date 2023-05-07
|
||||
*/
|
||||
public interface IFollowUpService
|
||||
public interface IFollowUpService extends IService<FollowUp>
|
||||
{
|
||||
/**
|
||||
* 查询跟进模块-客户跟进记录
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.Customer;
|
||||
import com.ruoyi.system.mapper.CustomerMapper;
|
||||
@@ -17,7 +19,7 @@ import com.ruoyi.system.service.IFollowUpService;
|
||||
* @date 2023-05-07
|
||||
*/
|
||||
@Service
|
||||
public class FollowUpServiceImpl implements IFollowUpService
|
||||
public class FollowUpServiceImpl extends ServiceImpl<FollowUpMapper, FollowUp> implements IFollowUpService
|
||||
{
|
||||
@Autowired
|
||||
private FollowUpMapper followUpMapper;
|
||||
|
||||
@@ -5,6 +5,25 @@ server:
|
||||
mybatis:
|
||||
configuration:
|
||||
mapUnderscoreToCamelCase: true
|
||||
# MyBatis配置
|
||||
mybatis-flex:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||
cacheEnabled: true
|
||||
useGeneratedKeys: true
|
||||
defaultExecutorType: SIMPLE
|
||||
configuration:
|
||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
# Spring
|
||||
spring:
|
||||
servlet:
|
||||
|
||||
Reference in New Issue
Block a user