Browse Source

品类删除时,将后续序号前移一位

anderx 8 years ago
parent
commit
8b48c7abf6

+ 1 - 1
src/main/java/com/goafanti/achievement/bo/AchievementListBo.java

@@ -382,7 +382,7 @@ public class AchievementListBo {
 
 
 	public String getCountInterest() {
-		if (StringUtils.isBlank(countInterest)) countInterest = "0";
+		if (StringUtils.isBlank(countInterest)) countInterest = "20";
 			return String.valueOf(Integer.valueOf(countInterest)+20);
 	}
 

+ 3 - 0
src/main/java/com/goafanti/achievement/bo/AchievementUserOwnerDetailBo.java

@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import com.goafanti.common.utils.StringUtils;
+
 public class AchievementUserOwnerDetailBo extends AchievementOrgOwnerDetailBo {
 	
 	private Integer province;
@@ -105,6 +107,7 @@ public class AchievementUserOwnerDetailBo extends AchievementOrgOwnerDetailBo {
 	}
 
 	public String getCountInterest() {
+		if (StringUtils.isBlank(CountInterest)) CountInterest = "20";
 		return String.valueOf(Integer.valueOf(CountInterest)+20);
 	}
 

+ 1 - 1
src/main/java/com/goafanti/business/controller/AdminVarietiesApiController.java

@@ -17,7 +17,7 @@ import com.goafanti.common.dao.BusinessVarietiesMapper;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.utils.StringUtils;
 @RestController
-@RequestMapping("/api/admin/Varieties")
+@RequestMapping("/open/api/admin/Varieties")
 public class AdminVarietiesApiController extends CertifyApiController{
 	@Resource
 	private BusinessVarietiesService businessVarietiesService;

+ 3 - 2
src/main/java/com/goafanti/business/service/impl/BusinessVarietiesServiceImpl.java

@@ -197,13 +197,14 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 	public int deleteState(String id) {
 		BusinessVarieties bs=new BusinessVarieties();
 		bs=businessVarietiesMapper.selectByPrimaryKey(id);
-		
 		if (0 ==bs.getDeleteSign()) {
 			bs.setDeleteSign(1);
 		}else {
 			bs.setDeleteSign(0);
 		}
-		
+		if (null!=bs.getSort()) {
+			businessVarietiesMapper.updateFollowSort(bs.getSort());
+		}
 		return businessVarietiesMapper.updateByPrimaryKey(bs);
 	}
 	@Override

+ 2 - 0
src/main/java/com/goafanti/common/dao/BusinessVarietiesMapper.java

@@ -104,4 +104,6 @@ public interface BusinessVarietiesMapper {
 	String getSortMax();
 
 	BusinessVarieties selectBySort(Integer sort);
+
+	int updateFollowSort(Integer sort);
 }

+ 6 - 0
src/main/java/com/goafanti/common/mapper/BusinessVarietiesMapper.xml

@@ -542,4 +542,10 @@
     from business_varieties
     where sort = #{sort,jdbcType=VARCHAR}
   </select>
+  
+  <update id="updateFollowSort" parameterType="com.goafanti.common.model.BusinessVarieties">
+    update business_varieties
+    set sort = sort-1
+    where sort > #{sort,jdbcType=VARCHAR}
+  </update>
 </mapper>