多数据源的项目获取
This commit is contained in:
@ -52,14 +52,14 @@ spring:
|
||||
url: jdbc:mysql://192.168.110.2:13386/xinnengyuandev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: xinnengyuandev
|
||||
password: StRWCZdZirysNSs2
|
||||
# # 从库数据源
|
||||
# slave:
|
||||
# lazy: true
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
# username:
|
||||
# password:
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.110.2:13386/zmkgdev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: zmkgdev
|
||||
password: JhYxREf25AXdy3h8
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
|
@ -2,6 +2,7 @@ package org.dromara.cory.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
@ -1,41 +0,0 @@
|
||||
package org.dromara.cory.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.cory.domain.bo.BusContactformtemplateBo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @Author 重构APP相关接口
|
||||
* @Date 2025/7/28 17:07
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cory/lhygOrXny")
|
||||
public class LhygOrXnyApp {
|
||||
|
||||
// /**
|
||||
// * app登录
|
||||
// */
|
||||
// @RepeatSubmit()
|
||||
// @PostMapping()
|
||||
// public R<Void> Login(
|
||||
// BusContactformtemplateBo bo,
|
||||
// @RequestPart("file") MultipartFile file) {
|
||||
// return toAjax(busContactformtemplateService.insertByBo(bo, file));
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.dromara.cory.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.cory.domain.bo.BusContactnoticeBo;
|
||||
import org.dromara.cory.domain.bo.SysProjectListReq;
|
||||
import org.dromara.cory.domain.vo.BusContactnoticeVo;
|
||||
import org.dromara.cory.domain.vo.SysProjectVo;
|
||||
import org.dromara.cory.service.IOtherDateSourceService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:21
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cory/otherDateSource")
|
||||
@DS("slave")
|
||||
public class OtherDateSource {
|
||||
private final IOtherDateSourceService otherDateSourceService;
|
||||
|
||||
/**
|
||||
* 获取项目列表
|
||||
*/
|
||||
@SaCheckPermission("cory:otherDateSourceService:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysProjectVo> list(SysProjectListReq bo, PageQuery pageQuery) {
|
||||
return otherDateSourceService.list(bo, pageQuery);
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package org.dromara.cory.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:27
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_project") // 替换为实际表名
|
||||
public class SysProject implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Length(max = 64, message = "项目名称长度不能超过64个字符")
|
||||
private String projectName;
|
||||
|
||||
@Length(max = 64, message = "项目简称长度不能超过64个字符")
|
||||
private String shortName;
|
||||
|
||||
private Long pId;
|
||||
|
||||
@Pattern(regexp = "[01]", message = "状态值必须为0或1")
|
||||
private String status;
|
||||
|
||||
@Length(max = 255, message = "项目图片URL长度不能超过255个字符")
|
||||
private String picUrl;
|
||||
|
||||
@Length(max = 20, message = "经度长度不能超过20个字符")
|
||||
private String lng;
|
||||
|
||||
@Length(max = 20, message = "纬度长度不能超过20个字符")
|
||||
private String lat;
|
||||
|
||||
@Length(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
|
||||
@Length(max = 20, message = "项目类型长度不能超过20个字符")
|
||||
private String type;
|
||||
|
||||
@Pattern(regexp = "[12]", message = "项目类型值必须为1或2")
|
||||
private String isType;
|
||||
|
||||
@Length(max = 20, message = "展示颜色长度不能超过20个字符")
|
||||
private String colourRgb;
|
||||
|
||||
@Length(max = 64, message = "创建者长度不能超过64个字符")
|
||||
private String createBy;
|
||||
|
||||
@Length(max = 64, message = "更新者长度不能超过64个字符")
|
||||
private String updateBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private Date deletedAt;
|
||||
|
||||
@Deprecated
|
||||
@Length(max = 255, message = "项目ID长度不能超过255个字符")
|
||||
private String projectId;
|
||||
|
||||
@Length(max = 8192, message = "视角参数长度不能超过8192个字符")
|
||||
private String view;
|
||||
|
||||
@Length(max = 255, message = "项目地址长度不能超过255个字符")
|
||||
private String projectSite;
|
||||
|
||||
@Length(max = 50, message = "负责人长度不能超过50个字符")
|
||||
private String principal;
|
||||
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "负责人电话格式不正确")
|
||||
private String principalPhone;
|
||||
|
||||
@Length(max = 64, message = "小程序薪资负责人长度不能超过64个字符")
|
||||
private String principalXz;
|
||||
|
||||
@Length(max = 64, message = "实际容量长度不能超过64个字符")
|
||||
private String actual;
|
||||
|
||||
@Length(max = 64, message = "计划容量长度不能超过64个字符")
|
||||
private String plan;
|
||||
|
||||
@Length(max = 64, message = "开工时间长度不能超过64个字符")
|
||||
private String onStreamTime;
|
||||
|
||||
@Pattern(regexp = "^\\d{2}:\\d{2},\\d{2}:\\d{2}$", message = "打卡范围格式不正确,应为HH:MM,HH:MM")
|
||||
private String punchRange;
|
||||
|
||||
@Min(value = 0, message = "设计总量不能小于0")
|
||||
private Integer designTotal;
|
||||
|
||||
@Length(max = 255, message = "安全协议书长度不能超过255个字符")
|
||||
private String securityAgreement;
|
||||
|
||||
@Min(value = 0, message = "排序字段不能小于0")
|
||||
private Long sort;
|
||||
|
||||
@Pattern(regexp = "[12]", message = "显示隐藏值必须为1或2")
|
||||
private String showHidden;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.dromara.cory.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.cory.domain.BusContactnotice;
|
||||
import org.dromara.cory.domain.SysProject;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:42
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SysProjectListReq implements Serializable {
|
||||
@Length(max = 64, message = "项目名称长度不能超过64个字符")
|
||||
private String projectName;
|
||||
|
||||
@Length(max = 64, message = "项目简称长度不能超过64个字符")
|
||||
private String shortName;
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package org.dromara.cory.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import org.dromara.cory.domain.BusContactnotice;
|
||||
import org.dromara.cory.domain.SysProject;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:35
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysProject.class)
|
||||
public class SysProjectVo implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Length(max = 64, message = "项目名称长度不能超过64个字符")
|
||||
private String projectName;
|
||||
|
||||
@Length(max = 64, message = "项目简称长度不能超过64个字符")
|
||||
private String shortName;
|
||||
|
||||
private Long pId;
|
||||
|
||||
@Pattern(regexp = "[01]", message = "状态值必须为0或1")
|
||||
private String status;
|
||||
|
||||
@Length(max = 255, message = "项目图片URL长度不能超过255个字符")
|
||||
private String picUrl;
|
||||
|
||||
@Length(max = 20, message = "经度长度不能超过20个字符")
|
||||
private String lng;
|
||||
|
||||
@Length(max = 20, message = "纬度长度不能超过20个字符")
|
||||
private String lat;
|
||||
|
||||
@Length(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
|
||||
@Length(max = 20, message = "项目类型长度不能超过20个字符")
|
||||
private String type;
|
||||
|
||||
@Pattern(regexp = "[12]", message = "项目类型值必须为1或2")
|
||||
private String isType;
|
||||
|
||||
@Length(max = 20, message = "展示颜色长度不能超过20个字符")
|
||||
private String colourRgb;
|
||||
|
||||
@Length(max = 64, message = "创建者长度不能超过64个字符")
|
||||
private String createBy;
|
||||
|
||||
@Length(max = 64, message = "更新者长度不能超过64个字符")
|
||||
private String updateBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private Date deletedAt;
|
||||
|
||||
@Deprecated
|
||||
@Length(max = 255, message = "项目ID长度不能超过255个字符")
|
||||
private String projectId;
|
||||
|
||||
@Length(max = 8192, message = "视角参数长度不能超过8192个字符")
|
||||
private String view;
|
||||
|
||||
@Length(max = 255, message = "项目地址长度不能超过255个字符")
|
||||
private String projectSite;
|
||||
|
||||
@Length(max = 50, message = "负责人长度不能超过50个字符")
|
||||
private String principal;
|
||||
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "负责人电话格式不正确")
|
||||
private String principalPhone;
|
||||
|
||||
@Length(max = 64, message = "小程序薪资负责人长度不能超过64个字符")
|
||||
private String principalXz;
|
||||
|
||||
@Length(max = 64, message = "实际容量长度不能超过64个字符")
|
||||
private String actual;
|
||||
|
||||
@Length(max = 64, message = "计划容量长度不能超过64个字符")
|
||||
private String plan;
|
||||
|
||||
@Length(max = 64, message = "开工时间长度不能超过64个字符")
|
||||
private String onStreamTime;
|
||||
|
||||
@Pattern(regexp = "^\\d{2}:\\d{2},\\d{2}:\\d{2}$", message = "打卡范围格式不正确,应为HH:MM,HH:MM")
|
||||
private String punchRange;
|
||||
|
||||
@Min(value = 0, message = "设计总量不能小于0")
|
||||
private Integer designTotal;
|
||||
|
||||
@Length(max = 255, message = "安全协议书长度不能超过255个字符")
|
||||
private String securityAgreement;
|
||||
|
||||
@Min(value = 0, message = "排序字段不能小于0")
|
||||
private Long sort;
|
||||
|
||||
@Pattern(regexp = "[12]", message = "显示隐藏值必须为1或2")
|
||||
private String showHidden;
|
||||
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package org.dromara.cory.mapper;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.cory.domain.BusContactnotice;
|
||||
import org.dromara.cory.domain.vo.BusContactnoticeVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@ -10,6 +13,8 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
|
||||
|
||||
public interface BusContactnoticeMapper extends BaseMapperPlus<BusContactnotice, BusContactnoticeVo> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package org.dromara.cory.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.cory.domain.BusContactnotice;
|
||||
import org.dromara.cory.domain.SysProject;
|
||||
import org.dromara.cory.domain.vo.BusContactnoticeVo;
|
||||
import org.dromara.cory.domain.vo.SysProjectVo;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface OtherDateSourceMapper extends BaseMapperPlus<SysProject, SysProjectVo> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.dromara.cory.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.cory.domain.SysProject;
|
||||
import org.dromara.cory.domain.bo.SysProjectListReq;
|
||||
import org.dromara.cory.domain.vo.SysProjectVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:26
|
||||
* @Version 1.0
|
||||
*/public interface IOtherDateSourceService extends IService<SysProject> {
|
||||
TableDataInfo<SysProjectVo> list(SysProjectListReq bo, PageQuery pageQuery);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package org.dromara.cory.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.cory.domain.BusContactnotice;
|
||||
import org.dromara.cory.domain.SysProject;
|
||||
import org.dromara.cory.domain.bo.SysProjectListReq;
|
||||
import org.dromara.cory.domain.vo.BusContactnoticeVo;
|
||||
import org.dromara.cory.domain.vo.SysProjectVo;
|
||||
import org.dromara.cory.mapper.OtherDateSourceMapper;
|
||||
import org.dromara.cory.service.IBusContactnoticeService;
|
||||
import org.dromara.cory.service.IOtherDateSourceService;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/7/29 9:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@DS("slave")
|
||||
public class OtherDateSourceServiceImpl extends ServiceImpl<OtherDateSourceMapper, SysProject> implements IOtherDateSourceService {
|
||||
@Override
|
||||
public TableDataInfo<SysProjectVo> list(SysProjectListReq req, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysProject> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(SysProject::getProjectName,req.getProjectName());
|
||||
lqw.like(SysProject::getShortName,req.getShortName());
|
||||
IPage<SysProjectVo> sysProjectVoIPage = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(sysProjectVoIPage);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user