切面的简单用法
@Aspect
@Component
public class LogInterceptor {
@Pointcut("execution(public * com.talentcard.web.controller.*.*(..))")
public void log() {
}
@Before("log()")
public void deoBefore(JoinPoint joinPoint) {
System.out.println("!!!!!!!!!!!!");
}
}
数据库mysql
数据库是t_talent t的card_type(tinyint)和talent_source(int) 对象是byte和Integer
一个页面可以对应多个url请求,得到数据,填充数据
Mysql的CDATA 部分语法: "<![CDATA[" "]]>" :
<![CDATA["原始的sql语句"]]>
好像是子表左连接父表
我测试父表左连接子表会出现数据缺少的情况
微信微服务模块
http 调用
HttpEntity<String> entity = new HttpEntity<>(jsonObject.toString(), headers);
//jsonObject:map打印出来的是不一样的
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url,
HttpMethod.GET, entity, JSONObject.class);//entity还可以设置header,header还可以设置表单形式发送
“trueString”.equal(testStr)==true;
@RequestHeader String token
com.thoughtworks.xstream.XStream作用:将对象转为xml,将集合转为xml,
<!--JSONObject.fromObject()-->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
Front模块
Association 用于一对一,
<resultMap id="TalentResultMap" type="com.talentcard.common.bo.TalentBO">
<id column="t_talent_id" jdbcType="BIGINT" property="talentId"/>
<collection property="educationPOList" ofType="com.talentcard.common.pojo.EducationPO">
<id column="e_educ_id" jdbcType="BIGINT" property="educId"/>
Url,返回类型,参数...,竟然可以直接加参数token
String userInfo = new RestTemplate().getForObject("url",String.class, AccessTokenUtil.getAccessToken(), openId);
日历得到一天中的最后一天
int Day = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);//31
小程序
MultipartFile file = ((MultipartHttpServletRequest) req).getFile("file"); 类型强转
Web
退出
// 遍历request中的session,作删除
Enumeration em = request.getSession().getAttributeNames();
while (em.hasMoreElements()) {
request.getSession().removeAttribute(em.nextElement().toString());
}
生成随机数
Random r = new Random();
int n2 = r.nextInt(10);
ImageIO.write(image, "png",ByteArrayOutputStream baos);
byte[] bytes = baos.toByteArray();
string png_base64 = encoder.encodeBuffer(bytes).trim();
生成图片验证码是很成熟,可以参考别人的代码,自己写还是很麻烦的