public void update(AvatarAccessoryInfoEntity userAvatarAccessoryEntity) {
? ? ? ? //如果name 和圖層相同可以直接更新
? ? ? ? AvatarAccessoryInfoEntity original = userAvatarAccessoryDao.findById(userAvatarAccessoryEntity.getId());
? ? ? ? if(userAvatarAccessoryEntity.getName().equals(original.getName()) &&
? ? ? ? ? Objects.equals(userAvatarAccessoryEntity.getLayer(),original.getLayer())){
? ? ? ? ? ? int row = userAvatarAccessoryDao.update(userAvatarAccessoryEntity);
? ? ? ? ? ? if (row != 1) {
? ? ? ? ? ? ? ? throw new AppRuntimeException("更新失敶葱埂思杯!");
? ? ? ? ? ? }
? ? ? ? ? ? return;
? ? ? ? } else if(Objects.equals(userAvatarAccessoryEntity.getLayer(),original.getLayer()) ){
? ? ? ? ? ? int name = userAvatarAccessoryDao.getName(userAvatarAccessoryEntity.getName());
? ? ? ? ? ? if (name == 1) {
? ? ? ? ? ? ? ? ? ? throw new AppRuntimeException("掛飾名稱已經(jīng)被創(chuàng)建");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? int row = userAvatarAccessoryDao.update(userAvatarAccessoryEntity);
? ? ? ? ? ? if (row != 1) {
? ? ? ? ? ? ? ? throw new AppRuntimeException("更新失敯跄 已卸!");
? ? ? ? ? ? }
? ? ? ? ? ? return;
? ? ? ? }else if (userAvatarAccessoryEntity.getName().equals(original.getName())) {
? ? ? ? ? ? int layer = userAvatarAccessoryDao.getLayer(userAvatarAccessoryEntity.getLayer());
? ? ? ? ? ? if (layer == 1) {
? ? ? ? ? ? ? ? throw new AppRuntimeException("掛件圖片圖層位置重復(fù)");
? ? ? ? ? ? }
? ? ? ? ? ? int row = userAvatarAccessoryDao.update(userAvatarAccessoryEntity);
? ? ? ? ? ? if (row != 1) {
? ? ? ? ? ? ? ? throw new AppRuntimeException("更新失斏芑怼!");
? ? ? ? ? ? }
? ? ? ? ? ? return;
? ? ? ? }
? ? ? ? UNIQUENESS_CHECK.lock();
//? ? ? ? ? ? 名稱唯一查詢
? ? ? ? ? ? try {
? ? ? ? ? ? ? ? int name = userAvatarAccessoryDao.getName(userAvatarAccessoryEntity.getName());
? ? ? ? ? ? ? ? int layer = userAvatarAccessoryDao.getLayer(userAvatarAccessoryEntity.getLayer());
? ? ? ? ? ? ? ? if (name == 1) {
? ? ? ? ? ? ? ? ? ? throw new AppRuntimeException("掛飾名稱已經(jīng)被創(chuàng)建");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? if (layer == 1) {
? ? ? ? ? ? ? ? ? ? throw new AppRuntimeException("掛件圖片圖層位置重復(fù)");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? int row = userAvatarAccessoryDao.update(userAvatarAccessoryEntity);
? ? ? ? ? ? ? ? if (row != 1) {
? ? ? ? ? ? ? ? ? ? throw new AppRuntimeException("更新失斀呋洹支子!");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? } finally {
? ? ? ? ? ? ? ? UNIQUENESS_CHECK.unlock();
? ? ? ? ? ? }
? ? ? ? }