代码
珠光
这个作者很懒,什么都没留下…
展开
-
动态数据源
动态数据库原创 2024-02-05 10:57:24 · 417 阅读 · 0 评论 -
inner join 与 left join ,right join之间的区别
换句话说,左表(A)的记录将会全部表示出来,而右表(B)只会显示符合搜索条件的记录(例子中为: A.aID = B.bID).很明显,这里只显示出了 A.aID = B.bID的记录.这说明inner join并不以谁为基础,它只显示符合条件的记录.仔细观察一下,就会发现,和left join的结果刚好相反,这次是以右表(B)为基础的,A表不足的地方用NULL填充.left join是以A表的记录为基础的,A可以看成左表,B可以看成右表,left join是以左表为准的.B表记录不足的地方均为NULL.原创 2024-02-05 10:56:14 · 391 阅读 · 0 评论 -
如何在Mybatis的xml文件调用java类的方法
使用的是ognl表达式。原创 2024-02-05 10:54:54 · 371 阅读 · 0 评论 -
jar包打成服务
4.将java程序重命名,去掉名称中的“.”。例如hello-1.0.jar ----> hello.jar。3. 将WinSW.NET4.exe文件复制到java程序所在文件夹中。5.将WinSW.exe重命名为hello.exe(和jar同名)1.在idea中用maven将程序打成jar,放到目录中。6. 新建一个xml文件,命名为hello.xml。8. 去windows服务列表中启动程序。原创 2021-12-08 11:39:12 · 1564 阅读 · 0 评论 -
EXCEL设置样式
// 获取合并单元格的宽度 public Map<String, Object> getCellInfo(HSSFCell cell) { HSSFSheet sheet = cell.getSheet(); int rowIndex = cell.getRowIndex(); int columnIndex = cell.getColumnIn...原创 2020-04-14 16:55:58 · 243 阅读 · 0 评论 -
kindediter富文本内容导出html文件
kindediter富文本导出原创 2022-11-17 09:27:28 · 318 阅读 · 0 评论 -
Springboot项目打成war包教程
一、修改项目pom.xml文件1、修改打包方案2、排除内嵌的tomcat,引入javax.servlet-api<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope><!-- 打成原创 2021-12-08 17:54:36 · 7280 阅读 · 0 评论 -
服务启动时调用sql
@Component@RequiredArgsConstructorpublic class StartListener implements ApplicationListener<ApplicationReadyEvent> { private final JdbcTemplate jdbcTemplate; @Override public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent)原创 2021-12-02 14:36:03 · 97 阅读 · 0 评论 -
敏感信息脱敏方法
public class MaskUtil { /** * 字符串做掩码处理 * @param strIn * @param preSize 前展示字符数 * @param suffixSize 后展示字符数 * @return * * 银行卡:前6后4 * 手机号码:前3后4 * 身份证号:前5后3 * 密码:前0后0 */ public static String strToMaskStr(String strIn,int preSize,int suf原创 2021-11-13 09:09:03 · 567 阅读 · 0 评论 -
@Valid注解
除此之外还可以自定义验证信息的要求@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})@Retention(RetentionPolicy.RUNTIME)@Repeatable(Phone.List.class)@Documented@Constraint.原创 2021-11-13 08:57:57 · 661 阅读 · 0 评论 -
RSA工具类
import sun.misc.BASE64Decoder;import javax.crypto.Cipher;import javax.servlet.ServletContext;import java.io.*;import java.security.KeyFactory;import java.security.PrivateKey;import java.security.PublicKey;import java.security.interfaces.RSAPrivateK原创 2021-03-26 17:08:37 · 118 阅读 · 0 评论 -
备份oracle数据库
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210312101006680.png @Value("${username}") private String username; //数据库用户 @Value("${password}") private String password; //数据库密码 @Value("${url}") private String url; //数据库连接url @Value("${oracle.name.原创 2021-03-12 10:17:23 · 91 阅读 · 0 评论 -
生成xml文件
/** * 生成xml文件 * * @param xmlStr * @param fileName * @param type * @param path * @return * @author allen_lu * @since 2019年12月12日10:43:15 */public void createXml(String xmlStr, String fileName, String ty...原创 2021-03-09 14:32:57 · 390 阅读 · 0 评论 -
post请求 http
public static String postParams(String url, Map<String, String> params, List<File> listFile) { // 获取连接客户端工具 CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = null; try原创 2021-03-09 14:30:49 · 236 阅读 · 0 评论 -
解压zip文件
import java.io.*;import java.nio.charset.Charset;import java.util.Enumeration;import java.util.zip.ZipEntry;import java.util.zip.ZipFile;public class ZipUtils { /** * 解压文件到指定目录 */ public static void unZipFiles(File zipFile, String原创 2021-03-08 18:01:31 · 107 阅读 · 0 评论 -
JSON劫持解决
public class MyFilter implements Filter { private Logger logger = LoggerFactory.getLogger(MyFilter.class); @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(Servle原创 2021-03-04 10:11:30 · 197 阅读 · 1 评论 -
FTP上传、获取文件
FTP上传文件public boolean uploadFile(String fileName) throws IOException { boolean upload=true; FileInputStream f=null; //filePath 要上传的文件路径 File file = new File(filePath + File.separator + fileName); FTPClient ftpClient原创 2020-10-27 15:07:19 · 512 阅读 · 0 评论 -
执行cmd命令
/** * 执行Cmd命令方法 * * @param command 相关命令 * @return 执行结果 */ // List<String> commands 是cmd命令每个字符的集合 public void runCommand(List<String> command) { ProcessBuilder builder = new ProcessBuilder(command); .原创 2020-09-14 18:58:50 · 1141 阅读 · 0 评论 -
图片和Base64字符串互转
/** * 图片转化成base64字符串 * * @param imgPath * @return */ public static String GetImageStr(String imgPath) { String imgFile = imgPath;// 待处理的图片 InputStream in = null; byte[] data = null; String encod.原创 2020-08-24 10:29:08 · 301 阅读 · 0 评论 -
支付宝支付方法
/** * 支付接口 */public void alyunPay() { AlipayTradePagePayModel model = new AlipayTradePagePayModel(); model.setOutTradeNo(outTradeNo); model.setTotalAmount(String.format("%.2f", usePlatFee)); model.setSubject(s...原创 2020-07-02 17:44:33 · 259 阅读 · 0 评论 -
微信支付方法
public void wxpay() { ApWxPayDTO awp = new ApWxPayDTO(); awp.setBody(subject);// 产品描述 awp.setOutTradeNo(outTradeNo);// 订单编号 awp.setTotalFee(100); //金额 String rootPath = “”; // 外部映射路径 awp.setNotifyUrl(原创 2020-07-02 17:32:35 · 159 阅读 · 0 评论 -
获取MAC地址
private String getMACAddress() throws Exception { InetAddress ia = InetAddress.getLocalHost(); byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress(); StringBuffer sb = new StringBuffer(); for (int i = 0...原创 2020-06-30 17:53:24 · 494 阅读 · 0 评论 -
上传文件的四种方法
(一)Channel管道 public static void main(String[] args) throws IOException { long start = System.currentTimeMillis(); FileChannel inChannel = FileChannel.open(Paths.get("D:" + File.separator + "upload.zip"), StandardOpenOption.READ);原创 2020-06-11 10:09:25 · 375 阅读 · 0 评论 -
pdf操作图片
1、pdf转成图片 public List<String> pdfTopng(String fileAddress, String filename, String type) { //fileAddress是文件夹地址 filename是文件地址 type是图片类型 如jpg List<String> list = new ArrayList<String>(); // 将pdf装图片 并且自定义图片得原创 2020-05-29 11:37:08 · 167 阅读 · 0 评论 -
PDF文件加载图片
/** * 生成带有章的文件 * * @param pdfPath * @param newPDFPath * @param imagePath * @author allen_lu */ public static void generatePDF(String pdfPath, String newPDFPath,...原创 2020-04-16 15:16:33 · 204 阅读 · 0 评论 -
生成pdf
public static class MyFontsProvider extends XMLWorkerFontProvider { public MyFontsProvider() { super(null, null); } @Override public Font getFont(final St...原创 2020-03-17 09:09:41 · 161 阅读 · 0 评论 -
Quartz定时任务
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www....原创 2020-03-16 18:02:38 · 89 阅读 · 0 评论 -
递归压缩文件zip
public class ZipRecuSionUtils { private static final int BUFFER_SIZE = 2 * 1024; /** * 递归压缩 * * @param sourceFile * @param zos * @param name * @param KeepDirStr...原创 2020-03-16 17:55:04 · 414 阅读 · 0 评论 -
Ftp下载
public class FtpClient extends BaseService { private FTPClient ftpClient; private void init() { try { ftpClient = new FTPClient(); //连接ftp服务器 ...原创 2020-03-16 17:42:18 · 176 阅读 · 0 评论 -
List集合排序
使用Comparator.comparing进行list排序控制台打印内容:原创 2020-03-13 17:13:02 · 82 阅读 · 0 评论 -
获取配置文件内容方法
(一) 通过Properties获取 try { Properties property = new Properties(); InputStream in = getClass().getClassLoader().getResourceAsStream("sinoupload.properties"); ...原创 2019-11-11 15:56:44 · 573 阅读 · 0 评论 -
批量更新字段(把表A的字段值复制到表B中)
update 表 A , 表 Bset A.name = B.name where A.id = B.id注:把要更新的目标字段放在等号前面。原创 2019-09-27 09:14:23 · 802 阅读 · 0 评论 -
Java int转String位数不足左补0(共12位)
方法一:sendXmlLen = String.format("%012d", sendXmlStr.length());方法二:StringBuilder lengthStr = new StringBuilder(Objects.toString(sendXmlStr.length()));int length = lengthStr.length();if (length <...原创 2019-09-10 11:35:50 · 1310 阅读 · 0 评论