data:SQL、equals

1.equals和equalsIgnoreCase

equals区分大小写,equalsIgnoreCase不区分大小写

SQL

select ... from dual

1.Date和String转化

to_Char(Date d,'yyyy-mm-ss') 

to_Date(String str,'yyyy-mm-ss')

标识:

年    月    日    时(HH为12制)    分    秒

YYYY-MM/mm-DD HH/HH24:MI:SS

https://www.cnblogs.com/markXin/p/6406572.html

2.String 连接

concat

3.varchar操作

length(property):长度

instr,substr,replace

substr('mining',a,[b]):从第a位截取b个字符:a=0/1都表示第一位:a为负数时表示从右向左数第|a|为开始:b可以不写

instr('string','str',[a],[b]):string的第a位开始,第b次出现str的位置:1~n

upper(property),lower(property):大小写转换

round(x,[y]):x四舍五入y位:y可为负数:y为小数时取整数位

trunc(x,[y]):

(1)x为number

x按精度y截取:y可为负数

(2)x为sysdate

trunc(sysdate,'yyyy') --返回当年第一天。

trunc(sysdate,'mm') --返回当月第一天。

  trunc(sysdate,'d') --返回当前星期的第一天

4.distinct去重

5.当前时间sysdate

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用一个条件语句来代替break和continue语句。在需要退出循环的地方设置一个boolean类型的变量,然后在循环结束后根据该变量的值判断是否需要继续执行。例如: ``` boolean shouldContinue = false; for (SysRole role : user.getRoles()) { String dataScope = role.getDataScope(); if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope)) { continue; } if (StringUtils.isNotEmpty(permission) && StringUtils.isNotEmpty(role.getPermissions()) && !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) { continue; } if (DATA_SCOPE_ALL.equals(dataScope)) { sqlString = new StringBuilder(); conditions.add(dataScope); shouldContinue = true; } else { conditions.add(dataScope); if (DATA_SCOPE_CUSTOM.equals(dataScope)) { sqlString.append(StringUtils.format( " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, role.getRoleId())); } else if (DATA_SCOPE_DEPT.equals(dataScope)) { sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { sqlString.append(StringUtils.format( " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptAlias, user.getDeptId(), user.getDeptId())); } else if (DATA_SCOPE_SELF.equals(dataScope)) { if (isNotBlank(userAlias)) { sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); } else { // 数据权限为仅本人且没有userAlias别名不查询任何数据 sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); } } } if (shouldContinue) { break; } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值