INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('SELECT * FROM users WHERE age > 18;','添加索引优化查询','SELECT * FROM users USE INDEX (idx_age) WHERE age > 18;','2024-05-03 10:20:15','张工','已完成','原查询全表扫描效率低');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('for(int i=0; i<list.size(); i++) {...}','使用增强for循环提高可读性','for(Object item : list) {...}','2024-05-10 14:35:40','李工','已完成','原始循环语法不够简洁');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('public void process() { if(condition) {...} else {...} }','提取条件判断为独立方法','private boolean isConditionMet() { return condition; } public void process() { if(isConditionMet()) {...} else {...} }','2024-05-15 09:10:25','王工','已完成','方法逻辑复杂，可读性差');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('String result = ""; for(String s : list) { result += s; }','使用StringBuilder替代字符串拼接','StringBuilder sb = new StringBuilder(); for(String s : list) { sb.append(s); } String result = sb.toString();','2024-05-22 16:40:10','赵工','已完成','字符串拼接性能差');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('if(obj != null && obj.getValue() != null) {...}','使用Optional类处理空值','Optional.ofNullable(obj).map(Object::getValue).ifPresent(value -> {...});','2024-05-28 11:25:30','周工','已完成','空值判断代码冗余');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('public void calculate(int a, int b) { return a + b; }','添加方法注释和参数校验','/** 计算两数之和 */ public int calculate(int a, int b) { if(a < 0 || b < 0) throw new IllegalArgumentException("参数不能为负数"); return a + b; }','2024-06-02 13:50:45','吴工','已完成','缺少必要的注释和参数校验');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('List<Integer> list = new ArrayList<>(); for(int i=0; i<10; i++) { list.add(i); }','使用Stream API简化集合创建','List<Integer> list = IntStream.range(0, 10).boxed().collect(Collectors.toList());','2024-06-08 10:05:20','郑工','已完成','原始方式代码冗长');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('switch(type) { case "A": return 1; case "B": return 2; default: return 0; }','使用Map替代复杂switch','private static final Map<String, Integer> TYPE_MAPPING = Map.of("A", 1, "B", 2); return TYPE_MAPPING.getOrDefault(type, 0);','2024-06-15 15:30:15','钱工','已完成','Switch语句扩展性差');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('if(age > 18 && gender.equals("male")) {...}','提取条件为有意义的变量','boolean isAdultMale = age > 18 && gender.equals("male"); if(isAdultMale) {...}','2024-06-20 09:45:30','孙工','已完成','条件表达式复杂难以理解');
INSERT INTO `crpm_95e998_7f7a78` (`dmpd`,`zgjy`,`zghdm`,`zgsj`,`zgz`,`zgzt`,`zgyy`) VALUES ('public void saveData(String data) { FileWriter fw = null; try { fw = new FileWriter("data.txt"); fw.write(data); } catch(Exception e) { e.printStackTrace(); } finally { if(fw != null) fw.close(); } }','使用try-with-resources语句','public void saveData(String data) { try(FileWriter fw = new FileWriter("data.txt")) { fw.write(data); } catch(Exception e) { e.printStackTrace(); } }','2024-06-25 14:20:40','杨工','已完成','资源关闭处理繁琐且不安全');