闲杂小记(l六)
来源:互联网 发布:php array判断 编辑:程序博客网 时间:2024/03/29 12:58
图记、精选、宝宝标签、家庭共享接口实现:
收获:
1:不需要的字段尽量不要写在请求数据类型或者应答数据类型中
2:如果不能穿null,则能使用基本数据类型的尽量使用数据类型
3:编辑时可用考虑不修改的字段传null,表示不修改改字段
4:String类型字段的需要校验最大长度
if (userID < 1L || params == null || StringUtils.isBlank(params.getCoverImgPath()) || StringUtils.isBlank(params.getTitle()) || (null!=params.getCoverImgPath()&¶ms.getCoverImgPath().length()>128) //// TODO: 16/8/22 || (null!=params.getTitle()&¶ms.getTitle().length()>14) || (null!=params.getDescription()&¶ms.getDescription().length()>108)) { throw new IllegalArgumentException("checkDeleteGrowUpInfoParams fail!");}
5:数组也可以使用增强for遍历
long[] addPids = editAlbumParam.getAddPids(); //如果需要添加图片就添加图记与图片的关系 if (null != addPids && addPids.length >= 1L) {//// TODO: 16/8/18 DONE //添加图片与图记的关系 for (long pid : addPids) {// Long pid = addPids[i]; //建立图记与图片关系 AlbumPictureRelation albumPictureRelation = generateAlbumPictureRelation(aid, pid); albumPictureRelationMapper.insert(albumPictureRelation); }6:delete使用别名时需要在delete 后面也加同一别名
<delete id="deleteBabyTag"> delete bt from baby_tag as bt where bt.entity_id= #{entityId,jdbcType=BIGINT} AND bt.baby_id=#{babyId,jdbcType=BIGINT} AND bt.entity_type=#{entityType,jdbcType=INTEGER}</delete>7:可以在注解中写入名字加以区分
@Controller("newAlbumController")// @Controller@RequestMapping("/api/v2/album")public class AlbumController {
@Qualifier("newAlbumMapper")private AlbumMapper albumMapper;8:mapper重名,扫描多个包时配置
<!-- sessionFactory 将spring和mybatis整合 --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:sqlMapConfig.xml" /> <!--<property name="mapperLocations" value="classpath:main/java/**/*.xml,com/ibbpp/api/mapper/*.xml" /> <!– 加载mapper文件 –>--> <property name="mapperLocations" value="classpath:**/mapper/*Mapper.xml" /></bean>
0 0
- 闲杂小记(l六)
- 闲杂小记(一)
- 闲杂小记(二)
- 闲杂小记(三)
- 闲杂小记(四)
- 闲杂小记(五)
- 闲杂小记(七)
- 闲杂小记(八)
- 闲杂
- Gym小记(六)
- 工作小记(六)----学习方法
- 配套自测l连载(六)
- Deep Learning L教程(六)
- 午饭时间闲杂
- 春闲杂吟
- 闲杂(待完善)
- android闲杂笔记
- jquery闲杂笔记
- Cocos2d-x 3.X 事件分发机制
- 嵌入式复习9
- 开发记录---python爬虫之gooseeker尝试
- aptitude命令的使用
- 疑问解答
- 闲杂小记(l六)
- hdu3535AreYouBusy(分组背包问题)
- jQuery修改DOM结构
- C#多线程编程
- 史上最佳 Mac+PhpStorm+XAMPP+Xdebug 集成开发和断点调试环境的配置
- oracle中的as
- webpack-react
- 实现拖拽进度条
- ios静态库.a文件打包