public Integer insertObjects(final Goods entity) { // 定义sql语句 final String sql1 = "insert into goods(name,price,cid)values(?,?,?)"; /* * int num = jdbcTemplate.update(sql1, new Object[] { entity.getName(), * entity.getPric…
项目中通常有些需求为需要将某个sObject的数据列表按照某种规则排序显示到前台页面上,但是list上面的sort远远满足不了复杂的功能,此种情况需要自定义比较两个object大小的方法,所以需要创建Compare相关的类实现Comparable接口. 需求:实现Goods__c列表排序,GoodsBrand__c为华为的按照价格升序排序,GoodsBrand__c为联想的按照价格降序排列. public without sharing class ComparedGoods implement…