Commit e412c115 authored by fangzhipeng's avatar fangzhipeng

修改目录结构

parent 03bab67f
......@@ -6,8 +6,9 @@
<groupId>com.bigsys</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bigsys-auth-api</artifactId>
<packaging>jar</packaging>
<name>${artifactId}</name>
</project>
\ No newline at end of file
package com.bigsys.auth.api;
import com.bigsys.auth.api.model.AppInfo;
public interface AppAuth {
/**
* 根据应用名称获取应用名称获取应用信息
* @param name 应用名称,全系统唯一
* 根据应用名称获取授权信息
* @param name
* @return
*/
AppInfo auth(String name);
}
package com.bigsys.auth.api.model;
public class AppInfo {
private Integer id;
private String name;
private String authTime;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthTime() {
return authTime;
}
public void setAuthTime(String authTime) {
this.authTime = authTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
......@@ -6,9 +6,10 @@
<groupId>com.bigsys</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bigsys-auth-project</artifactId>
<packaging>war</packaging>
<name>${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......@@ -33,6 +34,12 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.bigsys</groupId>
<artifactId>bigsys-auth-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
......@@ -72,10 +79,10 @@
</dependencies>
<build>
<finalName>bigsys-auth</finalName>
<finalName>${artifactId}</finalName>
<resources>
<resource>
<directory>project/src/main/java</directory>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
......
package com.bigsys.auth;
package com.bigsys.auth.project;
import com.bigsys.auth.db.dao.BsTestMapper;
import com.bigsys.auth.db.model.BsTest;
import com.bigsys.auth.project.db.dao.BsTestMapper;
import com.bigsys.auth.project.db.model.BsTest;
import com.bigsys.dubbo.TestService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -18,8 +18,8 @@ import javax.annotation.Resource;
@Controller
public class MyController {
@Resource
private TestService testService;
// @Resource
// private TestService testService;
@Resource
BsTestMapper bsTestMapper;
......@@ -28,7 +28,7 @@ public class MyController {
public BsTest testSay(@RequestParam(value = "name",defaultValue = "") String name){
StringBuffer sb = new StringBuffer();
sb.append("Dubbo: ").append("");
System.out.println(testService.sayHello());
// System.out.println(testService.sayHello());
BsTest bsTest = new BsTest();
bsTest.setName("呜呜呜呜无无");
// bsTestMapper.insert(bsTest);
......
package com.bigsys.auth.db.dao;
package com.bigsys.auth.project.db.dao;
import com.bigsys.auth.api.model.AppInfo;
import com.bigsys.auth.api.model.AppInfoExample;
import com.bigsys.auth.project.db.model.AppInfo;
import com.bigsys.auth.project.db.model.AppInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
......
<?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.bigsys.auth.db.dao.AppInfoMapper">
<resultMap id="BaseResultMap" type="com.bigsys.auth.api.model.AppInfo">
<mapper namespace="com.bigsys.auth.project.db.dao.AppInfoMapper">
<resultMap id="BaseResultMap" type="com.bigsys.auth.project.db.model.AppInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="auth_time" jdbcType="VARCHAR" property="authTime" />
......@@ -67,7 +67,7 @@
<sql id="Base_Column_List">
id, name, auth_time
</sql>
<select id="selectByExample" parameterType="com.bigsys.auth.api.model.AppInfoExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="com.bigsys.auth.project.db.model.AppInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
......@@ -91,19 +91,19 @@
delete from bigsys_app_info
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bigsys.auth.api.model.AppInfoExample">
<delete id="deleteByExample" parameterType="com.bigsys.auth.project.db.model.AppInfoExample">
delete from bigsys_app_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bigsys.auth.api.model.AppInfo">
<insert id="insert" parameterType="com.bigsys.auth.project.db.model.AppInfo">
insert into bigsys_app_info (id, name, auth_time
)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{authTime,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.bigsys.auth.api.model.AppInfo">
<insert id="insertSelective" parameterType="com.bigsys.auth.project.db.model.AppInfo">
insert into bigsys_app_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -128,7 +128,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bigsys.auth.api.model.AppInfoExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="com.bigsys.auth.project.db.model.AppInfoExample" resultType="java.lang.Long">
select count(*) from bigsys_app_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
......@@ -160,7 +160,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bigsys.auth.api.model.AppInfo">
<update id="updateByPrimaryKeySelective" parameterType="com.bigsys.auth.project.db.model.AppInfo">
update bigsys_app_info
<set>
<if test="name != null">
......@@ -172,7 +172,7 @@
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bigsys.auth.api.model.AppInfo">
<update id="updateByPrimaryKey" parameterType="com.bigsys.auth.project.db.model.AppInfo">
update bigsys_app_info
set name = #{name,jdbcType=VARCHAR},
auth_time = #{authTime,jdbcType=VARCHAR}
......
package com.bigsys.auth.db.dao;
package com.bigsys.auth.project.db.dao;
import com.bigsys.auth.db.model.BsTest;
import com.bigsys.auth.db.model.BsTestExample;
import com.bigsys.auth.project.db.model.BsTest;
import com.bigsys.auth.project.db.model.BsTestExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
......
<?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.bigsys.auth.db.dao.BsTestMapper">
<resultMap id="BaseResultMap" type="com.bigsys.auth.db.model.BsTest">
<mapper namespace="com.bigsys.auth.project.db.dao.BsTestMapper">
<resultMap id="BaseResultMap" type="com.bigsys.auth.project.db.model.BsTest">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
</resultMap>
......@@ -66,7 +66,7 @@
<sql id="Base_Column_List">
id, name
</sql>
<select id="selectByExample" parameterType="com.bigsys.auth.db.model.BsTestExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="com.bigsys.auth.project.db.model.BsTestExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
......@@ -90,17 +90,17 @@
delete from bigsys_test
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bigsys.auth.db.model.BsTestExample">
<delete id="deleteByExample" parameterType="com.bigsys.auth.project.db.model.BsTestExample">
delete from bigsys_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bigsys.auth.db.model.BsTest">
<insert id="insert" parameterType="com.bigsys.auth.project.db.model.BsTest">
insert into bigsys_test (id, name)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.bigsys.auth.db.model.BsTest">
<insert id="insertSelective" parameterType="com.bigsys.auth.project.db.model.BsTest">
insert into bigsys_test
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -119,7 +119,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bigsys.auth.db.model.BsTestExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="com.bigsys.auth.project.db.model.BsTestExample" resultType="java.lang.Long">
select count(*) from bigsys_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
......@@ -147,7 +147,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bigsys.auth.db.model.BsTest">
<update id="updateByPrimaryKeySelective" parameterType="com.bigsys.auth.project.db.model.BsTest">
update bigsys_test
<set>
<if test="name != null">
......@@ -156,7 +156,7 @@
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bigsys.auth.db.model.BsTest">
<update id="updateByPrimaryKey" parameterType="com.bigsys.auth.project.db.model.BsTest">
update bigsys_test
set name = #{name,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
......
package com.bigsys.auth.service.impl;
package com.bigsys.auth.project.service.impl;
import com.bigsys.auth.api.AppAuth;
import com.bigsys.auth.api.model.AppInfo;
import com.bigsys.auth.api.model.AppInfoExample;
import com.bigsys.auth.db.dao.AppInfoMapper;
import com.bigsys.auth.util.CreateExample;
import com.bigsys.auth.project.db.dao.AppInfoMapper;
import com.bigsys.auth.project.db.model.AppInfo;
import com.bigsys.auth.project.db.model.AppInfoExample;
import com.bigsys.auth.project.util.CreateExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("appAuth")
public class AppAuthImpl implements AppAuth{
public class AppAuthImpl implements AppAuth {
@Resource
private AppInfoMapper appInfoMapper;
@Override
public AppInfo auth(String name) {
select((example, criteria) -> {
});
return null;
}
List<AppInfo> select(CreateExample<AppInfoExample, AppInfoExample.Criteria> example) {
AppInfoExample appInfoExample = new AppInfoExample();
......@@ -32,4 +24,17 @@ public class AppAuthImpl implements AppAuth{
example.createExample(appInfoExample, criteria);
return appInfoMapper.selectByExample(appInfoExample);
}
@Override
public com.bigsys.auth.api.model.AppInfo auth(String name) {
List<AppInfo> list = select((example, criteria) -> {});
if (list.size() > 0) {
com.bigsys.auth.api.model.AppInfo appInfo = new com.bigsys.auth.api.model.AppInfo();
appInfo.setId(list.get(0).getId());
appInfo.setName(list.get(0).getName());
appInfo.setAuthTime(list.get(0).getAuthTime());
return appInfo;
}
return null;
}
}
......@@ -6,17 +6,17 @@
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!-- 提供方应用信息,用于计算依赖关系 -->
<dubbo:application name="test_consumer" />
<!--&lt;!&ndash; 提供方应用信息,用于计算依赖关系 &ndash;&gt;-->
<!--<dubbo:application name="test_consumer" />-->
<!-- 使用zookeeper注册中心暴露服务地址 -->
<dubbo:registry address="zookeeper://192.168.1.65:2181" />
<!--&lt;!&ndash; 使用zookeeper注册中心暴露服务地址 &ndash;&gt;-->
<!--<dubbo:registry address="zookeeper://192.168.1.65:2181" />-->
<!-- 用dubbo协议在20880端口暴露服务 -->
<!--dubbo:protocol name="dubbo" port="20880" /-->
<!--&lt;!&ndash; 用dubbo协议在20880端口暴露服务 &ndash;&gt;-->
<!--&lt;!&ndash;dubbo:protocol name="dubbo" port="20880" /&ndash;&gt;-->
<!-- 声明需要暴露的服务接口 -->
<dubbo:reference interface="com.bigsys.dubbo.TestService" id="testService" check="false" />
<!--&lt;!&ndash; 声明需要暴露的服务接口 &ndash;&gt;-->
<!--<dubbo:reference interface="com.bigsys.dubbo.TestService" id="testService" check="false" />-->
</beans>
\ No newline at end of file
......@@ -27,12 +27,12 @@
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描mapping.xml文件,**表示迭代查找 -->
<property name="mapperLocations" value="classpath:com/bigsys/auth/**/*.xml" />
<property name="mapperLocations" value="classpath:com/bigsys/auth/project/db/*.xml" />
</bean>
<!-- DAO接口所在包名,Spring会自动查找其下的类 ,包下的类需要使用@MapperScan注解,否则容器注入会失败 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.bigsys.auth.*" />
<property name="basePackage" value="com.bigsys.auth.project.db.*" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
......
......@@ -9,7 +9,7 @@
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<context:component-scan base-package="com.bigsys.auth" />
<context:component-scan base-package="com.bigsys.auth.project" />
<mvc:annotation-driven />
......
......@@ -10,7 +10,7 @@ jdbc.password=root
# 包路径配置
model.package=com.bigsys.auth.api.model
dao.package=com.bigsys.auth.db.dao
xml.mapper.package=com.bigsys.auth.db.dao
dao.package=com.bigsys.auth.project.db.dao
xml.mapper.package=com.bigsys.auth.project.db.dao
target.project=src/main/java
\ No newline at end of file
......@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>bigsys-auth</artifactId>
<packaging>pom</packaging>
<name>auth Maven Webapp</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<description>用户和应用授权中心</description>
......@@ -16,4 +16,6 @@
<module>bigsys-auth-api</module>
<module>bigsys-auth-project</module>
</modules>
</project>
......@@ -10,7 +10,7 @@
<artifactId>bigsys-dubbo</artifactId>
<packaging>jar</packaging>
<name>dubbo</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<properties>
......
......@@ -10,7 +10,7 @@
<artifactId>bigsys-redis</artifactId>
<packaging>jar</packaging>
<name>redis-util</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
......
......@@ -10,7 +10,7 @@
<artifactId>bigsys-shiro</artifactId>
<packaging>jar</packaging>
<name>shiro</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<properties>
......
......@@ -13,7 +13,7 @@
<artifactId>bigsys-spring</artifactId>
<packaging>jar</packaging>
<name>spring</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<properties>
......
......@@ -10,7 +10,7 @@
<artifactId>bigsys-user</artifactId>
<packaging>jar</packaging>
<name>user</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
......
......@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>bigsys-webdemo</artifactId>
<packaging>war</packaging>
<name>bigsys-webdemo Maven Webapp</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<properties>
......
......@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>bigsys-webdemo2</artifactId>
<packaging>war</packaging>
<name>bigsys-webdemo Maven Webapp</name>
<name>${artifactId}</name>
<url>http://maven.apache.org</url>
<properties>
......
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