LAPTOP-FO2T5SIU\35838 9 mēneši atpakaļ
vecāks
revīzija
1bfc7fa3da

+ 3 - 3
pom.xml

@@ -64,10 +64,10 @@
         <jdom>1.1</jdom>
         <spring.websocket>5.0.4.RELEASE</spring.websocket>
         <spring.messaging>5.3.27</spring.messaging>
-        <rock.star.frame>0.5.11</rock.star.frame>
-        <rock.star.system>0.2.8.7</rock.star.system>
+        <rock.star.frame>0.6.3</rock.star.frame>
+        <rock.star.system>0.2.8.8</rock.star.system>
         <rock.star.user>0.2.2</rock.star.user>
-        <rock.star.wx>0.2.3</rock.star.wx>
+        <rock.star.wx>0.2.5</rock.star.wx>
         <rock.star.ops>0.1.1</rock.star.ops>
         <rock.star.flow>0.1.4</rock.star.flow>
     </properties>

+ 63 - 63
pro-base/src/main/java/com/idea/config/DataSourcesSlaveConfig.java

@@ -1,63 +1,63 @@
-package com.idea.config;
-
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionTemplate;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.jdbc.DataSourceBuilder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import tk.mybatis.spring.annotation.MapperScan;
-
-import javax.sql.DataSource;
-
-@Configuration
-@MapperScan(basePackages = "com.slave.**.mapper", sqlSessionFactoryRef = "slaveSqlSessionFactory", sqlSessionTemplateRef = "slaveSqlSessionTemplate")
-public class DataSourcesSlaveConfig {
-
-    //主数据源mapper xml文件夹的路径
-    private static final String MAPPER_LOCAL_SLAVE = "classpath*:slave/*/*.xml";
-
-    /**
-     * 是application-test.yml中的spring.datasource.slave配置生效
-     * @return
-     */
-    @Bean(name = "slaveDataSource")
-    @ConfigurationProperties(prefix = "spring.datasource.slave")
-    public DataSource slaveDataSource() {
-        return DataSourceBuilder.create().build();
-    }
-
-    /**
-     * 将配置信息注入到SqlSessionFactoryBean中
-     * @param dataSource    数据库连接信息
-     * @return
-     * @throws Exception
-     */
-    @Bean(name = "slaveSqlSessionFactory")
-    public SqlSessionFactory slaveSqlSessionFactory(@Qualifier("slaveDataSource") DataSource dataSource) throws Exception {
-        return new FactoryUtil().genFactoryBean(dataSource,MAPPER_LOCAL_SLAVE).getObject();
-    }
-
-    /**
-     * 事务管理器,在实例化时注入主库master
-     * @param dataSource
-     * @return
-     */
-    @Bean(name = "slaveTransactionManager")
-    public DataSourceTransactionManager slaveTransactionManager(@Qualifier("slaveDataSource") DataSource dataSource) {
-        return new DataSourceTransactionManager(dataSource);
-    }
-
-    /**
-     * SqlSessionTemplate具有线程安全性
-     * @param sqlSessionFactory
-     * @return
-     * @throws Exception
-     */
-    @Bean(name = "slaveSqlSessionTemplate")
-    public SqlSessionTemplate slaveSqlSessionTemplate(@Qualifier("slaveSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
-        return new SqlSessionTemplate(sqlSessionFactory);
-    }
-}
+//package com.idea.config;
+//
+//import org.apache.ibatis.session.SqlSessionFactory;
+//import org.mybatis.spring.SqlSessionTemplate;
+//import org.springframework.beans.factory.annotation.Qualifier;
+//import org.springframework.boot.context.properties.ConfigurationProperties;
+//import org.springframework.boot.jdbc.DataSourceBuilder;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+//import tk.mybatis.spring.annotation.MapperScan;
+//
+//import javax.sql.DataSource;
+//
+//@Configuration
+//@MapperScan(basePackages = "com.slave.**.mapper", sqlSessionFactoryRef = "slaveSqlSessionFactory", sqlSessionTemplateRef = "slaveSqlSessionTemplate")
+//public class DataSourcesSlaveConfig {
+//
+//    //主数据源mapper xml文件夹的路径
+//    private static final String MAPPER_LOCAL_SLAVE = "classpath*:slave/*/*.xml";
+//
+//    /**
+//     * 是application-test.yml中的spring.datasource.slave配置生效
+//     * @return
+//     */
+//    @Bean(name = "slaveDataSource")
+//    @ConfigurationProperties(prefix = "spring.datasource.slave")
+//    public DataSource slaveDataSource() {
+//        return DataSourceBuilder.create().build();
+//    }
+//
+//    /**
+//     * 将配置信息注入到SqlSessionFactoryBean中
+//     * @param dataSource    数据库连接信息
+//     * @return
+//     * @throws Exception
+//     */
+//    @Bean(name = "slaveSqlSessionFactory")
+//    public SqlSessionFactory slaveSqlSessionFactory(@Qualifier("slaveDataSource") DataSource dataSource) throws Exception {
+//        return new FactoryUtil().genFactoryBean(dataSource,MAPPER_LOCAL_SLAVE).getObject();
+//    }
+//
+//    /**
+//     * 事务管理器,在实例化时注入主库master
+//     * @param dataSource
+//     * @return
+//     */
+//    @Bean(name = "slaveTransactionManager")
+//    public DataSourceTransactionManager slaveTransactionManager(@Qualifier("slaveDataSource") DataSource dataSource) {
+//        return new DataSourceTransactionManager(dataSource);
+//    }
+//
+//    /**
+//     * SqlSessionTemplate具有线程安全性
+//     * @param sqlSessionFactory
+//     * @return
+//     * @throws Exception
+//     */
+//    @Bean(name = "slaveSqlSessionTemplate")
+//    public SqlSessionTemplate slaveSqlSessionTemplate(@Qualifier("slaveSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
+//        return new SqlSessionTemplate(sqlSessionFactory);
+//    }
+//}

+ 6 - 0
pro-base/src/main/java/com/idea/pro/service/SafeRequestInfo.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
 import com.rockstar.common.interceptor.SafeUrlModel;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 @Service
@@ -24,4 +25,9 @@ public class SafeRequestInfo implements SafeUrlModel {
         return flag;
     }
 
+    @Override
+    public boolean checkSafe(HttpServletRequest httpServletRequest) {
+        return false;
+    }
+
 }

