kilit 6 年之前
父節點
當前提交
86e573b330

+ 7 - 0
.gitattributes

@@ -0,0 +1,7 @@
+# Windows-specific files that require CRLF:
+*.bat       eol=crlf
+*.txt        eol=crlf
+
+# Unix-specific files that require LF:
+*.java        eol=lf
+*.sh        eol=lf

+ 28 - 0
.gitignore

@@ -0,0 +1,28 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+
+src/test
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### JRebel ###
+rebel.xml
+
+### MAC ###
+.DS_Store
+
+### Other ###
+logs/
+temp/

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# hcd-backend-service-base
+
+基础服务提供者

+ 78 - 0
pom.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>com.hongxin</groupId>
+        <artifactId>hcd-backend-dependencies</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../hcd-backend-dependencies/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>hcd-backend-service-demo</artifactId>
+    <packaging>jar</packaging>
+
+    <name>hcd-backend-service-demo</name>
+    <url>http://www.hongxin.com</url>
+    <inceptionYear>2018-Now</inceptionYear>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.hongxin</groupId>
+            <artifactId>hcd-backend-common-service</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+
+        <!-- LCN分布式事务相关依赖 Begin-->
+       <!-- <dependency>
+            <groupId>com.codingapi</groupId>
+            <artifactId>transaction-springcloud</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.codingapi</groupId>
+            <artifactId>tx-plugins-db</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>-->
+        <!-- LCN分布式事务相关依赖 End-->
+
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>nexus</id>
+            <name>Nexus Repository</name>
+            <url>http://192.168.1.22:8081/repository/maven-public/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+    </repositories>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.hongxin.hcd.backend.service.demo.ServiceDemoApplication</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 23 - 0
src/main/java/com/hongxin/hcd/backend/service/demo/ServiceBaseApplication.java

@@ -0,0 +1,23 @@
+package com.hongxin.hcd.backend.service.demo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import tk.mybatis.spring.annotation.MapperScan;
+
+@SpringBootApplication(scanBasePackages = "com.hongxin.hcd.backend")
+@EnableEurekaClient
+@EnableFeignClients(basePackages = {"com.hongxin.hcd.backend"})
+@MapperScan(basePackages = {"com.hongxin.hcd.backend.service.base.mapper"})
+public class ServiceBaseApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ServiceBaseApplication.class, args);
+    }
+
+
+
+}
+
+

+ 18 - 0
src/main/java/com/hongxin/hcd/backend/service/demo/controller/DemoController.java

@@ -0,0 +1,18 @@
+package com.hongxin.hcd.backend.service.demo.controller;
+
+import com.hongxin.hcd.backend.common.config.context.ApplicationContextHolder;
+import com.hongxin.hcd.backend.common.controller.MyController;
+import com.hongxin.hcd.backend.service.demo.service.IDemoService;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+public class DemoController extends MyController<IDemoService> {
+
+
+    private IDemoService getService(String modelName) {
+        return ApplicationContextHolder.getBean(modelName);
+    }
+
+
+}

+ 7 - 0
src/main/java/com/hongxin/hcd/backend/service/demo/service/IDemoService.java

@@ -0,0 +1,7 @@
+package com.hongxin.hcd.backend.service.demo.service;
+
+import com.hongxin.hcd.backend.common.service.IMyService;
+
+public interface IDemoService extends IMyService<Integer> {
+
+}

+ 17 - 0
src/main/java/com/hongxin/hcd/backend/service/demo/service/impl/Demo1ServiceImpl.java

@@ -0,0 +1,17 @@
+package com.hongxin.hcd.backend.service.demo.service.impl;
+
+
+import com.hongxin.hcd.backend.common.service.impl.MyServiceImpl;
+import com.hongxin.hcd.backend.service.demo.service.IDemoService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Service("demo_1")
+@Transactional(readOnly = true)
+public class Demo1ServiceImpl extends MyServiceImpl implements IDemoService {
+
+
+
+
+}

+ 33 - 0
src/main/java/com/hongxin/hcd/backend/service/domain/Demo.java

@@ -0,0 +1,33 @@
+package com.hongxin.hcd.backend.service.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.hongxin.hcd.backend.common.domain.anno.Fields;
+import com.hongxin.hcd.backend.common.domain.anno.MyTable;
+import com.hongxin.hcd.backend.common.domain.persistence.MyEntity;
+import com.hongxin.hcd.backend.common.validator.RegexpUtils;
+import lombok.Getter;
+import lombok.Setter;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import java.util.Date;
+import java.util.List;
+
+/** 基础服务——用户
+ * <p>Title: Action</p>
+ * <p>Description: </p>
+ *
+ * @author kilit
+ * @version 1.0.0
+ * @date 2018/10/23 14:17
+ */
+@MyTable(name = "demo_1")//要生成的表名
+@Getter
+@Setter
+public class Demo extends MyEntity {
+
+    @Length(min = 2, max = 20, message = "用户名称的长度必须介于 2 - 20 位之间")
+    @Fields.VARCHAR(comment ="用户名称",isNull = false)
+    private String name;
+}

+ 14 - 0
src/main/resources/bootstrap-prod.yml

@@ -0,0 +1,14 @@
+spring:
+  cloud:
+    config:
+      uri: http://192.168.1.22:8888
+      name: hcd-backend-client-eureka, hcd-backend-client-zipkin, hcd-backend-client-admin, hcd-backend-common-service, hcd-backend-service-base ,hcd-backend-client-redis, hcd-backend-common-hosts
+      label: master
+      profile: prod
+  main:
+    allow-bean-definition-overriding: true
+
+constants:
+  module: base
+
+

+ 12 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1,12 @@
+spring:
+  cloud:
+    config:
+      uri: http://localhost:8888
+      name: hcd-backend-client-eureka, hcd-backend-client-zipkin, hcd-backend-client-admin, hcd-backend-common-service, hcd-backend-client-redis, hcd-backend-service-base, hcd-backend-common-hosts
+      label: master
+      profile: dev
+  main:
+    allow-bean-definition-overriding: true
+logging:
+  level:
+    com.hongxin.hcd.backend.service.base: debug

+ 78 - 0
src/main/resources/xml/base.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<root>
+
+
+    <!--model begin-->
+    <record id="demo_1" model="resource_model" >
+        <field name="name">demo_1</field>
+    </record>
+    <!--model end-->
+
+    <!--actionId begin-->
+    <record id="demo_1_action_act_window" model="resource_action_act_window" >
+        <field name="xmlId">demo_1_action_act_window</field>
+        <field name="name">demo_1</field>
+        <field name="resModel">demo_1</field>
+        <field name="viewType">form</field>
+        <field name="viewModel">tree,form</field>
+        <field name="type">resource_action_act_window</field>
+        <field name="target">current</field>
+    </record>
+    <!--actionId end-->
+
+    <!--menu begin-->
+    <record id="demo_menu" model="resource_menu" >
+        <field name="name">demo</field>
+        <field name="parentId" eval = "0"/>
+        <field name="sequence" eval = "10"/>
+    </record>
+    <record id="demo_1_menu" model="resource_menu" >
+        <field name="name">demo_1</field>
+        <field name="parentId"  ref="demo_menu"/>
+        <field name="action" ref2="demo_1_action_act_window"/>
+        <field name="sequence" eval = "1"/>
+    </record>
+    <!--menu end-->
+
+    <!--view begin-->
+    <record id="demo_1_view_tree"  model="resource_view" >
+        <field name="xmlId">demo_1_view_tree</field>
+        <field name="name">demo.1.tree</field>
+        <field name="resModel">demo_1</field>
+        <field name="type">tree</field>
+        <field name="arch">
+            <tree string="demo">
+                <field name="name"/>
+            </tree>
+        </field>
+    </record>
+    <record id="demo_1_view_form"  model="resource_view" >
+        <field name="xmlId">demo_1_view_form</field>
+        <field name="name">demo.1.form</field>
+        <field name="resModel">demo_1</field>
+        <field name="type">form</field>
+        <field name="arch">
+            <form string="demo">
+                <sheet>
+                    <group>
+                        <group>
+                            <field name="name"/>
+                        </group>
+                    </group>
+                </sheet>
+            </form>
+        </field>
+    </record>
+    <record id="demo_1_view_search"  model="resource_view" >
+        <field name="xmlId">demo_1_view_search</field>
+        <field name="name">demo.1.search</field>
+        <field name="resModel">demo_1</field>
+        <field name="type">search</field>
+        <field name="arch">
+            <search string="demo">
+
+            </search>
+        </field>
+    </record>
+    <!--view end-->
+</root>