Commit f60e33ac by chang_chao@founder.com.cn
parents d44aa150 b4e29a8b
......@@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement //开启事务管理
@EnableScheduling //开启定时任务
@EnableAsync //开启异步
@MapperScan({"com.founder.interservice.mapper.xzxt","com.founder.interservice.mapper.gxzxt"})
@MapperScan({"com.founder.interservice.mapper.xzxt","com.founder.interservice.mapper.gxzxt","com.founder.interservice.mapper.cqxz"})
public class BigdatainterserviceApplication{
public static void main(String[] args) {
SpringApplication.run(BigdatainterserviceApplication.class, args);
......
package com.founder.interservice.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
/**
* Created by liuys on 2019/4/24.
*/
@Configuration
@MapperScan(basePackages = "com.founder.interservice.mapper.cqxz", sqlSessionTemplateRef = "cqxzSqlSessionTemplate")
public class DataSourceCqxzConfig {
@Bean(name = "cqxzDataSource")
@ConfigurationProperties(prefix = "spring.datasource.cqxz")
public DataSource cqxzDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "cqxzSqlSessionFactory")
public SqlSessionFactory cqxzSqlSessionFactory(@Qualifier("cqxzDataSource") DataSource dataSource) throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/mapper/cqxz/*.xml"));
return bean.getObject();
}
@Bean(name = "cqxzSqlSessionTemplate")
public SqlSessionTemplate cqxzSqlSessionTemplate(@Qualifier("cqxzSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.founder.interservice.controller;
import com.founder.interservice.model.TbStAsj;
import com.founder.interservice.model.TbTzxxjqTzxxlydy;
import com.founder.interservice.service.TbTzxxjqTzxxlydyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Created by liuys on 2019/4/24.
*/
@Controller
@CrossOrigin
public class TzxxlydyController {
@Autowired
private TbTzxxjqTzxxlydyService tzxxlydyService;
@RequestMapping("/getTzxxlydy")
@ResponseBody
public List<TbTzxxjqTzxxlydy> getTzxxlydyByAsjbh(@Validated TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy){
return tzxxlydyService.findTzxxlydyByAsjbh(tbTzxxjqTzxxlydy);
}
@RequestMapping("/getBshGlaj")
@ResponseBody
public List<TbStAsj> getBshGlajByBsh(@Validated TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy){
return tzxxlydyService.findAsjxxByBsh(tbTzxxjqTzxxlydy);
}
}
package com.founder.interservice.mapper.cqxz;
import com.founder.interservice.model.TbStAsj;
import org.springframework.stereotype.Repository;
import org.springframework.validation.annotation.Validated;
import java.util.List;
/**
* Created by liuys on 2019/4/25.
*/
@Repository
public interface TbStAsjMapper {
List<TbStAsj> findAsjxxByAsjbh(String _parameter);
}
package com.founder.interservice.mapper.cqxz;
import com.founder.interservice.model.TbTzxxjqTzxxlydy;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by liuys on 2019/4/24.
*/
@Repository
public interface TbTzxxjqTzxxlydyMapper {
public List<TbTzxxjqTzxxlydy> findTzxxlydyByAsjbh(TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy);
}
package com.founder.interservice.model;
import lombok.Data;
/**
* Created by liuys on 2019/4/25.
*/
@Data
public class TbStAsj {
private String asjbh;
private String ajmc;
private String asjfssjAsjfskssj;
private String asjfsddDzmc;
private String jyaq;
}
package com.founder.interservice.model; //
import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* Created by liuys on 2019/4/24.
*/
@Data
public class TbTzxxjqTzxxlydy {
private String rcdid; //主键编号
private String ztbs; // 主题标示(特征信息类型 用固定的字符,表示特定主题,如aj)
private String bshlx; // 对应的标示号类型(内容要和标示号类型代码表中的一致)
private String zjzdmc; // 该表的主键字段名称(配置案件编号,线索编号等字段的名称)
private Date afsj; //
private String lrr; // 录入人
private Date lrsj; // 录入时间
private String lrdwdm; // 录入单位代码
private String lrdwmc; // 录入单位名称
private String gxr; // 改写人
private Date gxsj; // 改写时间
private String scbz; // 删除标志
private String zjbh; // 该表的主键编号
private String gjc; // 关键特征信息
private String bm; // 特征信息来源表名
private String ip; // ip地址
private String gxdwdm; // 改写单位代码
private String gxdwmc; // 改写单位名称
private String cxlx; //查询类型01表示查询标识号,02表示根据标识号查关联案件信息
}
package com.founder.interservice.service;
import com.founder.interservice.model.TbStAsj;
import com.founder.interservice.model.TbTzxxjqTzxxlydy;
import java.util.List;
/**
* Created by liuys on 2019/4/24.
*/
public interface TbTzxxjqTzxxlydyService {
List<TbTzxxjqTzxxlydy> findTzxxlydyByAsjbh(TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy);
List<TbStAsj> findAsjxxByBsh(TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy);
}
package com.founder.interservice.service.impl;
import com.founder.interservice.mapper.cqxz.TbStAsjMapper;
import com.founder.interservice.mapper.cqxz.TbTzxxjqTzxxlydyMapper;
import com.founder.interservice.model.TbStAsj;
import com.founder.interservice.model.TbTzxxjqTzxxlydy;
import com.founder.interservice.service.TbTzxxjqTzxxlydyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by liuys on 2019/4/24.
*/
@Service
public class TbTzxxjqTzxxlydyServiceImpl implements TbTzxxjqTzxxlydyService {
@Autowired
TbTzxxjqTzxxlydyMapper tzxxlydyMapper;
@Autowired
TbStAsjMapper tbStAsjMapper;
@Override
public List<TbTzxxjqTzxxlydy> findTzxxlydyByAsjbh(TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy) {
return tzxxlydyMapper.findTzxxlydyByAsjbh(tbTzxxjqTzxxlydy);
}
@Override
public List<TbStAsj> findAsjxxByBsh(TbTzxxjqTzxxlydy tbTzxxjqTzxxlydy) {
TbTzxxjqTzxxlydy cxst = new TbTzxxjqTzxxlydy();
cxst.setGjc(tbTzxxjqTzxxlydy.getGjc());
List<TbTzxxjqTzxxlydy> tzxxlydyList = tzxxlydyMapper.findTzxxlydyByAsjbh(cxst);
StringBuilder asjbh = new StringBuilder("");
for (TbTzxxjqTzxxlydy tzxxlydy:tzxxlydyList) {
if (!tbTzxxjqTzxxlydy.getZjbh().equals(tzxxlydy.getZjbh())){
asjbh.append(",'"+tzxxlydy.getZjbh()+"'");
}
}
String asjbhStr = asjbh.toString();
if(asjbhStr==null||"".equals(asjbhStr)){
return null;
}else {
return tbStAsjMapper.findAsjxxByAsjbh(asjbhStr.substring(1));
}
}
}
......@@ -2,14 +2,19 @@ spring:
datasource:
xzxt:
driver-class-name: oracle.jdbc.driver.OracleDriver
username: XZXTCQ
password: XZXTCQ
url: jdbc:oracle:thin:@192.168.0.104:1521:XZXT
username: XZXT
password: XZXT
url: jdbc:oracle:thin:@192.168.1.116:1521:xzxtcp
gxzxt:
driver-class-name: oracle.jdbc.driver.OracleDriver
username: XZXT
password: XZXT
url: jdbc:oracle:thin:@192.168.1.101:1521:cqxzxtsid
cqxz:
driver-class-name: oracle.jdbc.driver.OracleDriver
username: XZXT
password: XZXT
url: jdbc:oracle:thin:@192.168.1.105:1521:XZXT3
#配置jpa 使其展示sql语句
jpa:
show-sql: true
......@@ -10,6 +10,11 @@ spring:
username: GXZXT_WB
password: GXZXT_WB2018
url: jdbc:oracle:thin:@10.154.106.26:1521:XZDB
cqxz:
driver-class-name: oracle.jdbc.driver.OracleDriver
username: XZXT
password: XzxtPwd#50
url: jdbc:oracle:thin:@77.1.24.50:1521:CQXZ
#配置jpa 使其展示sql语句
jpa:
show-sql: false
\ No newline at end of file
<?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.founder.interservice.mapper.cqxz.TbStAsjMapper">
<select id="findAsjxxByAsjbh" parameterType="String" resultType="com.founder.interservice.model.TbStAsj">
SELECT ASJBH as asjbh,ASJFSSJ_ASJFSKSSJ as asjfssjAsjfskssj,AJMC as ajmc,ASJFSDD_DZMC as asjfsddDzmc,JYAQ as jyaq from TB_ST_ASJ where XXSC_PDBZ='0' and asjbh IN (${_parameter})
</select>
</mapper>
\ No newline at end of file
<?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.founder.interservice.mapper.cqxz.TbTzxxjqTzxxlydyMapper">
<select id="findTzxxlydyByAsjbh" parameterType="com.founder.interservice.model.TbTzxxjqTzxxlydy" resultType="com.founder.interservice.model.TbTzxxjqTzxxlydy">
SELECT bshlx,zjbh,gjc from TB_TZXXJQ_TZXXLXDY where SCBZ=0
<if test="zjbh != null and zjbh != ''">
and ZJBH = #{zjbh}
</if>
<if test="gjc != null and gjc != ''">
and GJC = #{gjc}
</if>
<if test="bshlx != null and bshlx != ''">
and BSHLX = #{bshlx}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment