Showing
3 changed files
with
13 additions
and
0 deletions
@@ -16,6 +16,8 @@ public interface ResourcesMapper { | @@ -16,6 +16,8 @@ public interface ResourcesMapper { | ||
16 | 16 | ||
17 | Resources selectDefaultByCode(String code); | 17 | Resources selectDefaultByCode(String code); |
18 | 18 | ||
19 | + Resources selectActiveByCode(String code); | ||
20 | + | ||
19 | int insert(Resources record); | 21 | int insert(Resources record); |
20 | int updateByPrimaryKeySelective(Resources record); | 22 | int updateByPrimaryKeySelective(Resources record); |
21 | 23 |
@@ -31,6 +31,12 @@ | @@ -31,6 +31,12 @@ | ||
31 | limit 1 | 31 | limit 1 |
32 | </select> | 32 | </select> |
33 | 33 | ||
34 | + <select id="selectActiveByCode" resultType="com.yoho.ufo.model.resource.Resources"> | ||
35 | + select <include refid="Base_Column_List" /> from resources | ||
36 | + where status=1 and code = #{code} and publish_time >= unix_timestamp() order by publish_time,id | ||
37 | + limit 1 | ||
38 | + </select> | ||
39 | + | ||
34 | <select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources"> | 40 | <select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources"> |
35 | select <include refid="Base_Column_List" /> from resources | 41 | select <include refid="Base_Column_List" /> from resources |
36 | <include refid="pageCondition"/> | 42 | <include refid="pageCondition"/> |
@@ -226,6 +226,11 @@ public class ResourceServiceImpl implements IResourceService{ | @@ -226,6 +226,11 @@ public class ResourceServiceImpl implements IResourceService{ | ||
226 | if (thisResource == null) { | 226 | if (thisResource == null) { |
227 | throw new PlatformException("源资源位不存在", 500); | 227 | throw new PlatformException("源资源位不存在", 500); |
228 | } | 228 | } |
229 | + | ||
230 | + Resources active = resourcesMapper.selectActiveByCode(thisResource.getCode()); | ||
231 | + if (active.getId().equals(bo.getId())) { | ||
232 | + throw new PlatformException("正在生效的资源位不能修改", 500); | ||
233 | + } | ||
229 | } | 234 | } |
230 | // 更新时间 | 235 | // 更新时间 |
231 | if (bo.getId() != null && StringUtils.isNotBlank(bo.getPublishTimeStr()) && bo.getCopyFromId() == null) { | 236 | if (bo.getId() != null && StringUtils.isNotBlank(bo.getPublishTimeStr()) && bo.getCopyFromId() == null) { |
-
Please register or login to post a comment