注解搜集大全

@Param

实例一 @Param注解单一属性

dao层示例

Public User selectUser(@param(“userName”) String name,@param(“userpassword”) String password);

xml映射对应示例

 

    1. <select id=" selectUser" resultMap="BaseResultMap">  
    2.    select  *  from user_user_t   where user_name = #{userName,jdbcType=VARCHAR} and user_password=#{userPassword,jdbcType=VARCHAR}  
    3. </select>

jackjson的相关注解

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.5</version>
</dependency>

@JsonIgnoreProperties

  此注解是类注解,作用是json序列化时将java bean中的一些属性忽略掉,序列化和反序列化都受影响。

  @JsonIgnoreProperties({"name"},{"age"})

 

@JsonIgnore

  此注解用于属性或者方法上(最好是属性上),作用和上面的@JsonIgnoreProperties一样。

  生成json 时不生成age 属性

@JsonIgnore

private int age;

 

@JsonFormat

此注解用于属性或者方法上(最好是属性上),可以方便的把Date类型直接转化为我们想要的模式,比如

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

 

@DatetimeFormat是将String转换成Date,一般前台给后台传值时用

 

@PropertySource({"classpath:application.properties"})


@ConfigurationProperties(prefix = "spring.datasource.test1")

下面是application.properties
spring.datasource.test1.jdbc-url=jdbc:mysql://localhost:3306/spms-prod?useSSL=false&serverTimezone=GMT%2B8&characterEncoding=UTF-8
spring.datasource.test1.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.test1.username=root
spring.datasource.test1.password=root

spring.datasource.test2.jdbc-url=jdbc:sqlserver://localhost:1433;DatabaseName=KmenOneCard2
spring.datasource.test2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.test2.username=sa
spring.datasource.test2.password=root

spring.datasource.use-lock=true

server.port=8084

mybatis.mapper-locations= classpath*:mapper/*/*.xml
mybatis.type-aliases-package=com.hainei.mapper.*
pagehelper.helper-dialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql

spring.jackson.time-zone= GMT+8

#influxDB
influxDBUserName=admin
influxDBPassword= hainei1205
influxDBOpenurl=http://192.168.1.145:8086
influxDBDatabase= newopc

opcIp: 192.168.100.231
opcUserName: Administrator
opcPassWord: Abc.123+
opcCode: D66FD91F-927D-47df-B074-EB2CD3F85C18

 

posted @ 2019-12-19 15:01  wq9  阅读(119)  评论(0)    收藏  举报