+ 0 - 77
pro-base/src/main/java/com/slave/demo/controller/DemoClassController.java

@@ -1,77 +0,0 @@
-package com.slave.demo.controller;
-
-import com.github.pagehelper.PageInfo;
-import com.rockstar.common.base.BaseController;
-import com.rockstar.common.domain.AjaxResult;
-import com.rockstar.frame.model.extend.DateTrans;
-import com.rockstar.frame.model.extend.TableSplitResult;
-import com.rockstar.frame.model.extend.Tablepar;
-import com.slave.demo.model.DemoClass;
-import com.slave.demo.service.DemoClassService;
-import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.util.Date;
-
-/**
- * Created by pengyq on 2023.
- */
-@Controller
-@RequestMapping(value = "DemoClassController")
-@Api(value="演示班级管理")
-public class DemoClassController extends BaseController {
-
-    //主表
-    @Autowired
-    private DemoClassService modelService;
-
-
-    @PostMapping(value = "list",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public Object list(Tablepar tablepar, DemoClass model){
-        PageInfo<DemoClass> page= modelService.list(tablepar,model);
-        TableSplitResult<DemoClass> result=new TableSplitResult<DemoClass>(page.getPageNum(), page.getTotal(), page.getList());
-        return  result;
-    }
-
-    @PostMapping(value = "listAll",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public Object listAll(DemoClass model, DateTrans dt){
-        return  modelService.listAll(model);
-    }
-
-    @PostMapping(value = "add",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public AjaxResult add(DemoClass record){
-        record.setCreatedAt(new Date());
-        int result = modelService.insert(record);
-        return result(result);
-    }
-
-    @PostMapping(value = "remove/{id}",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public AjaxResult remove(@PathVariable("id") String id){
-        int result = modelService.deleteByPrimaryKey(id);
-        return result(result);
-    }
-
-    @PostMapping(value = "edit",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public AjaxResult editSave(DemoClass model){
-        int result = modelService.updateByPrimaryKeySelective(model);
-        return result(result);
-    }
-
-    @PostMapping(value = "getById",produces = {"application/json;charset=UTF-8"})
-    @ResponseBody
-    public DemoClass getById(String id) {
-        return modelService.selectByPrimaryKey(id);
-    }
-
-
-}

+ 0 - 13
pro-base/src/main/java/com/slave/demo/mapper/DemoClassMapper.java

@@ -1,13 +0,0 @@
-package com.slave.demo.mapper;
-
-import com.slave.demo.model.DemoClass;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import tk.mybatis.mapper.common.Mapper;
-
-public interface DemoClassMapper extends Mapper<DemoClass> {
-
-    //返回组合起来的快检+报告值
-    @Select("select * from edu_report a , quick_report_detail b WHERE a.quick_report_id = b.id AND b.id =  #{quickReportId}")
-    DemoClass reportQucikAll(@Param("quickReportId")String quickReportId);
-}

+ 0 - 63
pro-base/src/main/java/com/slave/demo/model/DemoClass.java

@@ -1,63 +0,0 @@
-package com.slave.demo.model;
-
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-import java.util.Date;
-
-@Table(name = "demo_class")
-public class DemoClass implements Serializable {
-
-    @Id
-    private String id;
-
-    private String name;
-
-    private String grade;
-
-    private Date createdAt;
-
-    private String createdBy;
-
-    private static final long serialVersionUID = 1L;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id == null ? null : id.trim();
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name == null ? null : name.trim();
-    }
-
-    public String getGrade() {
-        return grade;
-    }
-
-    public void setGrade(String grade) {
-        this.grade = grade == null ? null : grade.trim();
-    }
-
-    public Date getCreatedAt() {
-        return createdAt;
-    }
-
-    public void setCreatedAt(Date createdAt) {
-        this.createdAt = createdAt;
-    }
-
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    public void setCreatedBy(String createdBy) {
-        this.createdBy = createdBy == null ? null : createdBy.trim();
-    }
-}

+ 0 - 116
pro-base/src/main/java/com/slave/demo/service/DemoClassService.java

@@ -1,116 +0,0 @@
-package com.slave.demo.service;
-
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import com.rockstar.frame.model.extend.Tablepar;
-import com.rockstar.util.SnowflakeIdWorker;
-import com.rockstar.util.StringUtils;
-import com.slave.demo.mapper.DemoClassMapper;
-import com.slave.demo.model.DemoClass;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import tk.mybatis.mapper.entity.Example;
-
-import java.util.List;
-
-@Service
-public class DemoClassService {
-
-    //文件mapper
-    @Autowired
-    private DemoClassMapper modelMapper;
-
-    /**
-     * 分页查询+条件
-     *
-     * @return
-     */
-    public PageInfo<DemoClass> list(Tablepar tablepar, DemoClass model) {
-        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
-        List<DemoClass> list = modelMapper.selectByExample(getCondition(model));
-        PageInfo<DemoClass> pageInfo = new PageInfo<>(list);
-        return pageInfo;
-    }
-
-    /**
-     * 查询指定 条件查询
-     *
-     * @return
-     */
-    public List<DemoClass> listAll(DemoClass model) {
-        return modelMapper.selectByExample(getCondition(model));
-    }
-
-    private Example getCondition(DemoClass model) {
-        Example example = new Example(DemoClass.class);
-        Example.Criteria criteria = example.createCriteria();
-        if(StringUtils.isNotEmpty(model.getGrade())) {
-            criteria.andEqualTo("grade",model.getGrade());
-        }
-        if(StringUtils.isNotEmpty(model.getName())) {
-            criteria.andLike("name",model.getName());
-        }
-        example.orderBy("createdAt").desc();
-
-        return example;
-    }
-
-    /**
-     * 根据id删除
-     * @param ids
-     * @return
-     */
-
-
-    public int deleteByPrimaryKey(String ids) {
-        return modelMapper.deleteByPrimaryKey(ids);
-    }
-
-    /**
-     *根据id查询
-     * @param id
-     * @return
-     */
-
-    public DemoClass selectByPrimaryKey(String id) {
-        return  modelMapper.selectByPrimaryKey(id);
-    }
-
-    public int updateByPrimaryKeySelective(DemoClass model) {
-        return modelMapper.updateByPrimaryKeySelective(model);
-    }
-
-    public int updateByExampleSelective(DemoClass model,Example example) {
-        return modelMapper.updateByExampleSelective(model, example);
-    }
-
-    public int updateByExample(DemoClass model, Example example) {
-        return modelMapper.updateByExample(model, example);
-    }
-
-    public List<DemoClass> selectByExample(Example example) {
-        return modelMapper.selectByExample(example);
-    }
-
-    public long countByExample(Example example) {
-        return modelMapper.selectCountByExample(example);
-    }
-
-    public int deleteByExample(Example example) {
-        return modelMapper.deleteByExample(example);
-    }
-
-    public int insert(DemoClass model){
-        model.setId(SnowflakeIdWorker.getUUID());
-        return modelMapper.insert(model);
-    }
-
-    @Transactional(value="slaveTransactionManager")
-    public int insertSelective(DemoClass model) {
-        model.setId(SnowflakeIdWorker.getUUID());
-        return modelMapper.insertSelective(model);
-
-    }
-
-}

+ 0 - 5
pro-base/src/main/resources/slave/demo/DemoClassMapper.xml

@@ -1,5 +0,0 @@
-<?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="com.slave.demo.mapper.DemoClassMapper">
-
-</mapper>

+ 0 - 16
pro-main/src/main/resources/application-test.yml

@@ -9,22 +9,6 @@ spring:
       username: root
       password: 123456
       driver-class-name: com.mysql.jdbc.Driver
-    #从库
-#    slave:
-#      jdbc-url: jdbc:mysql://localhost:3306/idea_base?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#      username: root
-#      password: 123456
-#      driver-class-name: com.mysql.jdbc.Driver
-    slave:
-      jdbc-url: jdbc:postgresql://47.113.226.116:5333/citylifeline_db
-      username: postgres
-      password: mygo@avemujica
-      driver-class-name: org.postgresql.Driver
-#    slave:
-#      jdbc-url: jdbc:postgresql://118.195.242.202:5333/idea_lifeline_platform
-#      username: postgres
-#      password: idea@2023
-#      driver-class-name: org.postgresql.Driver
     hikari:
       maxLifetime: 1765000
       maximumPoolSize: 15

+ 1 - 1
pro-main/src/main/resources/application.yml

@@ -37,7 +37,7 @@ server:
 spring:
   profiles:
     # 数据库源,dev/prod/test
-    active: dev
+    active: test
   messages:
     encoding: UTF-8
   servlet: