正在显示
34 个修改的文件
包含
3309 行增加
和
0 行删除
.gitignore
0 → 100644
1 | +HELP.md | ||
2 | +target/ | ||
3 | +!.mvn/wrapper/maven-wrapper.jar | ||
4 | +!**/src/main/**/target/ | ||
5 | +!**/src/test/**/target/ | ||
6 | + | ||
7 | +### STS ### | ||
8 | +.apt_generated | ||
9 | +.classpath | ||
10 | +.factorypath | ||
11 | +.project | ||
12 | +.settings | ||
13 | +.springBeans | ||
14 | +.sts4-cache | ||
15 | + | ||
16 | +### IntelliJ IDEA ### | ||
17 | +*.log | ||
18 | +.idea | ||
19 | +*.iws | ||
20 | +*.iml | ||
21 | +*.ipr | ||
22 | + | ||
23 | +### NetBeans ### | ||
24 | +/nbproject/private/ | ||
25 | +/nbbuild/ | ||
26 | +/dist/ | ||
27 | +/nbdist/ | ||
28 | +/.nb-gradle/ | ||
29 | +build/ | ||
30 | +!**/src/main/**/build/ | ||
31 | +!**/src/test/**/build/ | ||
32 | + | ||
33 | +### VS Code ### | ||
34 | +.vscode/ |
config/application.yml
0 → 100644
1 | +server: | ||
2 | + port: 9111 | ||
3 | + | ||
4 | +# spring 配置 | ||
5 | +spring: | ||
6 | + security: | ||
7 | + user: | ||
8 | + name: admin | ||
9 | + password: 123456 | ||
10 | + | ||
11 | + application: | ||
12 | + name: station-manage | ||
13 | + | ||
14 | + # 数据源配置 | ||
15 | + datasource: | ||
16 | + type: com.alibaba.druid.pool.DruidDataSource | ||
17 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
18 | + url: jdbc:mysql://118.31.66.166:3306/station?characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true | ||
19 | + username: 110 | ||
20 | + password: QAHqCJf2kFYCLirM | ||
21 | + | ||
22 | + # 多环境配置 | ||
23 | + profiles: | ||
24 | + active: dev | ||
25 | + | ||
26 | + # Jackson配置 | ||
27 | + jackson: | ||
28 | + default-property-inclusion: ALWAYS | ||
29 | + time-zone: GMT+8 | ||
30 | + date-format: yyyy-MM-dd HH:mm:ss | ||
31 | + | ||
32 | + # zipkin 链路追踪配置 | ||
33 | + zipkin: | ||
34 | + base-url: http://192.168.1.63:9411 | ||
35 | + sleuth: | ||
36 | + sampler: | ||
37 | + probability: 1 | ||
38 | + | ||
39 | +# mybatis 配置 | ||
40 | +mybatis: | ||
41 | + mapper-locations: classpath:mapper/*.xml | ||
42 | + type-aliases-package: com.sunyo.wlpt.station.manage.domain | ||
43 | + | ||
44 | +# 日志配置 | ||
45 | +logging: | ||
46 | + config: config/logback-dev.xml | ||
47 | + level: | ||
48 | + com.sunyo.wlpt.station.manage: debug | ||
49 | +logback: | ||
50 | + appname: station_manage | ||
51 | + logdir: ./log | ||
52 | + | ||
53 | +#eureka 配置 | ||
54 | +eureka: | ||
55 | + instance: | ||
56 | + status-page-url: http://${eureka.instance.hostname}:${server.port}/index | ||
57 | + prefer-ip-address: true | ||
58 | + instance-id: ${spring.cloud.client.ip-address}:${server.port} | ||
59 | + hostname: ${spring.cloud.client.ip-address} | ||
60 | + metadata-map: | ||
61 | + user: | ||
62 | + name: "admin" | ||
63 | + password: "123456" | ||
64 | + | ||
65 | + client: | ||
66 | + healthcheck: | ||
67 | + enabled: true | ||
68 | + service-url: | ||
69 | + defaultZone: http://192.168.1.53:12345/eureka/ | ||
70 | + | ||
71 | +# boot admin | ||
72 | +management: | ||
73 | + endpoints: | ||
74 | + enabled-by-default: true | ||
75 | + web: | ||
76 | + exposure: | ||
77 | + include: "*" | ||
78 | + endpoint: | ||
79 | + health: | ||
80 | + show-details: always | ||
81 | + shutdown: | ||
82 | + enabled: true | ||
83 | + | ||
84 | +# 基础信息配置 | ||
85 | +info: | ||
86 | + version: 1.0.0 | ||
87 | + description: "场站管理:包括场站管理、卡口管理、仓库管理" | ||
88 | + |
config/bootstrap.yml
0 → 100644
config/logback-dev.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!--参考文档链接:https://blog.csdn.net/qq_34912478/article/details/80877132--> | ||
3 | +<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> | ||
4 | +<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --> | ||
5 | +<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> | ||
6 | +<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | ||
7 | +<configuration scan="true" scanPeriod="10 seconds"> | ||
8 | + | ||
9 | + <!--<include resource="org/springframework/boot/logging/logback/base.xml" />--> | ||
10 | + | ||
11 | + <contextName>logback</contextName> | ||
12 | + <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> | ||
13 | + <property name="log.path" value="./logs" /> | ||
14 | + | ||
15 | + <!-- 彩色日志 --> | ||
16 | + <!-- 彩色日志依赖的渲染类 --> | ||
17 | + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> | ||
18 | + <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> | ||
19 | + <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> | ||
20 | + <!-- 彩色日志格式 --> | ||
21 | + <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | ||
22 | + | ||
23 | + | ||
24 | + <!--输出到控制台--> | ||
25 | + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
26 | + <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | ||
27 | + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
28 | + <level>debug</level> | ||
29 | + </filter> | ||
30 | + <encoder> | ||
31 | + <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | ||
32 | + <!-- 设置字符集 windows系统这里设置成GBK--> | ||
33 | + <charset>UTF-8</charset> | ||
34 | + </encoder> | ||
35 | + </appender> | ||
36 | + | ||
37 | + | ||
38 | + <!--输出到文件--> | ||
39 | + | ||
40 | + <!-- 时间滚动输出 level为 DEBUG 日志 --> | ||
41 | + <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
42 | + <!-- 正在记录的日志文件的路径及文件名 --> | ||
43 | + <file>${log.path}/log_debug.log</file> | ||
44 | + <!--日志文件输出格式--> | ||
45 | + <encoder> | ||
46 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
47 | + <charset>UTF-8</charset> <!-- 设置字符集 --> | ||
48 | + </encoder> | ||
49 | + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||
50 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
51 | + <!-- 日志归档 --> | ||
52 | + <fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
53 | + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
54 | + <maxFileSize>100MB</maxFileSize> | ||
55 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
56 | + <!--日志文件保留天数--> | ||
57 | + <maxHistory>15</maxHistory> | ||
58 | + </rollingPolicy> | ||
59 | + <!-- 此日志文件只记录debug级别的 --> | ||
60 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
61 | + <level>debug</level> | ||
62 | + <onMatch>ACCEPT</onMatch> | ||
63 | + <onMismatch>DENY</onMismatch> | ||
64 | + </filter> | ||
65 | + </appender> | ||
66 | + | ||
67 | + <!-- 时间滚动输出 level为 INFO 日志 --> | ||
68 | + <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
69 | + <!-- 正在记录的日志文件的路径及文件名 --> | ||
70 | + <file>${log.path}/log_info.log</file> | ||
71 | + <!--日志文件输出格式--> | ||
72 | + <encoder> | ||
73 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
74 | + <charset>UTF-8</charset> | ||
75 | + </encoder> | ||
76 | + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||
77 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
78 | + <!-- 每天日志归档路径以及格式 --> | ||
79 | + <fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
80 | + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
81 | + <maxFileSize>100MB</maxFileSize> | ||
82 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
83 | + <!--日志文件保留天数--> | ||
84 | + <maxHistory>15</maxHistory> | ||
85 | + </rollingPolicy> | ||
86 | + <!-- 此日志文件只记录info级别的 --> | ||
87 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
88 | + <level>info</level> | ||
89 | + <onMatch>ACCEPT</onMatch> | ||
90 | + <onMismatch>DENY</onMismatch> | ||
91 | + </filter> | ||
92 | + </appender> | ||
93 | + | ||
94 | + <!-- 时间滚动输出 level为 WARN 日志 --> | ||
95 | + <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
96 | + <!-- 正在记录的日志文件的路径及文件名 --> | ||
97 | + <file>${log.path}/log_warn.log</file> | ||
98 | + <!--日志文件输出格式--> | ||
99 | + <encoder> | ||
100 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
101 | + <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||
102 | + </encoder> | ||
103 | + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||
104 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
105 | + <fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
106 | + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
107 | + <maxFileSize>100MB</maxFileSize> | ||
108 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
109 | + <!--日志文件保留天数--> | ||
110 | + <maxHistory>15</maxHistory> | ||
111 | + </rollingPolicy> | ||
112 | + <!-- 此日志文件只记录warn级别的 --> | ||
113 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
114 | + <level>warn</level> | ||
115 | + <onMatch>ACCEPT</onMatch> | ||
116 | + <onMismatch>DENY</onMismatch> | ||
117 | + </filter> | ||
118 | + </appender> | ||
119 | + | ||
120 | + | ||
121 | + <!-- 时间滚动输出 level为 ERROR 日志 --> | ||
122 | + <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
123 | + <!-- 正在记录的日志文件的路径及文件名 --> | ||
124 | + <file>${log.path}/log_error.log</file> | ||
125 | + <!--日志文件输出格式--> | ||
126 | + <encoder> | ||
127 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
128 | + <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||
129 | + </encoder> | ||
130 | + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||
131 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
132 | + <fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
133 | + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
134 | + <maxFileSize>100MB</maxFileSize> | ||
135 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
136 | + <!--日志文件保留天数--> | ||
137 | + <maxHistory>15</maxHistory> | ||
138 | + </rollingPolicy> | ||
139 | + <!-- 此日志文件只记录ERROR级别的 --> | ||
140 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
141 | + <level>ERROR</level> | ||
142 | + <onMatch>ACCEPT</onMatch> | ||
143 | + <onMismatch>DENY</onMismatch> | ||
144 | + </filter> | ||
145 | + </appender> | ||
146 | + | ||
147 | + <!-- 时间滚动输出 level为 trace 日志 --> | ||
148 | + <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
149 | + <!-- 正在记录的日志文件的路径及文件名 --> | ||
150 | + <file>${log.path}/log_trace.log</file> | ||
151 | + <!--日志文件输出格式--> | ||
152 | + <encoder> | ||
153 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
154 | + <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||
155 | + </encoder> | ||
156 | + <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||
157 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
158 | + <fileNamePattern>${log.path}/trace/log-trace-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
159 | + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
160 | + <maxFileSize>100MB</maxFileSize> | ||
161 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
162 | + <!--日志文件保留天数--> | ||
163 | + <maxHistory>15</maxHistory> | ||
164 | + </rollingPolicy> | ||
165 | + <!-- 此日志文件只记录trace级别的 --> | ||
166 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
167 | + <level>TRACE</level> | ||
168 | + <onMatch>ACCEPT</onMatch> | ||
169 | + <onMismatch>DENY</onMismatch> | ||
170 | + </filter> | ||
171 | + </appender> | ||
172 | + | ||
173 | + | ||
174 | + <!-- | ||
175 | + <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 | ||
176 | + 以及指定<appender>。<logger>仅有一个name属性, | ||
177 | + 一个可选的level和一个可选的addtivity属性。 | ||
178 | + name:用来指定受此logger约束的某一个包或者具体的某一个类。 | ||
179 | + level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | ||
180 | + 还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 | ||
181 | + 如果未设置此属性,那么当前logger将会继承上级的级别。 | ||
182 | + addtivity:是否向上级logger传递打印信息。默认是true。 | ||
183 | + --> | ||
184 | + <!--<logger name="org.springframework.web" level="info"/>--> | ||
185 | + <!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>--> | ||
186 | + <!-- | ||
187 | + 使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: | ||
188 | + 第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 | ||
189 | + 第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: | ||
190 | + --> | ||
191 | + | ||
192 | + | ||
193 | + <!-- | ||
194 | + root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 | ||
195 | + level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | ||
196 | + 不能设置为INHERITED或者同义词NULL。默认是DEBUG | ||
197 | + 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 | ||
198 | + --> | ||
199 | + <!--<logger name="com.tianbo.analysis" level="trace">--> | ||
200 | + <!--<appender-ref ref="CONSOLE" />--> | ||
201 | + <!--<appender-ref ref="TRACE_FILE" />--> | ||
202 | + <!--<appender-ref ref="DEBUG_FILE" />--> | ||
203 | + <!--<appender-ref ref="INFO_FILE" />--> | ||
204 | + <!--<appender-ref ref="WARN_FILE" />--> | ||
205 | + <!--<appender-ref ref="ERROR_FILE" />--> | ||
206 | + <!--</logger>--> | ||
207 | + | ||
208 | + <!--开发环境:打印控制台--> | ||
209 | + <springProfile name="dev"> | ||
210 | + <logger name="org.springframework" level="info"/> | ||
211 | + <logger name="com.sunyo.wlpt.nmms.mapper" level="debug"> | ||
212 | + <appender-ref ref="CONSOLE" /> | ||
213 | + <appender-ref ref="DEBUG_FILE" /> | ||
214 | + </logger> | ||
215 | + <logger name="org.apache.tomcat" level="info" /> | ||
216 | + <root level="info"> | ||
217 | + <appender-ref ref="CONSOLE" /> | ||
218 | + <appender-ref ref="TRACE_FILE" /> | ||
219 | + <appender-ref ref="DEBUG_FILE" /> | ||
220 | + <appender-ref ref="INFO_FILE" /> | ||
221 | + <appender-ref ref="WARN_FILE" /> | ||
222 | + <appender-ref ref="ERROR_FILE" /> | ||
223 | + </root> | ||
224 | + </springProfile> | ||
225 | + | ||
226 | + <!--生产环境:输出到文件--> | ||
227 | + <springProfile name="pro"> | ||
228 | + <logger name="org.springframework" level="INFO"/> | ||
229 | + <root level="info"> | ||
230 | + <appender-ref ref="CONSOLE" /> | ||
231 | + <appender-ref ref="DEBUG_FILE" /> | ||
232 | + <appender-ref ref="INFO_FILE" /> | ||
233 | + <appender-ref ref="ERROR_FILE" /> | ||
234 | + <appender-ref ref="WARN_FILE" /> | ||
235 | + <appender-ref ref="TRACE_FILE" /> | ||
236 | + </root> | ||
237 | + </springProfile> | ||
238 | + | ||
239 | +</configuration> |
config/logback-spring.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<configuration scan="ture" scanPeriod="60 seconds" debug="false"> | ||
3 | + | ||
4 | + <springProperty scope="context" name="appname" source="logback.appname"/> | ||
5 | + <springProperty scope="context" name="logdir" source="logback.logdir"/> | ||
6 | + <!--文件名--> | ||
7 | + <contextName>${appname}</contextName> | ||
8 | + | ||
9 | + <!--输出到控制面板--> | ||
10 | + <appender name="consoleLog1" class="ch.qos.logback.core.ConsoleAppender"> | ||
11 | + <!-- layout输出方式输出--> | ||
12 | + <layout class="ch.qos.logback.classic.PatternLayout"> | ||
13 | + <pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
14 | + </layout> | ||
15 | + </appender> | ||
16 | + <!--输出到控制面板--> | ||
17 | + <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender"> | ||
18 | + <encoder> | ||
19 | + <pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
20 | + </encoder> | ||
21 | + </appender> | ||
22 | + <!--输出info级别日志--> | ||
23 | + <appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
24 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
25 | + <!--过滤 Error--> | ||
26 | + <level>ERROR</level> | ||
27 | + <!--匹配到就禁止--> | ||
28 | + <onMatch>DENY</onMatch> | ||
29 | + <!--没有匹配到就允许--> | ||
30 | + <onMismatch>ACCEPT</onMismatch> | ||
31 | + </filter> | ||
32 | + <!--<File>../logs</File>--> | ||
33 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
34 | + <FileNamePattern>${logdir}/info.${appname}.%d{yyyy-MM-dd}.log</FileNamePattern> | ||
35 | + <maxHistory>100</maxHistory> | ||
36 | + <totalSizeCap>100MB</totalSizeCap> | ||
37 | + </rollingPolicy> | ||
38 | + <encoder> | ||
39 | + <charset>UTF-8</charset> | ||
40 | + <pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</pattern> | ||
41 | + </encoder> | ||
42 | + </appender> | ||
43 | + <!--输出Error级别日志--> | ||
44 | + <!--<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">--> | ||
45 | + <!--<filter class="ch.qos.logback.classic.filter.LevelFilter">--> | ||
46 | + <!--<!–过滤 Error –>--> | ||
47 | + <!--<level>ERROR</level>--> | ||
48 | + <!--</filter>--> | ||
49 | + <!--<!–<File>../logs</File>–>--> | ||
50 | + <!--<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">--> | ||
51 | + <!--<FileNamePattern>${logdir}/error.${appname}.%d{yyyy-MM-dd}.log</FileNamePattern>--> | ||
52 | + <!--<maxHistory>100</maxHistory>--> | ||
53 | + <!--<totalSizeCap>100MB</totalSizeCap>--> | ||
54 | + <!--</rollingPolicy>--> | ||
55 | + <!--<encoder>--> | ||
56 | + <!--<charset>UTF-8</charset>--> | ||
57 | + <!--<pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</pattern>--> | ||
58 | + <!--</encoder>--> | ||
59 | + <!--</appender>--> | ||
60 | + <!--监控下列类的所有日志,定义输出级别--> | ||
61 | + <logger name="java.sql.PreparedStatement" level="DEBUG" additivity="false"> | ||
62 | + <appender-ref ref="consoleLog"/> | ||
63 | + </logger> | ||
64 | + <logger name="java.sql.Connection" level="DEBUG" additivity="false"> | ||
65 | + <appender-ref ref="consoleLog"/> | ||
66 | + </logger> | ||
67 | + <logger name="java.sql.Statement" level="DEBUG" additivity="false"> | ||
68 | + <appender-ref ref="consoleLog"/> | ||
69 | + </logger> | ||
70 | + <logger name="com.ibatis" level="DEBUG" additivity="false"> | ||
71 | + <appender-ref ref="consoleLog"/> | ||
72 | + </logger> | ||
73 | + <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" additivity="false"> | ||
74 | + <appender-ref ref="consoleLog"/> | ||
75 | + </logger> | ||
76 | + <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" additivity="false"> | ||
77 | + <appender-ref ref="consoleLog"/> | ||
78 | + </logger> | ||
79 | + <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" additivity="false"> | ||
80 | + <appender-ref ref="consoleLog"/> | ||
81 | + </logger> | ||
82 | + <!--输出--> | ||
83 | + <root level="INFO"> | ||
84 | + <appender-ref ref="consoleLog"/> | ||
85 | + <!--<appender-ref ref="consoleLog"/>--> | ||
86 | + <appender-ref ref="fileInfoLog"/> | ||
87 | + <!--<appender-ref ref="fileErrorLog"/>--> | ||
88 | + </root> | ||
89 | + | ||
90 | +</configuration> |
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + <parent> | ||
6 | + <groupId>org.springframework.boot</groupId> | ||
7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
8 | + <version>2.2.5.RELEASE</version> | ||
9 | + <relativePath/> | ||
10 | + </parent> | ||
11 | + <groupId>com.sunyo.wlpt.station.manage</groupId> | ||
12 | + <artifactId>station-manage</artifactId> | ||
13 | + <version>0.0.1-SNAPSHOT</version> | ||
14 | + <name>station-manage</name> | ||
15 | + <description>场站管理</description> | ||
16 | + | ||
17 | + | ||
18 | + <properties> | ||
19 | + <java.version>1.8</java.version> | ||
20 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
21 | + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
22 | + <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version> | ||
23 | + </properties> | ||
24 | + | ||
25 | + <dependencies> | ||
26 | + <!-- SpringBoot start --> | ||
27 | + <dependency> | ||
28 | + <groupId>org.springframework.boot</groupId> | ||
29 | + <artifactId>spring-boot-starter-web</artifactId> | ||
30 | + </dependency> | ||
31 | + | ||
32 | + <dependency> | ||
33 | + <groupId>org.springframework.boot</groupId> | ||
34 | + <artifactId>spring-boot-starter</artifactId> | ||
35 | + </dependency> | ||
36 | + | ||
37 | + <dependency> | ||
38 | + <groupId>org.springframework.boot</groupId> | ||
39 | + <artifactId>spring-boot-starter-security</artifactId> | ||
40 | + </dependency> | ||
41 | + <!-- SpringBoot end --> | ||
42 | + | ||
43 | + <!-- SpringCloud start --> | ||
44 | + <dependency> | ||
45 | + <groupId>org.springframework.cloud</groupId> | ||
46 | + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | ||
47 | + </dependency> | ||
48 | + | ||
49 | + <dependency> | ||
50 | + <groupId>org.springframework.cloud</groupId> | ||
51 | + <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> | ||
52 | + </dependency> | ||
53 | + | ||
54 | + <dependency> | ||
55 | + <groupId>org.springframework.cloud</groupId> | ||
56 | + <artifactId>spring-cloud-starter-openfeign</artifactId> | ||
57 | + </dependency> | ||
58 | + | ||
59 | + <dependency> | ||
60 | + <groupId>org.springframework.cloud</groupId> | ||
61 | + <artifactId>spring-cloud-starter-zipkin</artifactId> | ||
62 | + </dependency> | ||
63 | + | ||
64 | + <dependency> | ||
65 | + <groupId>de.codecentric</groupId> | ||
66 | + <artifactId>spring-boot-admin-starter-client</artifactId> | ||
67 | + <version>2.2.0</version> | ||
68 | + </dependency> | ||
69 | + | ||
70 | + <dependency> | ||
71 | + <groupId>org.springframework.boot</groupId> | ||
72 | + <artifactId>spring-boot-starter-actuator</artifactId> | ||
73 | + </dependency> | ||
74 | + <!-- SpringCloud end --> | ||
75 | + <!-- database start --> | ||
76 | + <!-- <dependency>--> | ||
77 | + <!-- <groupId>org.springframework.boot</groupId>--> | ||
78 | + <!-- <artifactId>spring-boot-starter-data-redis</artifactId>--> | ||
79 | + <!-- </dependency>--> | ||
80 | + | ||
81 | + <dependency> | ||
82 | + <groupId>org.mybatis.spring.boot</groupId> | ||
83 | + <artifactId>mybatis-spring-boot-starter</artifactId> | ||
84 | + <version>2.1.1</version> | ||
85 | + </dependency> | ||
86 | + | ||
87 | + <dependency> | ||
88 | + <groupId>mysql</groupId> | ||
89 | + <artifactId>mysql-connector-java</artifactId> | ||
90 | + <scope>runtime</scope> | ||
91 | + </dependency> | ||
92 | + | ||
93 | + <dependency> | ||
94 | + <groupId>com.github.pagehelper</groupId> | ||
95 | + <artifactId>pagehelper-spring-boot-starter</artifactId> | ||
96 | + <version>1.2.12</version> | ||
97 | + </dependency> | ||
98 | + | ||
99 | + <dependency> | ||
100 | + <groupId>com.alibaba</groupId> | ||
101 | + <artifactId>druid-spring-boot-starter</artifactId> | ||
102 | + <version>1.1.9</version> | ||
103 | + </dependency> | ||
104 | + <!-- database end --> | ||
105 | + <!-- tools start --> | ||
106 | + <dependency> | ||
107 | + <groupId>org.projectlombok</groupId> | ||
108 | + <artifactId>lombok</artifactId> | ||
109 | + <optional>true</optional> | ||
110 | + </dependency> | ||
111 | + | ||
112 | + <dependency> | ||
113 | + <groupId>com.google.guava</groupId> | ||
114 | + <artifactId>guava</artifactId> | ||
115 | + <version>29.0-jre</version> | ||
116 | + </dependency> | ||
117 | + | ||
118 | + <dependency> | ||
119 | + <groupId>org.springframework.boot</groupId> | ||
120 | + <artifactId>spring-boot-configuration-processor</artifactId> | ||
121 | + <optional>true</optional> | ||
122 | + </dependency> | ||
123 | + | ||
124 | + <dependency> | ||
125 | + <groupId>log4j</groupId> | ||
126 | + <artifactId>log4j</artifactId> | ||
127 | + <version>1.2.17</version> | ||
128 | + </dependency> | ||
129 | + | ||
130 | + <dependency> | ||
131 | + <groupId>io.springfox</groupId> | ||
132 | + <artifactId>springfox-swagger2</artifactId> | ||
133 | + <version>2.9.2</version> | ||
134 | + </dependency> | ||
135 | + | ||
136 | + <dependency> | ||
137 | + <groupId>com.github.xiaoymin</groupId> | ||
138 | + <artifactId>swagger-bootstrap-ui</artifactId> | ||
139 | + <version>1.9.6</version> | ||
140 | + </dependency> | ||
141 | + | ||
142 | + <dependency> | ||
143 | + <groupId>joda-time</groupId> | ||
144 | + <artifactId>joda-time</artifactId> | ||
145 | + <version>2.10.5</version> | ||
146 | + </dependency> | ||
147 | + | ||
148 | + <dependency> | ||
149 | + <groupId>org.apache.commons</groupId> | ||
150 | + <artifactId>commons-lang3</artifactId> | ||
151 | + <version>3.9</version> | ||
152 | + </dependency> | ||
153 | + | ||
154 | + <dependency> | ||
155 | + <groupId>org.apache.commons</groupId> | ||
156 | + <artifactId>commons-pool2</artifactId> | ||
157 | + </dependency> | ||
158 | + </dependencies> | ||
159 | + | ||
160 | + <dependencyManagement> | ||
161 | + <dependencies> | ||
162 | + <dependency> | ||
163 | + <groupId>org.springframework.cloud</groupId> | ||
164 | + <artifactId>spring-cloud-dependencies</artifactId> | ||
165 | + <version>${spring-cloud.version}</version> | ||
166 | + <type>pom</type> | ||
167 | + <scope>import</scope> | ||
168 | + </dependency> | ||
169 | + </dependencies> | ||
170 | + </dependencyManagement> | ||
171 | + | ||
172 | + <build> | ||
173 | + <plugins> | ||
174 | + <plugin> | ||
175 | + <groupId>org.apache.maven.plugins</groupId> | ||
176 | + <artifactId>maven-compiler-plugin</artifactId> | ||
177 | + <configuration> | ||
178 | + <source>1.8</source> | ||
179 | + <target>1.8</target> | ||
180 | + <encoding>UTF-8</encoding> | ||
181 | + </configuration> | ||
182 | + </plugin> | ||
183 | + <plugin> | ||
184 | + <groupId>org.springframework.boot</groupId> | ||
185 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
186 | + </plugin> | ||
187 | + </plugins> | ||
188 | + </build> | ||
189 | + | ||
190 | + <repositories> | ||
191 | + <repository> | ||
192 | + <id>spring-milestone</id> | ||
193 | + <name>Spring Milestone</name> | ||
194 | + <url>https://repo.spring.io/milestone</url> | ||
195 | + <snapshots> | ||
196 | + <enabled>false</enabled> | ||
197 | + </snapshots> | ||
198 | + </repository> | ||
199 | + <repository> | ||
200 | + <id>spring-snapshot</id> | ||
201 | + <name>Spring Snapshot</name> | ||
202 | + <url>https://repo.spring.io/snapshot</url> | ||
203 | + <snapshots> | ||
204 | + <enabled>true</enabled> | ||
205 | + </snapshots> | ||
206 | + </repository> | ||
207 | + </repositories> | ||
208 | + | ||
209 | + <pluginRepositories> | ||
210 | + <pluginRepository> | ||
211 | + <id>spring-milestone</id> | ||
212 | + <name>Spring Milestone</name> | ||
213 | + <url>https://repo.spring.io/milestone</url> | ||
214 | + <snapshots> | ||
215 | + <enabled>false</enabled> | ||
216 | + </snapshots> | ||
217 | + </pluginRepository> | ||
218 | + | ||
219 | + <pluginRepository> | ||
220 | + <id>spring-snapshot</id> | ||
221 | + <name>Spring Snapshot</name> | ||
222 | + <url>https://repo.spring.io/snapshot</url> | ||
223 | + <snapshots> | ||
224 | + <enabled>true</enabled> | ||
225 | + </snapshots> | ||
226 | + </pluginRepository> | ||
227 | + </pluginRepositories> | ||
228 | + | ||
229 | +</project> |
1 | +package com.sunyo.wlpt.station.manage; | ||
2 | + | ||
3 | +import org.mybatis.spring.annotation.MapperScan; | ||
4 | +import org.springframework.boot.SpringApplication; | ||
5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
6 | +import org.springframework.cache.annotation.EnableCaching; | ||
7 | +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | ||
8 | +import org.springframework.cloud.openfeign.EnableFeignClients; | ||
9 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author 子诚 | ||
13 | + */ | ||
14 | +@EnableCaching | ||
15 | +@SpringBootApplication | ||
16 | +@MapperScan("com.sunyo.wlpt.station.manage.mapper") | ||
17 | +@EnableFeignClients | ||
18 | +@EnableEurekaClient | ||
19 | +@EnableTransactionManagement | ||
20 | +public class StationManageApplication { | ||
21 | + | ||
22 | + public static void main(String[] args) | ||
23 | + { | ||
24 | + SpringApplication.run(StationManageApplication.class, args); | ||
25 | + } | ||
26 | + | ||
27 | +} |
1 | +package com.sunyo.wlpt.station.manage.config; | ||
2 | + | ||
3 | +import org.springframework.context.annotation.Configuration; | ||
4 | +import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
5 | +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
6 | +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description:SpringSecurity 权限配置框架 | ||
11 | + * 时间:2020/7/5 13:38 | ||
12 | + */ | ||
13 | +@EnableWebSecurity | ||
14 | +@Configuration | ||
15 | +public class SecurityConfig extends WebSecurityConfigurerAdapter { | ||
16 | + @Override | ||
17 | + protected void configure(HttpSecurity http) throws Exception { | ||
18 | + http.csrf().disable(); | ||
19 | + } | ||
20 | +} |
1 | +package com.sunyo.wlpt.station.manage.config; | ||
2 | + | ||
3 | +import org.springframework.context.annotation.Bean; | ||
4 | +import org.springframework.context.annotation.Configuration; | ||
5 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
6 | +import springfox.documentation.builders.PathSelectors; | ||
7 | +import springfox.documentation.builders.RequestHandlerSelectors; | ||
8 | +import springfox.documentation.service.ApiInfo; | ||
9 | +import springfox.documentation.spi.DocumentationType; | ||
10 | +import springfox.documentation.spring.web.plugins.Docket; | ||
11 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author 子诚 | ||
15 | + * Description:swagger-knife4j 的配置文件 | ||
16 | + * 时间:2020/7/10 11:48 | ||
17 | + */ | ||
18 | +@Configuration | ||
19 | +@EnableSwagger2 | ||
20 | +public class SwaggerConfig { | ||
21 | + @Bean | ||
22 | + public Docket createRestApi() | ||
23 | + { | ||
24 | + return new Docket(DocumentationType.SWAGGER_2) | ||
25 | + .apiInfo(apiInfo()) | ||
26 | + .select() | ||
27 | + .apis(RequestHandlerSelectors.basePackage("com.sunyo.wlpt.station.manage.controller")) | ||
28 | + .paths(PathSelectors.any()) | ||
29 | + .build(); | ||
30 | + } | ||
31 | + | ||
32 | + private ApiInfo apiInfo() | ||
33 | + { | ||
34 | + return new ApiInfoBuilder() | ||
35 | + .title("场站管理服务") | ||
36 | + .description("场站管理服务") | ||
37 | + .termsOfServiceUrl("http://localhost:9111/") | ||
38 | + .contact("子诚") | ||
39 | + .version("1.0.0") | ||
40 | + .build(); | ||
41 | + } | ||
42 | +} |
1 | +package com.sunyo.wlpt.station.manage.controller; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
4 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
5 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
6 | +import com.sunyo.wlpt.station.manage.service.BayonetService; | ||
7 | +import io.swagger.annotations.Api; | ||
8 | +import io.swagger.annotations.ApiOperation; | ||
9 | +import org.springframework.web.bind.annotation.*; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author 子诚 | ||
15 | + * Description:卡口信息,控制器 | ||
16 | + * 时间:2020/10/12 14:23 | ||
17 | + */ | ||
18 | +@Api(tags = "卡口信息,控制器") | ||
19 | +@CrossOrigin | ||
20 | +@RequestMapping("bayonet") | ||
21 | +@RestController | ||
22 | +public class BayonetController { | ||
23 | + @Resource | ||
24 | + private BayonetService bayonetService; | ||
25 | + | ||
26 | + /** | ||
27 | + * 分页查询 | ||
28 | + * @param stationName 场站名称 | ||
29 | + * @param name 卡口名称 | ||
30 | + * @param channel 通道编号 | ||
31 | + * @param pageNum 当前页数 | ||
32 | + * @param pageSize 每页数量 | ||
33 | + * @return | ||
34 | + */ | ||
35 | + @ApiOperation(value = "卡口信息,分页查询") | ||
36 | + @GetMapping("/page") | ||
37 | + public ResultJson selectListByPage(@RequestParam(value = "stationName", required = false) String stationName, | ||
38 | + @RequestParam(value = "name", required = false) String name, | ||
39 | + @RequestParam(value = "channel", required = false) String channel, | ||
40 | + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | ||
41 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) | ||
42 | + { | ||
43 | + Bayonet bayonet = Bayonet.builder() | ||
44 | + .stationName(stationName) | ||
45 | + .name(name).channel(channel) | ||
46 | + .build(); | ||
47 | + return bayonetService.selectListByPage(bayonet, pageNum, pageSize); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 删除 | ||
52 | + * 条件:id | ||
53 | + * | ||
54 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
55 | + * @return | ||
56 | + */ | ||
57 | + @ApiOperation(value = "卡口信息,删除") | ||
58 | + @DeleteMapping("/delete") | ||
59 | + public ResultJson deleteBayonet(@RequestBody Bayonet bayonet) | ||
60 | + { | ||
61 | + return bayonetService.deleteByPrimaryKey(bayonet.getId()); | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * 新增 | ||
66 | + * | ||
67 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
68 | + * @return 成功 or 失败 | ||
69 | + */ | ||
70 | + @ApiOperation(value = "卡口信息,增加") | ||
71 | + @PostMapping("/insert") | ||
72 | + public ResultJson insertBayonet(@RequestBody Bayonet bayonet) | ||
73 | + { | ||
74 | + return bayonetService.insertSelective(bayonet); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 修改 or 编辑 | ||
79 | + * | ||
80 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
81 | + * @return 成功 or 失败 | ||
82 | + */ | ||
83 | + @ApiOperation(value = "卡口信息,编辑") | ||
84 | + @PutMapping("/update") | ||
85 | + public ResultJson updateBayonet(@RequestBody Bayonet bayonet) | ||
86 | + { | ||
87 | + return bayonetService.updateByPrimaryKeySelective(bayonet); | ||
88 | + } | ||
89 | +} |
1 | +package com.sunyo.wlpt.station.manage.controller; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
4 | +import com.sunyo.wlpt.station.manage.domain.Warehouse; | ||
5 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
6 | +import com.sunyo.wlpt.station.manage.service.WarehouseService; | ||
7 | +import io.swagger.annotations.Api; | ||
8 | +import io.swagger.annotations.ApiOperation; | ||
9 | +import org.springframework.web.bind.annotation.*; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author 子诚 | ||
15 | + * Description:仓库信息,控制器 | ||
16 | + * 时间:2020/10/12 15:32 | ||
17 | + */ | ||
18 | +@Api(tags = "仓库信息,控制器") | ||
19 | +@CrossOrigin | ||
20 | +@RequestMapping("warehouse") | ||
21 | +@RestController | ||
22 | +public class WarehouseController { | ||
23 | + | ||
24 | + @Resource | ||
25 | + private WarehouseService warehouseService; | ||
26 | + | ||
27 | + /** | ||
28 | + * 分页查询 | ||
29 | + * | ||
30 | + * @param stationName 场站名称 | ||
31 | + * @param name 仓库名称 | ||
32 | + * @param pageNum 当前页数 | ||
33 | + * @param pageSize 每页数量 | ||
34 | + * @return | ||
35 | + */ | ||
36 | + @ApiOperation(value = "仓库信息,分页查询") | ||
37 | + @GetMapping("/page") | ||
38 | + public ResultJson selectListByPage(@RequestParam(value = "stationName", required = false) String stationName, | ||
39 | + @RequestParam(value = "name", required = false) String name, | ||
40 | + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | ||
41 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) | ||
42 | + { | ||
43 | + Warehouse warehouse = Warehouse.builder().name(name).stationName(stationName).build(); | ||
44 | + return warehouseService.selectListByPage(warehouse, pageNum, pageSize); | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + /** | ||
49 | + * 删除 | ||
50 | + * 条件:id | ||
51 | + * | ||
52 | + * @param warehouse 仓库信息 {@link Warehouse} | ||
53 | + * @return | ||
54 | + */ | ||
55 | + @ApiOperation(value = "仓库信息,删除") | ||
56 | + @DeleteMapping("/delete") | ||
57 | + public ResultJson deleteWarehouse(@RequestBody Warehouse warehouse) | ||
58 | + { | ||
59 | + return warehouseService.deleteByPrimaryKey(warehouse.getId()); | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 新增 | ||
64 | + * | ||
65 | + * @param warehouse 仓库信息 {@link Warehouse} | ||
66 | + * @return 成功 or 失败 | ||
67 | + */ | ||
68 | + @ApiOperation(value = "仓库信息,增加") | ||
69 | + @PostMapping("/insert") | ||
70 | + public ResultJson insertWarehouse(@RequestBody Warehouse warehouse) | ||
71 | + { | ||
72 | + return warehouseService.insertSelective(warehouse); | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * 修改 or 编辑 | ||
77 | + * | ||
78 | + * @param warehouse 仓库信息 {@link Warehouse} | ||
79 | + * @return 成功 or 失败 | ||
80 | + */ | ||
81 | + @ApiOperation(value = "仓库信息,编辑") | ||
82 | + @PutMapping("/update") | ||
83 | + public ResultJson updateWarehouse(@RequestBody Warehouse warehouse) | ||
84 | + { | ||
85 | + return warehouseService.updateByPrimaryKeySelective(warehouse); | ||
86 | + } | ||
87 | +} |
1 | +package com.sunyo.wlpt.station.manage.controller; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
4 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
5 | +import com.sunyo.wlpt.station.manage.service.YardService; | ||
6 | +import io.swagger.annotations.Api; | ||
7 | +import io.swagger.annotations.ApiOperation; | ||
8 | +import org.springframework.web.bind.annotation.*; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author 子诚 | ||
14 | + * Description: | ||
15 | + * 时间:2020/10/12 12:06 | ||
16 | + */ | ||
17 | +@Api(tags = "场站信息,控制器") | ||
18 | +@CrossOrigin | ||
19 | +@RequestMapping("yard") | ||
20 | +@RestController | ||
21 | +public class YardController { | ||
22 | + | ||
23 | + @Resource | ||
24 | + private YardService yardService; | ||
25 | + | ||
26 | + /** | ||
27 | + * 分页查询 | ||
28 | + * | ||
29 | + * @param name 场站名称 | ||
30 | + * @param customsCode 关区代码 | ||
31 | + * @param pageNum 当前页数 | ||
32 | + * @param pageSize 每页大小 | ||
33 | + * @return | ||
34 | + */ | ||
35 | + @ApiOperation(value = "场站信息,分页查询") | ||
36 | + @GetMapping("/page") | ||
37 | + public ResultJson selectListByPage(@RequestParam(value = "name", required = false) String name, | ||
38 | + @RequestParam(value = "customsCode", required = false) Integer customsCode, | ||
39 | + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | ||
40 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) | ||
41 | + { | ||
42 | + Yard yard = Yard.builder().name(name).customsCode(customsCode).build(); | ||
43 | + return yardService.selectListByPage(yard, pageNum, pageSize); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * 删除 | ||
48 | + * 条件:id | ||
49 | + * | ||
50 | + * @param yard 场站信息 {@link Yard} | ||
51 | + * @return | ||
52 | + */ | ||
53 | + @ApiOperation(value = "场站信息,删除") | ||
54 | + @DeleteMapping("/delete") | ||
55 | + public ResultJson deleteYard(@RequestBody Yard yard) | ||
56 | + { | ||
57 | + return yardService.deleteByPrimaryKey(yard.getId()); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 新增 | ||
62 | + * | ||
63 | + * @param yard 场站信息 {@link Yard} | ||
64 | + * @return 成功 or 失败 | ||
65 | + */ | ||
66 | + @ApiOperation(value = "场站信息,增加") | ||
67 | + @PostMapping("/insert") | ||
68 | + public ResultJson insertYard(@RequestBody Yard yard) | ||
69 | + { | ||
70 | + return yardService.insertSelective(yard); | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * 修改 or 编辑 | ||
75 | + * | ||
76 | + * @param yard 场站信息 {@link Yard} | ||
77 | + * @return 成功 or 失败 | ||
78 | + */ | ||
79 | + @ApiOperation(value = "场站信息,编辑") | ||
80 | + @PutMapping("/update") | ||
81 | + public ResultJson updateYard(@RequestBody Yard yard) | ||
82 | + { | ||
83 | + return yardService.updateByPrimaryKeySelective(yard); | ||
84 | + } | ||
85 | +} |
1 | +package com.sunyo.wlpt.station.manage.domain; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModel; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +import lombok.AllArgsConstructor; | ||
10 | +import lombok.Builder; | ||
11 | +import lombok.Data; | ||
12 | +import lombok.NoArgsConstructor; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author 子诚 | ||
16 | + * Description:卡口静态资源表 | ||
17 | + * 时间:2020/10/12 11:56 | ||
18 | + */ | ||
19 | +@ApiModel(value = "卡口静态资源表") | ||
20 | +@Data | ||
21 | +@Builder | ||
22 | +@AllArgsConstructor | ||
23 | +@NoArgsConstructor | ||
24 | +public class Bayonet implements Serializable { | ||
25 | + | ||
26 | + private static final long serialVersionUID = -4051552282588726036L; | ||
27 | + | ||
28 | + /** | ||
29 | + * ID | ||
30 | + */ | ||
31 | + @ApiModelProperty(value = "ID") | ||
32 | + private String id; | ||
33 | + | ||
34 | + /** | ||
35 | + * 场站ID_父ID | ||
36 | + */ | ||
37 | + @ApiModelProperty(value = "场站ID_父ID") | ||
38 | + private String yardId; | ||
39 | + | ||
40 | + /** | ||
41 | + * 卡口名称 | ||
42 | + */ | ||
43 | + @ApiModelProperty(value = "卡口名称") | ||
44 | + private String name; | ||
45 | + | ||
46 | + /** | ||
47 | + * 通道编号 | ||
48 | + */ | ||
49 | + @ApiModelProperty(value = "通道编号") | ||
50 | + private String channel; | ||
51 | + | ||
52 | + /** | ||
53 | + * 卡口类型:1是进、2是出、3是进出共用 | ||
54 | + */ | ||
55 | + @ApiModelProperty(value = "卡口类型:1是进、2是出、3是进出共用") | ||
56 | + private String type; | ||
57 | + | ||
58 | + /** | ||
59 | + * 创建者 | ||
60 | + */ | ||
61 | + @ApiModelProperty(value = "创建者") | ||
62 | + private String createBy; | ||
63 | + | ||
64 | + /** | ||
65 | + * 创建时间 | ||
66 | + */ | ||
67 | + @ApiModelProperty(value = "创建时间") | ||
68 | + private Date createDate; | ||
69 | + | ||
70 | + /** | ||
71 | + * 更新者 | ||
72 | + */ | ||
73 | + @ApiModelProperty(value = "更新者") | ||
74 | + private String updateBy; | ||
75 | + | ||
76 | + /** | ||
77 | + * 更新时间 | ||
78 | + */ | ||
79 | + @ApiModelProperty(value = "更新时间") | ||
80 | + private Date updateDate; | ||
81 | + | ||
82 | + /** | ||
83 | + * 备注信息 | ||
84 | + */ | ||
85 | + @ApiModelProperty(value = "备注信息") | ||
86 | + private String remarks; | ||
87 | + | ||
88 | + /** | ||
89 | + * 删除标记 | ||
90 | + */ | ||
91 | + @ApiModelProperty(value = "删除标记") | ||
92 | + private String delFlag; | ||
93 | + | ||
94 | + /** | ||
95 | + * 场站名称(表中没有该字段,为查询方便,特意添加) | ||
96 | + */ | ||
97 | + @ApiModelProperty(value = "场站名称") | ||
98 | + private String stationName; | ||
99 | + | ||
100 | + /** | ||
101 | + * 场站与卡口的关系 1:n | ||
102 | + * <p> | ||
103 | + * 一个卡口,对应一个场站 | ||
104 | + */ | ||
105 | + private Yard yard; | ||
106 | +} |
1 | +package com.sunyo.wlpt.station.manage.domain; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModel; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.math.BigDecimal; | ||
8 | +import java.util.Date; | ||
9 | + | ||
10 | +import lombok.AllArgsConstructor; | ||
11 | +import lombok.Builder; | ||
12 | +import lombok.Data; | ||
13 | +import lombok.NoArgsConstructor; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author 子诚 | ||
17 | + * Description:仓库静态资源表 | ||
18 | + * 时间:2020/10/12 12:00 | ||
19 | + */ | ||
20 | +@ApiModel(value = "仓库静态资源表") | ||
21 | +@Data | ||
22 | +@Builder | ||
23 | +@AllArgsConstructor | ||
24 | +@NoArgsConstructor | ||
25 | +public class Warehouse implements Serializable { | ||
26 | + | ||
27 | + private static final long serialVersionUID = 7237627901812899555L; | ||
28 | + | ||
29 | + /** | ||
30 | + * ID | ||
31 | + */ | ||
32 | + @ApiModelProperty(value = "ID") | ||
33 | + private String id; | ||
34 | + | ||
35 | + /** | ||
36 | + * 场站ID_父ID | ||
37 | + */ | ||
38 | + @ApiModelProperty(value = "场站ID_父ID") | ||
39 | + private String yardId; | ||
40 | + | ||
41 | + /** | ||
42 | + * 仓库编码 | ||
43 | + */ | ||
44 | + @ApiModelProperty(value = "仓库编码") | ||
45 | + private String copCode; | ||
46 | + | ||
47 | + /** | ||
48 | + * 仓库名称 | ||
49 | + */ | ||
50 | + @ApiModelProperty(value = "仓库名称") | ||
51 | + private String name; | ||
52 | + | ||
53 | + /** | ||
54 | + * 仓库长度 | ||
55 | + */ | ||
56 | + @ApiModelProperty(value = "仓库长度") | ||
57 | + private BigDecimal length; | ||
58 | + | ||
59 | + /** | ||
60 | + * 仓库宽度 | ||
61 | + */ | ||
62 | + @ApiModelProperty(value = "仓库宽度") | ||
63 | + private BigDecimal width; | ||
64 | + | ||
65 | + /** | ||
66 | + * 仓库面积 | ||
67 | + */ | ||
68 | + @ApiModelProperty(value = "仓库面积") | ||
69 | + private BigDecimal area; | ||
70 | + | ||
71 | + /** | ||
72 | + * 创建者 | ||
73 | + */ | ||
74 | + @ApiModelProperty(value = "创建者") | ||
75 | + private String createBy; | ||
76 | + | ||
77 | + /** | ||
78 | + * 创建时间 | ||
79 | + */ | ||
80 | + @ApiModelProperty(value = "创建时间") | ||
81 | + private Date createDate; | ||
82 | + | ||
83 | + /** | ||
84 | + * 更新者 | ||
85 | + */ | ||
86 | + @ApiModelProperty(value = "更新者") | ||
87 | + private String updateBy; | ||
88 | + | ||
89 | + /** | ||
90 | + * 更新时间 | ||
91 | + */ | ||
92 | + @ApiModelProperty(value = "更新时间") | ||
93 | + private Date updateDate; | ||
94 | + | ||
95 | + /** | ||
96 | + * 备注信息 | ||
97 | + */ | ||
98 | + @ApiModelProperty(value = "备注信息") | ||
99 | + private String remarks; | ||
100 | + | ||
101 | + /** | ||
102 | + * 删除标记 | ||
103 | + */ | ||
104 | + @ApiModelProperty(value = "删除标记") | ||
105 | + private String delFlag; | ||
106 | + | ||
107 | + /** | ||
108 | + * 场站名称(表中没有该字段,为查询方便,特意添加) | ||
109 | + */ | ||
110 | + @ApiModelProperty(value = "场站名称") | ||
111 | + private String stationName; | ||
112 | + | ||
113 | + /** | ||
114 | + * 场站与仓库的关系 1:n | ||
115 | + * <p> | ||
116 | + * 一个仓库,对应一个场站 | ||
117 | + */ | ||
118 | + private Yard yard; | ||
119 | +} |
1 | +package com.sunyo.wlpt.station.manage.domain; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModel; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.Date; | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +import lombok.AllArgsConstructor; | ||
11 | +import lombok.Builder; | ||
12 | +import lombok.Data; | ||
13 | +import lombok.NoArgsConstructor; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author 子诚 | ||
17 | + * Description:场站静态资源表 | ||
18 | + * 时间:2020/10/12 11:52 | ||
19 | + */ | ||
20 | +@ApiModel(value = "场站静态资源表") | ||
21 | +@Data | ||
22 | +@Builder | ||
23 | +@AllArgsConstructor | ||
24 | +@NoArgsConstructor | ||
25 | +public class Yard implements Serializable { | ||
26 | + | ||
27 | + private static final long serialVersionUID = -5446527862823094064L; | ||
28 | + | ||
29 | + /** | ||
30 | + * ID | ||
31 | + */ | ||
32 | + @ApiModelProperty(value = "ID") | ||
33 | + private String id; | ||
34 | + | ||
35 | + /** | ||
36 | + * 区域代码 | ||
37 | + */ | ||
38 | + @ApiModelProperty(value = "区域代码") | ||
39 | + private String areaCode; | ||
40 | + | ||
41 | + /** | ||
42 | + * 场站ID | ||
43 | + */ | ||
44 | + @ApiModelProperty(value = "场站ID") | ||
45 | + private String stationId; | ||
46 | + | ||
47 | + /** | ||
48 | + * 场站名称 | ||
49 | + */ | ||
50 | + @ApiModelProperty(value = "场站名称") | ||
51 | + private String name; | ||
52 | + | ||
53 | + /** | ||
54 | + * 关区代码 | ||
55 | + */ | ||
56 | + @ApiModelProperty(value = "关区代码") | ||
57 | + private Integer customsCode; | ||
58 | + | ||
59 | + /** | ||
60 | + * 所属组织机构 | ||
61 | + */ | ||
62 | + @ApiModelProperty(value = "所属组织机构") | ||
63 | + private String orgId; | ||
64 | + | ||
65 | + /** | ||
66 | + * 创建者 | ||
67 | + */ | ||
68 | + @ApiModelProperty(value = "创建者") | ||
69 | + private String createBy; | ||
70 | + | ||
71 | + /** | ||
72 | + * 创建时间 | ||
73 | + */ | ||
74 | + @ApiModelProperty(value = "创建时间") | ||
75 | + private Date createDate; | ||
76 | + | ||
77 | + /** | ||
78 | + * 更新者 | ||
79 | + */ | ||
80 | + @ApiModelProperty(value = "更新者") | ||
81 | + private String updateBy; | ||
82 | + | ||
83 | + /** | ||
84 | + * 更新时间 | ||
85 | + */ | ||
86 | + @ApiModelProperty(value = "更新时间") | ||
87 | + private Date updateDate; | ||
88 | + | ||
89 | + /** | ||
90 | + * 备注信息 | ||
91 | + */ | ||
92 | + @ApiModelProperty(value = "备注信息") | ||
93 | + private String remarks; | ||
94 | + | ||
95 | + /** | ||
96 | + * 删除标记 | ||
97 | + */ | ||
98 | + @ApiModelProperty(value = "删除标记") | ||
99 | + private String delFlag; | ||
100 | + | ||
101 | + /** | ||
102 | + * 场站与卡口的关系 1:n | ||
103 | + * 一个场站对应多个卡口 | ||
104 | + */ | ||
105 | + private List<Bayonet> Bayonets; | ||
106 | + | ||
107 | + /** | ||
108 | + * 场站与仓库的关系 1:n | ||
109 | + * 一个场站对应多个仓库 | ||
110 | + */ | ||
111 | + private List<Warehouse> warehouses; | ||
112 | +} |
1 | +package com.sunyo.wlpt.station.manage.exception; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author 子诚 | ||
5 | + * Description: | ||
6 | + * 时间:2020/7/17 16:43 | ||
7 | + */ | ||
8 | +public class CustomException extends RuntimeException { | ||
9 | + | ||
10 | + private static final long serialVersionUID = 6098063244016154220L; | ||
11 | + | ||
12 | + /** | ||
13 | + * 异常错误编码 | ||
14 | + */ | ||
15 | + private String code; | ||
16 | + | ||
17 | + /** | ||
18 | + * 异常信息 | ||
19 | + */ | ||
20 | + private String message; | ||
21 | + | ||
22 | + public CustomException(CustomExceptionType exceptionTypeEnum, String message) | ||
23 | + { | ||
24 | + this.code = exceptionTypeEnum.getCode(); | ||
25 | + this.message = message; | ||
26 | + } | ||
27 | + | ||
28 | + public CustomException(String code, String message) | ||
29 | + { | ||
30 | + this.code = code; | ||
31 | + this.message = message; | ||
32 | + } | ||
33 | + | ||
34 | + public CustomException(CustomExceptionType exceptionTypeEnum) | ||
35 | + { | ||
36 | + this.code = exceptionTypeEnum.getCode(); | ||
37 | + this.message = exceptionTypeEnum.getMsg(); | ||
38 | + } | ||
39 | + | ||
40 | + public String getCode() | ||
41 | + { | ||
42 | + return code; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public String getMessage() | ||
47 | + { | ||
48 | + return message; | ||
49 | + } | ||
50 | + | ||
51 | +} |
1 | +package com.sunyo.wlpt.station.manage.exception; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author 子诚 | ||
5 | + * Description:枚举,定制异常类型 | ||
6 | + * 时间:2020/7/17 16:27 | ||
7 | + */ | ||
8 | + | ||
9 | +public enum CustomExceptionType { | ||
10 | + | ||
11 | + CLIENT_ERROR("400", "客户端异常"), | ||
12 | + SYSTEM_ERROR("500", "系统服务异常"), | ||
13 | + OTHER_ERROR("999", "其他未知异常"); | ||
14 | + | ||
15 | + /** | ||
16 | + * 响应业务状态 | ||
17 | + */ | ||
18 | + private String code; | ||
19 | + /** | ||
20 | + * 响应消息 | ||
21 | + */ | ||
22 | + private String msg; | ||
23 | + | ||
24 | + CustomExceptionType(String code, String msg) | ||
25 | + { | ||
26 | + this.code = code; | ||
27 | + this.msg = msg; | ||
28 | + } | ||
29 | + | ||
30 | + public String getCode() | ||
31 | + { | ||
32 | + return code; | ||
33 | + } | ||
34 | + | ||
35 | + public String getMsg() | ||
36 | + { | ||
37 | + return msg; | ||
38 | + } | ||
39 | + | ||
40 | +} |
1 | +package com.sunyo.wlpt.station.manage.exception; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
4 | +import org.slf4j.Logger; | ||
5 | +import org.slf4j.LoggerFactory; | ||
6 | +import org.springframework.web.bind.annotation.ControllerAdvice; | ||
7 | +import org.springframework.web.bind.annotation.ExceptionHandler; | ||
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author 子诚 | ||
12 | + * Description:自定义全局异常处理类 | ||
13 | + * 时间:2020/7/17 17:44 | ||
14 | + */ | ||
15 | +@ControllerAdvice | ||
16 | +public class GlobalExceptionHandler { | ||
17 | + private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class); | ||
18 | + | ||
19 | + @ExceptionHandler(CustomException.class) | ||
20 | + @ResponseBody | ||
21 | + public ResultJson customerException(CustomException e) | ||
22 | + { | ||
23 | + if (e.getCode() == CustomExceptionType.SYSTEM_ERROR.getCode()) { | ||
24 | + //TODO 将异常信息持久化,or 打印日志 | ||
25 | + logger.error(""); | ||
26 | + } | ||
27 | + return ResultJson.error(e); | ||
28 | + } | ||
29 | +} |
1 | +package com.sunyo.wlpt.station.manage.mapper; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/10/12 11:56 | ||
12 | + */ | ||
13 | +@Mapper | ||
14 | +public interface BayonetMapper { | ||
15 | + /** | ||
16 | + * delete by primary key | ||
17 | + * | ||
18 | + * @param id primaryKey | ||
19 | + * @return deleteCount | ||
20 | + */ | ||
21 | + int deleteByPrimaryKey(String id); | ||
22 | + | ||
23 | + /** | ||
24 | + * insert record to table | ||
25 | + * | ||
26 | + * @param record the record | ||
27 | + * @return insert count | ||
28 | + */ | ||
29 | + int insert(Bayonet record); | ||
30 | + | ||
31 | + /** | ||
32 | + * insert record to table selective | ||
33 | + * | ||
34 | + * @param record the record | ||
35 | + * @return insert count | ||
36 | + */ | ||
37 | + int insertSelective(Bayonet record); | ||
38 | + | ||
39 | + /** | ||
40 | + * select by primary key | ||
41 | + * | ||
42 | + * @param id primary key | ||
43 | + * @return object by primary key | ||
44 | + */ | ||
45 | + Bayonet selectByPrimaryKey(String id); | ||
46 | + | ||
47 | + /** | ||
48 | + * update record selective | ||
49 | + * | ||
50 | + * @param record the updated record | ||
51 | + * @return update count | ||
52 | + */ | ||
53 | + int updateByPrimaryKeySelective(Bayonet record); | ||
54 | + | ||
55 | + /** | ||
56 | + * update record | ||
57 | + * | ||
58 | + * @param record the updated record | ||
59 | + * @return update count | ||
60 | + */ | ||
61 | + int updateByPrimaryKey(Bayonet record); | ||
62 | + | ||
63 | + /** | ||
64 | + * 分页查询,卡口信息 | ||
65 | + * 条件:场站名称 | ||
66 | + * | ||
67 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
68 | + * @return | ||
69 | + */ | ||
70 | + List<Bayonet> selectListByPage(Bayonet bayonet); | ||
71 | +} |
1 | +package com.sunyo.wlpt.station.manage.mapper; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Warehouse; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/10/12 12:00 | ||
12 | + */ | ||
13 | +@Mapper | ||
14 | +public interface WarehouseMapper { | ||
15 | + /** | ||
16 | + * delete by primary key | ||
17 | + * | ||
18 | + * @param id primaryKey | ||
19 | + * @return deleteCount | ||
20 | + */ | ||
21 | + int deleteByPrimaryKey(String id); | ||
22 | + | ||
23 | + /** | ||
24 | + * insert record to table | ||
25 | + * | ||
26 | + * @param record the record | ||
27 | + * @return insert count | ||
28 | + */ | ||
29 | + int insert(Warehouse record); | ||
30 | + | ||
31 | + /** | ||
32 | + * insert record to table selective | ||
33 | + * | ||
34 | + * @param record the record | ||
35 | + * @return insert count | ||
36 | + */ | ||
37 | + int insertSelective(Warehouse record); | ||
38 | + | ||
39 | + /** | ||
40 | + * select by primary key | ||
41 | + * | ||
42 | + * @param id primary key | ||
43 | + * @return object by primary key | ||
44 | + */ | ||
45 | + Warehouse selectByPrimaryKey(String id); | ||
46 | + | ||
47 | + /** | ||
48 | + * update record selective | ||
49 | + * | ||
50 | + * @param record the updated record | ||
51 | + * @return update count | ||
52 | + */ | ||
53 | + int updateByPrimaryKeySelective(Warehouse record); | ||
54 | + | ||
55 | + /** | ||
56 | + * update record | ||
57 | + * | ||
58 | + * @param record the updated record | ||
59 | + * @return update count | ||
60 | + */ | ||
61 | + int updateByPrimaryKey(Warehouse record); | ||
62 | + | ||
63 | + /** | ||
64 | + * 分页查询,仓库信息 | ||
65 | + * 条件:场站名称,仓库名称 | ||
66 | + * | ||
67 | + * @param warehouse {@link Warehouse} | ||
68 | + * @return | ||
69 | + */ | ||
70 | + List<Warehouse> selectListByPage(Warehouse warehouse); | ||
71 | +} |
1 | +package com.sunyo.wlpt.station.manage.mapper; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/10/12 11:52 | ||
12 | + */ | ||
13 | +@Mapper | ||
14 | +public interface YardMapper { | ||
15 | + /** | ||
16 | + * delete by primary key | ||
17 | + * | ||
18 | + * @param id primaryKey | ||
19 | + * @return deleteCount | ||
20 | + */ | ||
21 | + int deleteByPrimaryKey(String id); | ||
22 | + | ||
23 | + /** | ||
24 | + * insert record to table | ||
25 | + * | ||
26 | + * @param record the record | ||
27 | + * @return insert count | ||
28 | + */ | ||
29 | + int insert(Yard record); | ||
30 | + | ||
31 | + /** | ||
32 | + * insert record to table selective | ||
33 | + * | ||
34 | + * @param record the record | ||
35 | + * @return insert count | ||
36 | + */ | ||
37 | + int insertSelective(Yard record); | ||
38 | + | ||
39 | + /** | ||
40 | + * select by primary key | ||
41 | + * | ||
42 | + * @param id primary key | ||
43 | + * @return object by primary key | ||
44 | + */ | ||
45 | + Yard selectByPrimaryKey(String id); | ||
46 | + | ||
47 | + /** | ||
48 | + * update record selective | ||
49 | + * | ||
50 | + * @param record the updated record | ||
51 | + * @return update count | ||
52 | + */ | ||
53 | + int updateByPrimaryKeySelective(Yard record); | ||
54 | + | ||
55 | + /** | ||
56 | + * update record | ||
57 | + * | ||
58 | + * @param record the updated record | ||
59 | + * @return update count | ||
60 | + */ | ||
61 | + int updateByPrimaryKey(Yard record); | ||
62 | + | ||
63 | + /** | ||
64 | + * 场站信息,分页查询 | ||
65 | + * 条件:name(场站名称);customsCode(关区代码) | ||
66 | + * | ||
67 | + * @param yard 场站信息 | ||
68 | + * @return | ||
69 | + */ | ||
70 | + List<Yard> selectListByPage(Yard yard); | ||
71 | +} |
1 | +package com.sunyo.wlpt.station.manage.response; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.exception.CustomException; | ||
4 | +import com.sunyo.wlpt.station.manage.exception.CustomExceptionType; | ||
5 | +import lombok.Data; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author 子诚 | ||
11 | + * Description:返回结果封装类 | ||
12 | + * 时间:2020/7/01 10:06 | ||
13 | + */ | ||
14 | +@Data | ||
15 | +public class ResultJson<T> implements Serializable { | ||
16 | + | ||
17 | + private static final long serialVersionUID = 1L; | ||
18 | + | ||
19 | + /** | ||
20 | + * 响应业务状态,默认为200 | ||
21 | + */ | ||
22 | + private String code; | ||
23 | + | ||
24 | + /** | ||
25 | + * 响应消息 | ||
26 | + */ | ||
27 | + private String msg; | ||
28 | + | ||
29 | + /** | ||
30 | + * 错误消息内容 | ||
31 | + */ | ||
32 | + private String error; | ||
33 | + | ||
34 | + /** | ||
35 | + * 数据总条数 | ||
36 | + */ | ||
37 | + private Integer total; | ||
38 | + | ||
39 | + /** | ||
40 | + * 响应数据 | ||
41 | + */ | ||
42 | + private T data; | ||
43 | + | ||
44 | + /** | ||
45 | + * JWT令牌 | ||
46 | + */ | ||
47 | + private String jwtToken; | ||
48 | + | ||
49 | + | ||
50 | + /** | ||
51 | + * 无参,构造方法 | ||
52 | + */ | ||
53 | + public ResultJson() | ||
54 | + { | ||
55 | + } | ||
56 | + | ||
57 | + | ||
58 | + /** | ||
59 | + * 定义有参构造器 | ||
60 | + * | ||
61 | + * @param code 响应状态 | ||
62 | + * @param msg 响应消息 | ||
63 | + */ | ||
64 | + public ResultJson(String code, String msg) | ||
65 | + { | ||
66 | + this.code = code; | ||
67 | + this.msg = msg; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 定义有参构造器 | ||
72 | + * | ||
73 | + * @param code 响应状态 | ||
74 | + * @param msg 响应消息 | ||
75 | + * @param data 响应数据 | ||
76 | + */ | ||
77 | + public ResultJson(String code, String msg, T data) | ||
78 | + { | ||
79 | + this.code = code; | ||
80 | + this.msg = msg; | ||
81 | + this.data = data; | ||
82 | + } | ||
83 | + | ||
84 | + public ResultJson(String code, String msg, T data, Integer total) | ||
85 | + { | ||
86 | + this.code = code; | ||
87 | + this.msg = msg; | ||
88 | + this.data = data; | ||
89 | + this.total = total; | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * 定义静态、成功方法(重载) | ||
94 | + * | ||
95 | + * @return 成功(没有响应数据) | ||
96 | + */ | ||
97 | + public static ResultJson success() | ||
98 | + { | ||
99 | + return new ResultJson<>("200", "success"); | ||
100 | + } | ||
101 | + | ||
102 | + public static ResultJson success(String message) | ||
103 | + { | ||
104 | + return new ResultJson<>("200", message); | ||
105 | + } | ||
106 | + | ||
107 | + | ||
108 | + /** | ||
109 | + * 定义静态、成功方法(重载) | ||
110 | + * | ||
111 | + * @return 成功(响应数据) | ||
112 | + */ | ||
113 | + public static ResultJson success(Object data) | ||
114 | + { | ||
115 | + return new ResultJson<>("200", "success", data); | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * 定义静态、成功方法(重载) | ||
120 | + * | ||
121 | + * @return 成功(响应数据) | ||
122 | + */ | ||
123 | + public static ResultJson success(String message, Object data) | ||
124 | + { | ||
125 | + return new ResultJson<>("200", message, data); | ||
126 | + } | ||
127 | + | ||
128 | + public static ResultJson success(String code, String message) | ||
129 | + { | ||
130 | + return new ResultJson<>(code, message); | ||
131 | + } | ||
132 | + | ||
133 | + public static ResultJson success(String code, String message, Object data) | ||
134 | + { | ||
135 | + return new ResultJson<>(code, message, data); | ||
136 | + } | ||
137 | + | ||
138 | + public static ResultJson success(CustomExceptionType customExceptionType) | ||
139 | + { | ||
140 | + return new ResultJson<>(customExceptionType.getCode(), customExceptionType.getMsg()); | ||
141 | + } | ||
142 | + | ||
143 | + public static ResultJson success(CustomExceptionType customExceptionType, Object data) | ||
144 | + { | ||
145 | + return new ResultJson<>(customExceptionType.getCode(), customExceptionType.getMsg(), data); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 请求出现异常时的响应数据封装 | ||
150 | + * | ||
151 | + * @param e 自定义异常类 | ||
152 | + * @return 返回异常信息 | ||
153 | + */ | ||
154 | + public static ResultJson error(CustomException e) | ||
155 | + { | ||
156 | + ResultJson result = new ResultJson<>(); | ||
157 | + result.setCode(e.getCode()); | ||
158 | + if (e.getCode() == CustomExceptionType.CLIENT_ERROR.getCode()) { | ||
159 | + result.setMsg(e.getMessage()); | ||
160 | + } else if (e.getCode() == CustomExceptionType.SYSTEM_ERROR.getCode()) { | ||
161 | + result.setMsg(e.getMessage() + ";请将该异常发送给管理员"); | ||
162 | + } else { | ||
163 | + result.setMsg("系统出现未知异常,请联系管理员!"); | ||
164 | + } | ||
165 | + // 可以尝试着做异常信息持久化 | ||
166 | + return result; | ||
167 | + } | ||
168 | + | ||
169 | + public static ResultJson error(CustomExceptionType customExceptionType, String errorMessage) | ||
170 | + { | ||
171 | + return new ResultJson<>(customExceptionType.getCode(), errorMessage); | ||
172 | + } | ||
173 | + | ||
174 | + public static ResultJson error(CustomExceptionType customExceptionType) | ||
175 | + { | ||
176 | + return new ResultJson<>(customExceptionType.getCode(), customExceptionType.getMsg()); | ||
177 | + } | ||
178 | + | ||
179 | + public static ResultJson error(String code, String message) | ||
180 | + { | ||
181 | + return new ResultJson<>(code, message); | ||
182 | + } | ||
183 | +} |
1 | +package com.sunyo.wlpt.station.manage.service; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
4 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author 子诚 | ||
8 | + * Description: | ||
9 | + * 时间:2020/10/12 11:56 | ||
10 | + */ | ||
11 | +public interface BayonetService { | ||
12 | + | ||
13 | + | ||
14 | + /** | ||
15 | + * delete by primary key | ||
16 | + * | ||
17 | + * @param id primaryKey | ||
18 | + * @return deleteCount | ||
19 | + */ | ||
20 | + ResultJson deleteByPrimaryKey(String id); | ||
21 | + | ||
22 | + /** | ||
23 | + * insert record to table | ||
24 | + * | ||
25 | + * @param record the record | ||
26 | + * @return insert count | ||
27 | + */ | ||
28 | + int insert(Bayonet record); | ||
29 | + | ||
30 | + /** | ||
31 | + * insert record to table selective | ||
32 | + * | ||
33 | + * @param record the record | ||
34 | + * @return insert count | ||
35 | + */ | ||
36 | + ResultJson insertSelective(Bayonet record); | ||
37 | + | ||
38 | + /** | ||
39 | + * select by primary key | ||
40 | + * | ||
41 | + * @param id primary key | ||
42 | + * @return object by primary key | ||
43 | + */ | ||
44 | + Bayonet selectByPrimaryKey(String id); | ||
45 | + | ||
46 | + /** | ||
47 | + * update record selective | ||
48 | + * | ||
49 | + * @param record the updated record | ||
50 | + * @return update count | ||
51 | + */ | ||
52 | + ResultJson updateByPrimaryKeySelective(Bayonet record); | ||
53 | + | ||
54 | + /** | ||
55 | + * update record | ||
56 | + * | ||
57 | + * @param record the updated record | ||
58 | + * @return update count | ||
59 | + */ | ||
60 | + int updateByPrimaryKey(Bayonet record); | ||
61 | + | ||
62 | + /** | ||
63 | + * 卡口信息,分页查询 | ||
64 | + * | ||
65 | + * @param bayonet 卡口信息{@link Bayonet} | ||
66 | + * @param pageNum 当前页数 | ||
67 | + * @param pageSize 每页数量 | ||
68 | + * @return | ||
69 | + */ | ||
70 | + ResultJson selectListByPage(Bayonet bayonet, Integer pageNum, Integer pageSize); | ||
71 | +} |
1 | +package com.sunyo.wlpt.station.manage.service; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Warehouse; | ||
4 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author 子诚 | ||
8 | + * Description: | ||
9 | + * 时间:2020/10/12 12:00 | ||
10 | + */ | ||
11 | +public interface WarehouseService { | ||
12 | + | ||
13 | + /** | ||
14 | + * delete by primary key | ||
15 | + * | ||
16 | + * @param id primaryKey | ||
17 | + * @return deleteCount | ||
18 | + */ | ||
19 | + ResultJson deleteByPrimaryKey(String id); | ||
20 | + | ||
21 | + /** | ||
22 | + * insert record to table | ||
23 | + * | ||
24 | + * @param record the record | ||
25 | + * @return insert count | ||
26 | + */ | ||
27 | + int insert(Warehouse record); | ||
28 | + | ||
29 | + /** | ||
30 | + * insert record to table selective | ||
31 | + * | ||
32 | + * @param record the record | ||
33 | + * @return insert count | ||
34 | + */ | ||
35 | + ResultJson insertSelective(Warehouse record); | ||
36 | + | ||
37 | + /** | ||
38 | + * select by primary key | ||
39 | + * | ||
40 | + * @param id primary key | ||
41 | + * @return object by primary key | ||
42 | + */ | ||
43 | + Warehouse selectByPrimaryKey(String id); | ||
44 | + | ||
45 | + /** | ||
46 | + * update record selective | ||
47 | + * | ||
48 | + * @param record the updated record | ||
49 | + * @return update count | ||
50 | + */ | ||
51 | + ResultJson updateByPrimaryKeySelective(Warehouse record); | ||
52 | + | ||
53 | + /** | ||
54 | + * update record | ||
55 | + * | ||
56 | + * @param record the updated record | ||
57 | + * @return update count | ||
58 | + */ | ||
59 | + int updateByPrimaryKey(Warehouse record); | ||
60 | + | ||
61 | + /** | ||
62 | + * 分页查询 | ||
63 | + * | ||
64 | + * @param warehouse 仓库 | ||
65 | + * @param pageNum 当前页数 | ||
66 | + * @param pageSize 每页大小 | ||
67 | + * @return | ||
68 | + */ | ||
69 | + ResultJson selectListByPage(Warehouse warehouse, Integer pageNum, Integer pageSize); | ||
70 | +} |
1 | +package com.sunyo.wlpt.station.manage.service; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
4 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author 子诚 | ||
8 | + * Description: | ||
9 | + * 时间:2020/10/12 11:52 | ||
10 | + */ | ||
11 | +public interface YardService { | ||
12 | + | ||
13 | + | ||
14 | + /** | ||
15 | + * delete by primary key | ||
16 | + * | ||
17 | + * @param id primaryKey | ||
18 | + * @return deleteCount | ||
19 | + */ | ||
20 | + ResultJson deleteByPrimaryKey(String id); | ||
21 | + | ||
22 | + /** | ||
23 | + * insert record to table | ||
24 | + * | ||
25 | + * @param record the record | ||
26 | + * @return insert count | ||
27 | + */ | ||
28 | + int insert(Yard record); | ||
29 | + | ||
30 | + /** | ||
31 | + * insert record to table selective | ||
32 | + * | ||
33 | + * @param record the record | ||
34 | + * @return insert count | ||
35 | + */ | ||
36 | + ResultJson insertSelective(Yard record); | ||
37 | + | ||
38 | + /** | ||
39 | + * select by primary key | ||
40 | + * | ||
41 | + * @param id primary key | ||
42 | + * @return object by primary key | ||
43 | + */ | ||
44 | + Yard selectByPrimaryKey(String id); | ||
45 | + | ||
46 | + /** | ||
47 | + * update record selective | ||
48 | + * | ||
49 | + * @param record the updated record | ||
50 | + * @return update count | ||
51 | + */ | ||
52 | + ResultJson updateByPrimaryKeySelective(Yard record); | ||
53 | + | ||
54 | + /** | ||
55 | + * update record | ||
56 | + * | ||
57 | + * @param record the updated record | ||
58 | + * @return update count | ||
59 | + */ | ||
60 | + int updateByPrimaryKey(Yard record); | ||
61 | + | ||
62 | + /** | ||
63 | + * 场站信息,分页查询 | ||
64 | + * | ||
65 | + * @param yard 场站信息 {@link Yard} | ||
66 | + * @param pageNum 当前页数 | ||
67 | + * @param pageSize 每页大小 | ||
68 | + * @return | ||
69 | + */ | ||
70 | + ResultJson selectListByPage(Yard yard, Integer pageNum, Integer pageSize); | ||
71 | +} |
1 | +package com.sunyo.wlpt.station.manage.service.impl; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageHelper; | ||
4 | +import com.github.pagehelper.PageInfo; | ||
5 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
6 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
7 | +import com.sunyo.wlpt.station.manage.utils.IdUtils; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +import com.sunyo.wlpt.station.manage.mapper.BayonetMapper; | ||
13 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
14 | +import com.sunyo.wlpt.station.manage.service.BayonetService; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author 子诚 | ||
20 | + * Description: | ||
21 | + * 时间:2020/10/12 11:56 | ||
22 | + */ | ||
23 | +@Service | ||
24 | +public class BayonetServiceImpl implements BayonetService { | ||
25 | + | ||
26 | + @Resource | ||
27 | + private BayonetMapper bayonetMapper; | ||
28 | + | ||
29 | + /** | ||
30 | + * 删除卡口信息 | ||
31 | + * | ||
32 | + * @param id primaryKey | ||
33 | + * @return | ||
34 | + */ | ||
35 | + @Override | ||
36 | + public ResultJson deleteByPrimaryKey(String id) | ||
37 | + { | ||
38 | + return bayonetMapper.deleteByPrimaryKey(id) > 0 | ||
39 | + ? ResultJson.success("200", "删除卡口信息,成功") | ||
40 | + : ResultJson.error("500", "删除卡口信息,失败"); | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public int insert(Bayonet record) | ||
45 | + { | ||
46 | + return bayonetMapper.insert(record); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 选择性新增,卡口信息 | ||
51 | + * | ||
52 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
53 | + * @return | ||
54 | + */ | ||
55 | + @Override | ||
56 | + public ResultJson insertSelective(Bayonet bayonet) | ||
57 | + { | ||
58 | + bayonet.setId(IdUtils.generateId()); | ||
59 | + return bayonetMapper.insertSelective(bayonet) > 0 | ||
60 | + ? ResultJson.success("200", "新增卡口信息,成功") | ||
61 | + : ResultJson.error("500", "新增卡口信息,失败"); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public Bayonet selectByPrimaryKey(String id) | ||
66 | + { | ||
67 | + return bayonetMapper.selectByPrimaryKey(id); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 编辑卡口信息 | ||
72 | + * | ||
73 | + * @param bayonet the updated record 卡口信息 {@link Bayonet} | ||
74 | + * @return | ||
75 | + */ | ||
76 | + @Override | ||
77 | + public ResultJson updateByPrimaryKeySelective(Bayonet bayonet) | ||
78 | + { | ||
79 | + return bayonetMapper.updateByPrimaryKeySelective(bayonet) > 0 | ||
80 | + ? ResultJson.success("200", "编辑卡口信息,成功") | ||
81 | + : ResultJson.error("500", "编辑卡口信息,失败"); | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public int updateByPrimaryKey(Bayonet record) | ||
86 | + { | ||
87 | + return bayonetMapper.updateByPrimaryKey(record); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * 分页查询 | ||
92 | + * | ||
93 | + * @param bayonet 卡口信息 {@link Bayonet} | ||
94 | + * @param pageNum 当前页数 | ||
95 | + * @param pageSize 每页大小 | ||
96 | + * @return | ||
97 | + */ | ||
98 | + @Override | ||
99 | + public ResultJson selectListByPage(Bayonet bayonet, Integer pageNum, Integer pageSize) | ||
100 | + { | ||
101 | + PageHelper.startPage(pageNum, pageSize); | ||
102 | + List<Bayonet> bayonetList = bayonetMapper.selectListByPage(bayonet); | ||
103 | + PageInfo<Bayonet> pageInfo = new PageInfo<>(bayonetList); | ||
104 | + return pageInfo.getTotal() >= 0 | ||
105 | + ? ResultJson.success("200", "查询卡口信息列表,成功!", pageInfo) | ||
106 | + : ResultJson.error("500", "查询卡口信息列表,失败!"); | ||
107 | + } | ||
108 | +} |
1 | +package com.sunyo.wlpt.station.manage.service.impl; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageHelper; | ||
4 | +import com.github.pagehelper.PageInfo; | ||
5 | +import com.sunyo.wlpt.station.manage.domain.Bayonet; | ||
6 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
7 | +import com.sunyo.wlpt.station.manage.utils.IdUtils; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +import com.sunyo.wlpt.station.manage.domain.Warehouse; | ||
13 | +import com.sunyo.wlpt.station.manage.mapper.WarehouseMapper; | ||
14 | +import com.sunyo.wlpt.station.manage.service.WarehouseService; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author 子诚 | ||
20 | + * Description: | ||
21 | + * 时间:2020/10/12 12:00 | ||
22 | + */ | ||
23 | +@Service | ||
24 | +public class WarehouseServiceImpl implements WarehouseService { | ||
25 | + | ||
26 | + @Resource | ||
27 | + private WarehouseMapper warehouseMapper; | ||
28 | + | ||
29 | + /** | ||
30 | + * 删除,仓库信息 | ||
31 | + * | ||
32 | + * @param id primaryKey | ||
33 | + * @return | ||
34 | + */ | ||
35 | + @Override | ||
36 | + public ResultJson deleteByPrimaryKey(String id) | ||
37 | + { | ||
38 | + return warehouseMapper.deleteByPrimaryKey(id) > 0 | ||
39 | + ? ResultJson.success("200", "删除仓库信息,成功") | ||
40 | + : ResultJson.error("500", "删除仓库信息,失败"); | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public int insert(Warehouse record) | ||
45 | + { | ||
46 | + return warehouseMapper.insert(record); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 新增仓库信息 | ||
51 | + * | ||
52 | + * @param warehouse {@link Warehouse} | ||
53 | + * @return | ||
54 | + */ | ||
55 | + @Override | ||
56 | + public ResultJson insertSelective(Warehouse warehouse) | ||
57 | + { | ||
58 | + warehouse.setId(IdUtils.generateId()); | ||
59 | + return warehouseMapper.insertSelective(warehouse) > 0 | ||
60 | + ? ResultJson.success("200", "增加仓库信息,成功") | ||
61 | + : ResultJson.error("500", "增加仓库信息,失败"); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public Warehouse selectByPrimaryKey(String id) | ||
66 | + { | ||
67 | + return warehouseMapper.selectByPrimaryKey(id); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 编辑仓库信息 | ||
72 | + * | ||
73 | + * @param warehouse the updated record | ||
74 | + * @return | ||
75 | + */ | ||
76 | + @Override | ||
77 | + public ResultJson updateByPrimaryKeySelective(Warehouse warehouse) | ||
78 | + { | ||
79 | + return warehouseMapper.updateByPrimaryKeySelective(warehouse) > 0 | ||
80 | + ? ResultJson.success("200", "编辑仓库信息,成功") | ||
81 | + : ResultJson.error("500", "编辑仓库信息,失败"); | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public int updateByPrimaryKey(Warehouse record) | ||
86 | + { | ||
87 | + return warehouseMapper.updateByPrimaryKey(record); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * 分页查询,仓库信息 | ||
92 | + * | ||
93 | + * @param warehouse 仓库信息{@link Warehouse} | ||
94 | + * @param pageNum 当前页数 | ||
95 | + * @param pageSize 每页大小 | ||
96 | + * @return | ||
97 | + */ | ||
98 | + @Override | ||
99 | + public ResultJson selectListByPage(Warehouse warehouse, Integer pageNum, Integer pageSize) | ||
100 | + { | ||
101 | + PageHelper.startPage(pageNum, pageSize); | ||
102 | + List<Warehouse> warehouseList = warehouseMapper.selectListByPage(warehouse); | ||
103 | + PageInfo<Warehouse> pageInfo = new PageInfo<>(warehouseList); | ||
104 | + return pageInfo.getTotal() >= 0 | ||
105 | + ? ResultJson.success("200", "查询仓库信息列表,成功!", pageInfo) | ||
106 | + : ResultJson.error("500", "查询仓库信息列表,失败!"); | ||
107 | + } | ||
108 | +} |
1 | +package com.sunyo.wlpt.station.manage.service.impl; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageHelper; | ||
4 | +import com.github.pagehelper.PageInfo; | ||
5 | +import com.sunyo.wlpt.station.manage.response.ResultJson; | ||
6 | +import com.sunyo.wlpt.station.manage.utils.IdUtils; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | + | ||
11 | +import com.sunyo.wlpt.station.manage.domain.Yard; | ||
12 | +import com.sunyo.wlpt.station.manage.mapper.YardMapper; | ||
13 | +import com.sunyo.wlpt.station.manage.service.YardService; | ||
14 | + | ||
15 | +import java.util.List; | ||
16 | + | ||
17 | +/** | ||
18 | + * @author 子诚 | ||
19 | + * Description: | ||
20 | + * 时间:2020/10/12 11:52 | ||
21 | + */ | ||
22 | +@Service | ||
23 | +public class YardServiceImpl implements YardService { | ||
24 | + | ||
25 | + @Resource | ||
26 | + private YardMapper yardMapper; | ||
27 | + | ||
28 | + /** | ||
29 | + * 删除场站信息 | ||
30 | + * | ||
31 | + * @param id primaryKey | ||
32 | + * @return | ||
33 | + */ | ||
34 | + @Override | ||
35 | + public ResultJson deleteByPrimaryKey(String id) | ||
36 | + { | ||
37 | + return yardMapper.deleteByPrimaryKey(id) > 0 | ||
38 | + ? ResultJson.success("200", "删除场站信息,成功") | ||
39 | + : ResultJson.error("500", "删除场站信息,失败"); | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public int insert(Yard record) | ||
44 | + { | ||
45 | + return yardMapper.insert(record); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 场站信息,选择性增加 | ||
50 | + * | ||
51 | + * @param yard 场站信息 {@link Yard} | ||
52 | + * @return | ||
53 | + */ | ||
54 | + @Override | ||
55 | + public ResultJson insertSelective(Yard yard) | ||
56 | + { | ||
57 | + yard.setId(IdUtils.generateId()); | ||
58 | + return yardMapper.insertSelective(yard) > 0 | ||
59 | + ? ResultJson.success("200", "增加场站信息,成功") | ||
60 | + : ResultJson.error("500", "增加场站信息,失败"); | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public Yard selectByPrimaryKey(String id) | ||
65 | + { | ||
66 | + return yardMapper.selectByPrimaryKey(id); | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public ResultJson updateByPrimaryKeySelective(Yard record) | ||
71 | + { | ||
72 | + return yardMapper.updateByPrimaryKeySelective(record) > 0 | ||
73 | + ? ResultJson.success("200", "编辑场站信息,成功") | ||
74 | + : ResultJson.error("500", "编辑场站信息,失败"); | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public int updateByPrimaryKey(Yard record) | ||
79 | + { | ||
80 | + return yardMapper.updateByPrimaryKey(record); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 分页查询,场站信息 | ||
85 | + * | ||
86 | + * @param yard 场站信息 {@link Yard} | ||
87 | + * @param pageNum 当前页数 | ||
88 | + * @param pageSize 每页大小 | ||
89 | + * @return | ||
90 | + */ | ||
91 | + @Override | ||
92 | + public ResultJson selectListByPage(Yard yard, Integer pageNum, Integer pageSize) | ||
93 | + { | ||
94 | + PageHelper.startPage(pageNum, pageSize); | ||
95 | + List<Yard> yardList = yardMapper.selectListByPage(yard); | ||
96 | + PageInfo<Yard> pageInfo = new PageInfo<>(yardList); | ||
97 | + return pageInfo.getTotal() >= 0 | ||
98 | + ? ResultJson.success("200", "查询场站信息列表,成功!", pageInfo) | ||
99 | + : ResultJson.error("500", "查询场站信息列表,失败!"); | ||
100 | + } | ||
101 | +} |
1 | +package com.sunyo.wlpt.station.manage.utils; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author 子诚 | ||
5 | + * Description:生成雪花算法唯一id | ||
6 | + * 时间:2020/7/1 9:26 | ||
7 | + */ | ||
8 | +public class IdUtils { | ||
9 | + /** | ||
10 | + * 静态工具类 | ||
11 | + * | ||
12 | + * @return id | ||
13 | + */ | ||
14 | + public static synchronized String generateId() { | ||
15 | + IdWorker idWorker = new IdWorker(); | ||
16 | + long nextId = idWorker.nextId(); | ||
17 | + String id = String.valueOf(nextId); | ||
18 | + return id; | ||
19 | + } | ||
20 | +} |
1 | +package com.sunyo.wlpt.station.manage.utils; | ||
2 | + | ||
3 | +import java.lang.management.ManagementFactory; | ||
4 | +import java.net.InetAddress; | ||
5 | +import java.net.NetworkInterface; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author 子诚 | ||
9 | + * Description:雪花算法生成唯一ID | ||
10 | + * 时间:2020/6/30 19:19 | ||
11 | + */ | ||
12 | +public final class IdWorker { | ||
13 | + | ||
14 | + /** | ||
15 | + * 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动) | ||
16 | + */ | ||
17 | + private final static long TWEPOCH = 1288834974657L; | ||
18 | + | ||
19 | + /** | ||
20 | + * 机器标识位数 | ||
21 | + */ | ||
22 | + private final static long WORKER_ID_BITS = 5L; | ||
23 | + | ||
24 | + /** | ||
25 | + * 数据中心标识位数 | ||
26 | + */ | ||
27 | + private final static long DATA_CENTER_ID_BITS = 5L; | ||
28 | + | ||
29 | + /** | ||
30 | + * 机器ID最大值 | ||
31 | + */ | ||
32 | + private final static long MAX_WORKER_ID = ~(-1L << WORKER_ID_BITS); | ||
33 | + | ||
34 | + /** | ||
35 | + * 数据中心ID最大值 | ||
36 | + */ | ||
37 | + private final static long MAX_DATA_CENTER_ID = ~(-1L << DATA_CENTER_ID_BITS); | ||
38 | + | ||
39 | + /** | ||
40 | + * 毫秒内自增位 | ||
41 | + */ | ||
42 | + private final static long SEQUENCE_BITS = 12L; | ||
43 | + | ||
44 | + /** | ||
45 | + * 机器ID偏左移12位 | ||
46 | + */ | ||
47 | + private final static long WORKER_ID_SHIFT = SEQUENCE_BITS; | ||
48 | + | ||
49 | + /** | ||
50 | + * 数据中心ID左移17位 | ||
51 | + */ | ||
52 | + private final static long DATA_CENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS; | ||
53 | + | ||
54 | + /** | ||
55 | + * 时间毫秒左移22位 | ||
56 | + */ | ||
57 | + private final static long TIME_STAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATA_CENTER_ID_BITS; | ||
58 | + | ||
59 | + private final static long SEQUENCE_MASK = ~(-1L << SEQUENCE_BITS); | ||
60 | + | ||
61 | + /** | ||
62 | + * 上次生产id时间戳 | ||
63 | + */ | ||
64 | + private static long LAST_TIME_STAMP = -1L; | ||
65 | + | ||
66 | + /** | ||
67 | + * 0,并发控制 | ||
68 | + */ | ||
69 | + private long sequence = 0L; | ||
70 | + | ||
71 | + private final long workerId; | ||
72 | + | ||
73 | + /** | ||
74 | + * 数据标识id部分 | ||
75 | + */ | ||
76 | + private final long DATA_CENTER_ID; | ||
77 | + | ||
78 | + public IdWorker() { | ||
79 | + this.DATA_CENTER_ID = getDatacenterId(MAX_DATA_CENTER_ID); | ||
80 | + this.workerId = getMaxWorkerId(DATA_CENTER_ID, MAX_WORKER_ID); | ||
81 | + } | ||
82 | + | ||
83 | + public IdWorker(long workerId, long datacenterId) { | ||
84 | + if (workerId > MAX_WORKER_ID || workerId < 0) { | ||
85 | + throw new IllegalArgumentException(String.format("id不能大于最大值 %d 或者小于 0", MAX_WORKER_ID)); | ||
86 | + } | ||
87 | + if (datacenterId > MAX_DATA_CENTER_ID || datacenterId < 0) { | ||
88 | + throw new IllegalArgumentException(String.format("数据中心id不能大于最大值 %d 或者小于 0", MAX_DATA_CENTER_ID)); | ||
89 | + } | ||
90 | + this.workerId = workerId; | ||
91 | + this.DATA_CENTER_ID = datacenterId; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 获取下一个ID | ||
96 | + * | ||
97 | + * @return id | ||
98 | + */ | ||
99 | + public synchronized long nextId() { | ||
100 | + long timestamp = timeGen(); | ||
101 | + if (timestamp < LAST_TIME_STAMP) { | ||
102 | + throw new RuntimeException(String.format("时间生成异常 %d", LAST_TIME_STAMP - timestamp)); | ||
103 | + } | ||
104 | + | ||
105 | + if (LAST_TIME_STAMP == timestamp) { | ||
106 | + // 当前毫秒内,则+1 | ||
107 | + sequence = (sequence + 1) & SEQUENCE_MASK; | ||
108 | + if (sequence == 0) { | ||
109 | + // 当前毫秒内计数满了,则等待下一秒 | ||
110 | + timestamp = tilNextMillis(LAST_TIME_STAMP); | ||
111 | + } | ||
112 | + } else { | ||
113 | + sequence = 0L; | ||
114 | + } | ||
115 | + LAST_TIME_STAMP = timestamp; | ||
116 | + // ID偏移组合生成最终的ID,并返回ID | ||
117 | + | ||
118 | + return ((timestamp - TWEPOCH) << TIME_STAMP_LEFT_SHIFT) | ||
119 | + | (DATA_CENTER_ID << DATA_CENTER_ID_SHIFT) | ||
120 | + | (workerId << WORKER_ID_SHIFT) | sequence; | ||
121 | + } | ||
122 | + | ||
123 | + private long tilNextMillis(final long lastTimestamp) { | ||
124 | + long timestamp = this.timeGen(); | ||
125 | + while (timestamp <= lastTimestamp) { | ||
126 | + timestamp = this.timeGen(); | ||
127 | + } | ||
128 | + return timestamp; | ||
129 | + } | ||
130 | + | ||
131 | + private long timeGen() { | ||
132 | + return System.currentTimeMillis(); | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * <p> | ||
137 | + * 获取 maxWorkerId | ||
138 | + * </p> | ||
139 | + */ | ||
140 | + private static long getMaxWorkerId(long dataCenterId, long maxWorkerId) { | ||
141 | + StringBuilder mpid = new StringBuilder(); | ||
142 | + mpid.append(dataCenterId); | ||
143 | + String name = ManagementFactory.getRuntimeMXBean().getName(); | ||
144 | + if (!name.isEmpty()) { | ||
145 | + /* | ||
146 | + * GET jvmPid | ||
147 | + */ | ||
148 | + mpid.append(name.split("@")[0]); | ||
149 | + } | ||
150 | + /* | ||
151 | + * MAC + PID 的 hashcode 获取16个低位 | ||
152 | + */ | ||
153 | + return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1); | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * <p> | ||
158 | + * 数据标识id部分 | ||
159 | + * </p> | ||
160 | + */ | ||
161 | + private static long getDatacenterId(long maxDatacenterId) { | ||
162 | + long id = 0L; | ||
163 | + try { | ||
164 | + InetAddress ip = InetAddress.getLocalHost(); | ||
165 | + NetworkInterface network = NetworkInterface.getByInetAddress(ip); | ||
166 | + if (network == null) { | ||
167 | + id = 1L; | ||
168 | + } else { | ||
169 | + byte[] mac = network.getHardwareAddress(); | ||
170 | + id = ((0x000000FF & (long) mac[mac.length - 1]) | ||
171 | + | (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6; | ||
172 | + id = id % (maxDatacenterId + 1); | ||
173 | + } | ||
174 | + } catch (Exception e) { | ||
175 | + System.out.println(" getDatacenterId: " + e.getMessage()); | ||
176 | + } | ||
177 | + return id; | ||
178 | + } | ||
179 | + | ||
180 | + /** | ||
181 | + * 静态工具类 | ||
182 | + * | ||
183 | + * @return id | ||
184 | + | ||
185 | + public static synchronized String generateId() { | ||
186 | + String id = String.valueOf(new IdWorker().nextId()); | ||
187 | + return id; | ||
188 | + } | ||
189 | + */ | ||
190 | + /** | ||
191 | + * 测试 | ||
192 | + | ||
193 | + public static void main(String[] args) { | ||
194 | + System.out.println("当前时间戳:" + System.currentTimeMillis()); | ||
195 | + for (int i = 0; i < 10; i++) { | ||
196 | + //生成唯一雪花id | ||
197 | + String id = IdWorker.generateId(); | ||
198 | + System.out.println("第" + i + "个:" + id + ";长度为:" + id.length()); | ||
199 | + } | ||
200 | + } | ||
201 | + */ | ||
202 | +} |
src/main/resources/mapper/BayonetMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sunyo.wlpt.station.manage.mapper.BayonetMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <!--@Table bayonet--> | ||
7 | + <id column="id" jdbcType="VARCHAR" property="id"/> | ||
8 | + <result column="yard_id" jdbcType="VARCHAR" property="yardId"/> | ||
9 | + <result column="name" jdbcType="VARCHAR" property="name"/> | ||
10 | + <result column="channel" jdbcType="VARCHAR" property="channel"/> | ||
11 | + <result column="type" jdbcType="VARCHAR" property="type"/> | ||
12 | + <result column="create_by" jdbcType="VARCHAR" property="createBy"/> | ||
13 | + <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||
14 | + <result column="update_by" jdbcType="VARCHAR" property="updateBy"/> | ||
15 | + <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||
16 | + <result column="remarks" jdbcType="VARCHAR" property="remarks"/> | ||
17 | + <result column="del_flag" jdbcType="CHAR" property="delFlag"/> | ||
18 | + </resultMap> | ||
19 | + <!-- 该Mapper映射关系的作用,是卡口与场站的1:1的关系映射 --> | ||
20 | + <resultMap id="BayonetAndYardMap" extends="BaseResultMap" | ||
21 | + type="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
22 | + <association property="yard" javaType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
23 | + <id column="id" property="id"/> | ||
24 | + <result column="yard_name" property="name"/> | ||
25 | + </association> | ||
26 | + </resultMap> | ||
27 | + | ||
28 | + <sql id="Base_Column_List"> | ||
29 | + <!--@mbg.generated--> | ||
30 | + id, yard_id, `name`, channel, `type`, create_by, create_date, update_by, update_date, | ||
31 | + remarks, del_flag | ||
32 | + </sql> | ||
33 | + <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
34 | + <!--@mbg.generated--> | ||
35 | + select | ||
36 | + <include refid="Base_Column_List"/> | ||
37 | + from bayonet | ||
38 | + where id = #{id,jdbcType=VARCHAR} | ||
39 | + </select> | ||
40 | + <select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Bayonet" resultMap="BayonetAndYardMap"> | ||
41 | + select b.id, | ||
42 | + b.yard_id, | ||
43 | + b.name, | ||
44 | + b.channel, | ||
45 | + b.type, | ||
46 | + b.create_by, | ||
47 | + b.create_date, | ||
48 | + b.update_by, | ||
49 | + b.update_date, | ||
50 | + b.remarks, | ||
51 | + b.del_flag, | ||
52 | + y.name as yard_name | ||
53 | + from bayonet b, | ||
54 | + yard y | ||
55 | + <where> | ||
56 | + <!-- name,卡口名称 --> | ||
57 | + <if test="name != null and name != ''"> | ||
58 | + and b.name = #{name,jdbcType=VARCHAR} | ||
59 | + </if> | ||
60 | + <!-- channel,通道编号 --> | ||
61 | + <if test="channel != null and channel != ''"> | ||
62 | + and b.channel = #{channel,jdbcType=VARCHAR} | ||
63 | + </if> | ||
64 | + <!-- stationName,货站名称 --> | ||
65 | + <if test="stationName != null and stationName != ''"> | ||
66 | + and y.name = #{stationName,jdbcType=VARCHAR} | ||
67 | + </if> | ||
68 | + and b.yard_id = y.stationId | ||
69 | + </where> | ||
70 | + </select> | ||
71 | + | ||
72 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | ||
73 | + <!--@mbg.generated--> | ||
74 | + delete | ||
75 | + from bayonet | ||
76 | + where id = #{id,jdbcType=VARCHAR} | ||
77 | + </delete> | ||
78 | + <insert id="insert" parameterType="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
79 | + <!--@mbg.generated--> | ||
80 | + insert into bayonet (id, yard_id, `name`, | ||
81 | + channel, `type`, create_by, | ||
82 | + create_date, update_by, update_date, | ||
83 | + remarks, del_flag) | ||
84 | + values (#{id,jdbcType=VARCHAR}, #{yardId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, | ||
85 | + #{channel,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, | ||
86 | + #{createDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}, | ||
87 | + #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR}) | ||
88 | + </insert> | ||
89 | + <insert id="insertSelective" parameterType="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
90 | + <!--@mbg.generated--> | ||
91 | + insert into bayonet | ||
92 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
93 | + <if test="id != null"> | ||
94 | + id, | ||
95 | + </if> | ||
96 | + <if test="yardId != null"> | ||
97 | + yard_id, | ||
98 | + </if> | ||
99 | + <if test="name != null"> | ||
100 | + `name`, | ||
101 | + </if> | ||
102 | + <if test="channel != null"> | ||
103 | + channel, | ||
104 | + </if> | ||
105 | + <if test="type != null"> | ||
106 | + `type`, | ||
107 | + </if> | ||
108 | + <if test="createBy != null"> | ||
109 | + create_by, | ||
110 | + </if> | ||
111 | + <if test="createDate != null"> | ||
112 | + create_date, | ||
113 | + </if> | ||
114 | + <if test="updateBy != null"> | ||
115 | + update_by, | ||
116 | + </if> | ||
117 | + <if test="updateDate != null"> | ||
118 | + update_date, | ||
119 | + </if> | ||
120 | + <if test="remarks != null"> | ||
121 | + remarks, | ||
122 | + </if> | ||
123 | + <if test="delFlag != null"> | ||
124 | + del_flag, | ||
125 | + </if> | ||
126 | + </trim> | ||
127 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
128 | + <if test="id != null"> | ||
129 | + #{id,jdbcType=VARCHAR}, | ||
130 | + </if> | ||
131 | + <if test="yardId != null"> | ||
132 | + #{yardId,jdbcType=VARCHAR}, | ||
133 | + </if> | ||
134 | + <if test="name != null"> | ||
135 | + #{name,jdbcType=VARCHAR}, | ||
136 | + </if> | ||
137 | + <if test="channel != null"> | ||
138 | + #{channel,jdbcType=VARCHAR}, | ||
139 | + </if> | ||
140 | + <if test="type != null"> | ||
141 | + #{type,jdbcType=VARCHAR}, | ||
142 | + </if> | ||
143 | + <if test="createBy != null"> | ||
144 | + #{createBy,jdbcType=VARCHAR}, | ||
145 | + </if> | ||
146 | + <if test="createDate != null"> | ||
147 | + #{createDate,jdbcType=TIMESTAMP}, | ||
148 | + </if> | ||
149 | + <if test="updateBy != null"> | ||
150 | + #{updateBy,jdbcType=VARCHAR}, | ||
151 | + </if> | ||
152 | + <if test="updateDate != null"> | ||
153 | + #{updateDate,jdbcType=TIMESTAMP}, | ||
154 | + </if> | ||
155 | + <if test="remarks != null"> | ||
156 | + #{remarks,jdbcType=VARCHAR}, | ||
157 | + </if> | ||
158 | + <if test="delFlag != null"> | ||
159 | + #{delFlag,jdbcType=CHAR}, | ||
160 | + </if> | ||
161 | + </trim> | ||
162 | + </insert> | ||
163 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
164 | + <!--@mbg.generated--> | ||
165 | + update bayonet | ||
166 | + <set> | ||
167 | + <if test="yardId != null"> | ||
168 | + yard_id = #{yardId,jdbcType=VARCHAR}, | ||
169 | + </if> | ||
170 | + <if test="name != null"> | ||
171 | + `name` = #{name,jdbcType=VARCHAR}, | ||
172 | + </if> | ||
173 | + <if test="channel != null"> | ||
174 | + channel = #{channel,jdbcType=VARCHAR}, | ||
175 | + </if> | ||
176 | + <if test="type != null"> | ||
177 | + `type` = #{type,jdbcType=VARCHAR}, | ||
178 | + </if> | ||
179 | + <if test="createBy != null"> | ||
180 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
181 | + </if> | ||
182 | + <if test="createDate != null"> | ||
183 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
184 | + </if> | ||
185 | + <if test="updateBy != null"> | ||
186 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
187 | + </if> | ||
188 | + <if test="updateDate != null"> | ||
189 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
190 | + </if> | ||
191 | + <if test="remarks != null"> | ||
192 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
193 | + </if> | ||
194 | + <if test="delFlag != null"> | ||
195 | + del_flag = #{delFlag,jdbcType=CHAR}, | ||
196 | + </if> | ||
197 | + </set> | ||
198 | + where id = #{id,jdbcType=VARCHAR} | ||
199 | + </update> | ||
200 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.station.manage.domain.Bayonet"> | ||
201 | + <!--@mbg.generated--> | ||
202 | + update bayonet | ||
203 | + set yard_id = #{yardId,jdbcType=VARCHAR}, | ||
204 | + `name` = #{name,jdbcType=VARCHAR}, | ||
205 | + channel = #{channel,jdbcType=VARCHAR}, | ||
206 | + `type` = #{type,jdbcType=VARCHAR}, | ||
207 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
208 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
209 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
210 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
211 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
212 | + del_flag = #{delFlag,jdbcType=CHAR} | ||
213 | + where id = #{id,jdbcType=VARCHAR} | ||
214 | + </update> | ||
215 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sunyo.wlpt.station.manage.mapper.WarehouseMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <!--@Table warehouse--> | ||
7 | + <id column="id" jdbcType="VARCHAR" property="id"/> | ||
8 | + <result column="yard_id" jdbcType="VARCHAR" property="yardId"/> | ||
9 | + <result column="cop_code" jdbcType="VARCHAR" property="copCode"/> | ||
10 | + <result column="name" jdbcType="VARCHAR" property="name"/> | ||
11 | + <result column="length" jdbcType="DECIMAL" property="length"/> | ||
12 | + <result column="width" jdbcType="DECIMAL" property="width"/> | ||
13 | + <result column="area" jdbcType="DECIMAL" property="area"/> | ||
14 | + <result column="create_by" jdbcType="VARCHAR" property="createBy"/> | ||
15 | + <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||
16 | + <result column="update_by" jdbcType="VARCHAR" property="updateBy"/> | ||
17 | + <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||
18 | + <result column="remarks" jdbcType="VARCHAR" property="remarks"/> | ||
19 | + <result column="del_flag" jdbcType="CHAR" property="delFlag"/> | ||
20 | + </resultMap> | ||
21 | + | ||
22 | + <!-- 该Mapper映射关系的作用,是仓库与场站的1:1的关系映射 --> | ||
23 | + <resultMap id="WarehouseAndYardMap" extends="BaseResultMap" | ||
24 | + type="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
25 | + <association property="yard" javaType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
26 | + <id column="id" property="id"/> | ||
27 | + <result column="yard_name" property="name"/> | ||
28 | + </association> | ||
29 | + </resultMap> | ||
30 | + <sql id="Base_Column_List"> | ||
31 | + <!--@mbg.generated--> | ||
32 | + id, yard_id, cop_code, `name`, `length`, width, area, create_by, create_date, update_by, | ||
33 | + update_date, remarks, del_flag | ||
34 | + </sql> | ||
35 | + <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
36 | + <!--@mbg.generated--> | ||
37 | + select | ||
38 | + <include refid="Base_Column_List"/> | ||
39 | + from warehouse | ||
40 | + where id = #{id,jdbcType=VARCHAR} | ||
41 | + </select> | ||
42 | + | ||
43 | + <!-- 分页查询 --> | ||
44 | + <select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse" resultMap="WarehouseAndYardMap"> | ||
45 | + select w.id, | ||
46 | + w.yard_id, | ||
47 | + w.cop_code, | ||
48 | + w.name, | ||
49 | + w.length, | ||
50 | + w.width, | ||
51 | + w.area, | ||
52 | + w.create_by, | ||
53 | + w.create_date, | ||
54 | + w.update_by, | ||
55 | + w.update_date, | ||
56 | + w.remarks, | ||
57 | + w.del_flag, | ||
58 | + y.name as yard_name | ||
59 | + from warehouse w, | ||
60 | + yard y | ||
61 | + <where> | ||
62 | + <!-- name,仓库名称 --> | ||
63 | + <if test="name != null and name != ''"> | ||
64 | + and w.name = #{name,jdbcType=VARCHAR} | ||
65 | + </if> | ||
66 | + <!-- stationName,货站名称 --> | ||
67 | + <if test="stationName != null and stationName != ''"> | ||
68 | + and y.name = #{stationName,jdbcType=VARCHAR} | ||
69 | + </if> | ||
70 | + and w.yard_id = y.id | ||
71 | + </where> | ||
72 | + </select> | ||
73 | + | ||
74 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | ||
75 | + <!--@mbg.generated--> | ||
76 | + delete | ||
77 | + from warehouse | ||
78 | + where id = #{id,jdbcType=VARCHAR} | ||
79 | + </delete> | ||
80 | + <insert id="insert" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
81 | + <!--@mbg.generated--> | ||
82 | + insert into warehouse (id, yard_id, cop_code, | ||
83 | + `name`, `length`, width, | ||
84 | + area, create_by, create_date, | ||
85 | + update_by, update_date, remarks, | ||
86 | + del_flag) | ||
87 | + values (#{id,jdbcType=VARCHAR}, #{yardId,jdbcType=VARCHAR}, #{copCode,jdbcType=VARCHAR}, | ||
88 | + #{name,jdbcType=VARCHAR}, #{length,jdbcType=DECIMAL}, #{width,jdbcType=DECIMAL}, | ||
89 | + #{area,jdbcType=DECIMAL}, #{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, | ||
90 | + #{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, | ||
91 | + #{delFlag,jdbcType=CHAR}) | ||
92 | + </insert> | ||
93 | + <insert id="insertSelective" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
94 | + <!--@mbg.generated--> | ||
95 | + insert into warehouse | ||
96 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
97 | + <if test="id != null"> | ||
98 | + id, | ||
99 | + </if> | ||
100 | + <if test="yardId != null"> | ||
101 | + yard_id, | ||
102 | + </if> | ||
103 | + <if test="copCode != null"> | ||
104 | + cop_code, | ||
105 | + </if> | ||
106 | + <if test="name != null"> | ||
107 | + `name`, | ||
108 | + </if> | ||
109 | + <if test="length != null"> | ||
110 | + `length`, | ||
111 | + </if> | ||
112 | + <if test="width != null"> | ||
113 | + width, | ||
114 | + </if> | ||
115 | + <if test="area != null"> | ||
116 | + area, | ||
117 | + </if> | ||
118 | + <if test="createBy != null"> | ||
119 | + create_by, | ||
120 | + </if> | ||
121 | + <if test="createDate != null"> | ||
122 | + create_date, | ||
123 | + </if> | ||
124 | + <if test="updateBy != null"> | ||
125 | + update_by, | ||
126 | + </if> | ||
127 | + <if test="updateDate != null"> | ||
128 | + update_date, | ||
129 | + </if> | ||
130 | + <if test="remarks != null"> | ||
131 | + remarks, | ||
132 | + </if> | ||
133 | + <if test="delFlag != null"> | ||
134 | + del_flag, | ||
135 | + </if> | ||
136 | + </trim> | ||
137 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
138 | + <if test="id != null"> | ||
139 | + #{id,jdbcType=VARCHAR}, | ||
140 | + </if> | ||
141 | + <if test="yardId != null"> | ||
142 | + #{yardId,jdbcType=VARCHAR}, | ||
143 | + </if> | ||
144 | + <if test="copCode != null"> | ||
145 | + #{copCode,jdbcType=VARCHAR}, | ||
146 | + </if> | ||
147 | + <if test="name != null"> | ||
148 | + #{name,jdbcType=VARCHAR}, | ||
149 | + </if> | ||
150 | + <if test="length != null"> | ||
151 | + #{length,jdbcType=DECIMAL}, | ||
152 | + </if> | ||
153 | + <if test="width != null"> | ||
154 | + #{width,jdbcType=DECIMAL}, | ||
155 | + </if> | ||
156 | + <if test="area != null"> | ||
157 | + #{area,jdbcType=DECIMAL}, | ||
158 | + </if> | ||
159 | + <if test="createBy != null"> | ||
160 | + #{createBy,jdbcType=VARCHAR}, | ||
161 | + </if> | ||
162 | + <if test="createDate != null"> | ||
163 | + #{createDate,jdbcType=TIMESTAMP}, | ||
164 | + </if> | ||
165 | + <if test="updateBy != null"> | ||
166 | + #{updateBy,jdbcType=VARCHAR}, | ||
167 | + </if> | ||
168 | + <if test="updateDate != null"> | ||
169 | + #{updateDate,jdbcType=TIMESTAMP}, | ||
170 | + </if> | ||
171 | + <if test="remarks != null"> | ||
172 | + #{remarks,jdbcType=VARCHAR}, | ||
173 | + </if> | ||
174 | + <if test="delFlag != null"> | ||
175 | + #{delFlag,jdbcType=CHAR}, | ||
176 | + </if> | ||
177 | + </trim> | ||
178 | + </insert> | ||
179 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
180 | + <!--@mbg.generated--> | ||
181 | + update warehouse | ||
182 | + <set> | ||
183 | + <if test="yardId != null"> | ||
184 | + yard_id = #{yardId,jdbcType=VARCHAR}, | ||
185 | + </if> | ||
186 | + <if test="copCode != null"> | ||
187 | + cop_code = #{copCode,jdbcType=VARCHAR}, | ||
188 | + </if> | ||
189 | + <if test="name != null"> | ||
190 | + `name` = #{name,jdbcType=VARCHAR}, | ||
191 | + </if> | ||
192 | + <if test="length != null"> | ||
193 | + `length` = #{length,jdbcType=DECIMAL}, | ||
194 | + </if> | ||
195 | + <if test="width != null"> | ||
196 | + width = #{width,jdbcType=DECIMAL}, | ||
197 | + </if> | ||
198 | + <if test="area != null"> | ||
199 | + area = #{area,jdbcType=DECIMAL}, | ||
200 | + </if> | ||
201 | + <if test="createBy != null"> | ||
202 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
203 | + </if> | ||
204 | + <if test="createDate != null"> | ||
205 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
206 | + </if> | ||
207 | + <if test="updateBy != null"> | ||
208 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
209 | + </if> | ||
210 | + <if test="updateDate != null"> | ||
211 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
212 | + </if> | ||
213 | + <if test="remarks != null"> | ||
214 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
215 | + </if> | ||
216 | + <if test="delFlag != null"> | ||
217 | + del_flag = #{delFlag,jdbcType=CHAR}, | ||
218 | + </if> | ||
219 | + </set> | ||
220 | + where id = #{id,jdbcType=VARCHAR} | ||
221 | + </update> | ||
222 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> | ||
223 | + <!--@mbg.generated--> | ||
224 | + update warehouse | ||
225 | + set yard_id = #{yardId,jdbcType=VARCHAR}, | ||
226 | + cop_code = #{copCode,jdbcType=VARCHAR}, | ||
227 | + `name` = #{name,jdbcType=VARCHAR}, | ||
228 | + `length` = #{length,jdbcType=DECIMAL}, | ||
229 | + width = #{width,jdbcType=DECIMAL}, | ||
230 | + area = #{area,jdbcType=DECIMAL}, | ||
231 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
232 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
233 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
234 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
235 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
236 | + del_flag = #{delFlag,jdbcType=CHAR} | ||
237 | + where id = #{id,jdbcType=VARCHAR} | ||
238 | + </update> | ||
239 | +</mapper> |
src/main/resources/mapper/YardMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sunyo.wlpt.station.manage.mapper.YardMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <!--@Table yard--> | ||
7 | + <id column="id" jdbcType="VARCHAR" property="id"/> | ||
8 | + <result column="area_code" jdbcType="VARCHAR" property="areaCode"/> | ||
9 | + <result column="stationId" jdbcType="VARCHAR" property="stationId"/> | ||
10 | + <result column="name" jdbcType="VARCHAR" property="name"/> | ||
11 | + <result column="customs_code" jdbcType="INTEGER" property="customsCode"/> | ||
12 | + <result column="org_id" jdbcType="VARCHAR" property="orgId"/> | ||
13 | + <result column="create_by" jdbcType="VARCHAR" property="createBy"/> | ||
14 | + <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||
15 | + <result column="update_by" jdbcType="VARCHAR" property="updateBy"/> | ||
16 | + <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||
17 | + <result column="remarks" jdbcType="VARCHAR" property="remarks"/> | ||
18 | + <result column="del_flag" jdbcType="CHAR" property="delFlag"/> | ||
19 | + </resultMap> | ||
20 | + <sql id="Base_Column_List"> | ||
21 | + <!--@mbg.generated--> | ||
22 | + id, area_code, stationId, `name`, customs_code, org_id, create_by, create_date, update_by, | ||
23 | + update_date, remarks, del_flag | ||
24 | + </sql> | ||
25 | + <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
26 | + <!--@mbg.generated--> | ||
27 | + select | ||
28 | + <include refid="Base_Column_List"/> | ||
29 | + from yard | ||
30 | + where id = #{id,jdbcType=VARCHAR} | ||
31 | + </select> | ||
32 | + | ||
33 | + <select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Yard" resultMap="BaseResultMap"> | ||
34 | + select | ||
35 | + <include refid="Base_Column_List"/> | ||
36 | + from yard | ||
37 | + <where> | ||
38 | + <!-- name,场站名称 --> | ||
39 | + <if test="name != null and name != ''"> | ||
40 | + name = #{name,jdbcType=VARCHAR} | ||
41 | + </if> | ||
42 | + <!-- customsCode,关区代码 --> | ||
43 | + <if test="customsCode != null"> | ||
44 | + and customs_code = #{customsCode,jdbcType=INTEGER} | ||
45 | + </if> | ||
46 | + </where> | ||
47 | + </select> | ||
48 | + | ||
49 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | ||
50 | + <!--@mbg.generated--> | ||
51 | + delete | ||
52 | + from yard | ||
53 | + where id = #{id,jdbcType=VARCHAR} | ||
54 | + </delete> | ||
55 | + <insert id="insert" parameterType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
56 | + <!--@mbg.generated--> | ||
57 | + insert into yard (id, area_code, stationId, | ||
58 | + `name`, customs_code, org_id, | ||
59 | + create_by, create_date, update_by, | ||
60 | + update_date, remarks, del_flag) | ||
61 | + values (#{id,jdbcType=VARCHAR}, #{areaCode,jdbcType=VARCHAR}, #{stationId,jdbcType=VARCHAR}, | ||
62 | + #{name,jdbcType=VARCHAR}, #{customsCode,jdbcType=INTEGER}, #{orgId,jdbcType=VARCHAR}, | ||
63 | + #{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, | ||
64 | + #{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR}) | ||
65 | + </insert> | ||
66 | + <insert id="insertSelective" parameterType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
67 | + <!--@mbg.generated--> | ||
68 | + insert into yard | ||
69 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
70 | + <if test="id != null"> | ||
71 | + id, | ||
72 | + </if> | ||
73 | + <if test="areaCode != null"> | ||
74 | + area_code, | ||
75 | + </if> | ||
76 | + <if test="stationId != null"> | ||
77 | + stationId, | ||
78 | + </if> | ||
79 | + <if test="name != null"> | ||
80 | + `name`, | ||
81 | + </if> | ||
82 | + <if test="customsCode != null"> | ||
83 | + customs_code, | ||
84 | + </if> | ||
85 | + <if test="orgId != null"> | ||
86 | + org_id, | ||
87 | + </if> | ||
88 | + <if test="createBy != null"> | ||
89 | + create_by, | ||
90 | + </if> | ||
91 | + <if test="createDate != null"> | ||
92 | + create_date, | ||
93 | + </if> | ||
94 | + <if test="updateBy != null"> | ||
95 | + update_by, | ||
96 | + </if> | ||
97 | + <if test="updateDate != null"> | ||
98 | + update_date, | ||
99 | + </if> | ||
100 | + <if test="remarks != null"> | ||
101 | + remarks, | ||
102 | + </if> | ||
103 | + <if test="delFlag != null"> | ||
104 | + del_flag, | ||
105 | + </if> | ||
106 | + </trim> | ||
107 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
108 | + <if test="id != null"> | ||
109 | + #{id,jdbcType=VARCHAR}, | ||
110 | + </if> | ||
111 | + <if test="areaCode != null"> | ||
112 | + #{areaCode,jdbcType=VARCHAR}, | ||
113 | + </if> | ||
114 | + <if test="stationId != null"> | ||
115 | + #{stationId,jdbcType=VARCHAR}, | ||
116 | + </if> | ||
117 | + <if test="name != null"> | ||
118 | + #{name,jdbcType=VARCHAR}, | ||
119 | + </if> | ||
120 | + <if test="customsCode != null"> | ||
121 | + #{customsCode,jdbcType=INTEGER}, | ||
122 | + </if> | ||
123 | + <if test="orgId != null"> | ||
124 | + #{orgId,jdbcType=VARCHAR}, | ||
125 | + </if> | ||
126 | + <if test="createBy != null"> | ||
127 | + #{createBy,jdbcType=VARCHAR}, | ||
128 | + </if> | ||
129 | + <if test="createDate != null"> | ||
130 | + #{createDate,jdbcType=TIMESTAMP}, | ||
131 | + </if> | ||
132 | + <if test="updateBy != null"> | ||
133 | + #{updateBy,jdbcType=VARCHAR}, | ||
134 | + </if> | ||
135 | + <if test="updateDate != null"> | ||
136 | + #{updateDate,jdbcType=TIMESTAMP}, | ||
137 | + </if> | ||
138 | + <if test="remarks != null"> | ||
139 | + #{remarks,jdbcType=VARCHAR}, | ||
140 | + </if> | ||
141 | + <if test="delFlag != null"> | ||
142 | + #{delFlag,jdbcType=CHAR}, | ||
143 | + </if> | ||
144 | + </trim> | ||
145 | + </insert> | ||
146 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
147 | + <!--@mbg.generated--> | ||
148 | + update yard | ||
149 | + <set> | ||
150 | + <if test="areaCode != null"> | ||
151 | + area_code = #{areaCode,jdbcType=VARCHAR}, | ||
152 | + </if> | ||
153 | + <if test="stationId != null"> | ||
154 | + stationId = #{stationId,jdbcType=VARCHAR}, | ||
155 | + </if> | ||
156 | + <if test="name != null"> | ||
157 | + `name` = #{name,jdbcType=VARCHAR}, | ||
158 | + </if> | ||
159 | + <if test="customsCode != null"> | ||
160 | + customs_code = #{customsCode,jdbcType=INTEGER}, | ||
161 | + </if> | ||
162 | + <if test="orgId != null"> | ||
163 | + org_id = #{orgId,jdbcType=VARCHAR}, | ||
164 | + </if> | ||
165 | + <if test="createBy != null"> | ||
166 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
167 | + </if> | ||
168 | + <if test="createDate != null"> | ||
169 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
170 | + </if> | ||
171 | + <if test="updateBy != null"> | ||
172 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
173 | + </if> | ||
174 | + <if test="updateDate != null"> | ||
175 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
176 | + </if> | ||
177 | + <if test="remarks != null"> | ||
178 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
179 | + </if> | ||
180 | + <if test="delFlag != null"> | ||
181 | + del_flag = #{delFlag,jdbcType=CHAR}, | ||
182 | + </if> | ||
183 | + </set> | ||
184 | + where id = #{id,jdbcType=VARCHAR} | ||
185 | + </update> | ||
186 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.station.manage.domain.Yard"> | ||
187 | + <!--@mbg.generated--> | ||
188 | + update yard | ||
189 | + set area_code = #{areaCode,jdbcType=VARCHAR}, | ||
190 | + stationId = #{stationId,jdbcType=VARCHAR}, | ||
191 | + `name` = #{name,jdbcType=VARCHAR}, | ||
192 | + customs_code = #{customsCode,jdbcType=INTEGER}, | ||
193 | + org_id = #{orgId,jdbcType=VARCHAR}, | ||
194 | + create_by = #{createBy,jdbcType=VARCHAR}, | ||
195 | + create_date = #{createDate,jdbcType=TIMESTAMP}, | ||
196 | + update_by = #{updateBy,jdbcType=VARCHAR}, | ||
197 | + update_date = #{updateDate,jdbcType=TIMESTAMP}, | ||
198 | + remarks = #{remarks,jdbcType=VARCHAR}, | ||
199 | + del_flag = #{delFlag,jdbcType=CHAR} | ||
200 | + where id = #{id,jdbcType=VARCHAR} | ||
201 | + </update> | ||
202 | +</mapper> |
-
请 注册 或 登录 后发表评论