1、mysql中查询一个数据库中的所有表
SELECT
table_name, table_commentFROMinformation_schema.tablesWHERE table_schema = 'ysy_cat';2、mybatis plus查询日期区间
AND soo.stock_out_date =]]> #{beginDate} AND soo.stock_out_date #{endDate} 3、mysql中将datetime转换为date类型: SELECT CONVERT('传入的时间',DATE) 4、mybatis中if-else写法
5、sourcetree錯誤:error: Your local changes to the following files would be overwritten by merge:解決办法 git stash git pull origin master git stash pop 6、mybatis中模糊查询 #{item.id,jdbcType=CHAR}, '',
AND u.name LIKE CONCAT(CONCAT('%',#{applicantId},'%')) 7、
SELECT LAST_INSERT_ID() INSERT INTO ca_stock_out_order (warehouse_id,code,create_id,create_time) VALUE (#{warehouseId},#{code},#{createId},#{createTime})--------- SELECT LAST_INSERT_ID() INSERT INTO ca_stock_out_order_item (stock_out_order_id,asset_id,quantity,in_order_item_type) values( #{orderItemVos.stockOutOrderId}, #{orderItemVos.assetId}, #{orderItemVos.quantity}, #{orderItemVos.orderItemType} )
select STR_TO_DATE(#{startTime},'%H:%i:%s') 将字符串转为想要的时间格式
select str_to_date(‘09/01/2009’,’%m/%d/%Y’)
select str_to_date(‘20140422154706’,’%Y%m%d%H%i%s’)
select str_to_date(‘2014-04-22 15:47:06’,’%Y-%m-%d %H:%i:%s’)
-----------------------------------
23 ------------------------------- 获取上个月,下个月5 SELECT LAST_INSERT_ID() 6 7 insert into redeem_code 8 (bach_id, code, type, facevalue,create_user,create_time) 9 values1011 (12 #{reddemCode.batchId}, #{reddemCode.code},13 #{reddemCode.type},14 #{reddemCode.facevalue},15 #{reddemCode.createUser}, #{reddemCode.createTime}16 )17 18
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); Date dt = sdf.parse(yearsMonth); Calendar rightNow = Calendar.getInstance(); rightNow.setTime(dt); rightNow.add(Calendar.MONTH, -1); Date dt1 = rightNow.getTime(); ------------------------- 日期校验public boolean isValidDate(String s){ try { // 指定日期格式为四位年/两位月份/两位日期,注意yyyy-MM-dd其中MM为大写 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm"); // 设置lenient为false. 否则SimpleDateFormat会比较宽松地验证日期,比如2004/02/29会被接受,并转换成2004/03/01 dateFormat.setLenient(false); dateFormat.parse(s); return true; }catch (Exception e) { // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 return false; }}
-------------------------------
CONCAT_WS(' ',(SELECT DATE_FORMAT(applicant.start_date,'%Y-%m-%d')), CONCAT((SELECT DATE_FORMAT(applicant.start_date,'%H:%i')),'-',(SELECT DATE_FORMAT(applicant.end_date,'%H:%i')))) AS times,
----------------------------------------------------
java获取移动端ip地址
String ipAddress = request.getRemoteAddr();
if(ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")){ //根据网卡获取本机配置的IP地址 InetAddress inetAddress = null; try { inetAddress = InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace(); } ipAddress = inetAddress.getHostAddress(); } //对于通过多个代理的情况,第一个IP为客户端真实的IP地址,多个IP按照','分割 if(null != ipAddress && ipAddress.length() > 15){ if(ipAddress.indexOf(",") > 0){ ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); } }-------------------------------------------前台出入的日期格式化
@DateTimeFormat(pattern = "yyyy-MM")@RequestParam(value = "date", required = false) Date date