@@ -1,10 +1,10 @@ | |||
package cn.com.taiji.core.entity.comm; | |||
import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.dict.EnableStatus; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import org.hibernate.annotations.Where; | |||
import javax.persistence.*; | |||
import java.time.LocalDateTime; | |||
@@ -13,6 +13,7 @@ import java.time.LocalDateTime; | |||
@Getter | |||
@Entity | |||
@Table(name = "COMM_APP_VERSION") | |||
@Where(clause = "DELETED = 0") | |||
public class CommonAppVersion extends StringPropertyUUIDEntity { | |||
@Column(name = "RELEASE_TIME") |
@@ -7,6 +7,7 @@ import cn.com.taiji.core.entity.dict.operation.TextType; | |||
import cn.com.taiji.core.entity.dict.operation.TriggerType; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import org.hibernate.annotations.Where; | |||
import java.time.LocalDateTime; | |||
import javax.persistence.*; | |||
@@ -15,6 +16,7 @@ import javax.persistence.*; | |||
@Getter | |||
@Setter | |||
@Table(name = "MANAGEW_NOTICE_FLASH") | |||
@Where(clause = "DELETED = 0") | |||
public class NoticeFlash extends AbstractStringPropertyUUIDEntity { | |||
@Column(name = "TITLE") |
@@ -27,7 +27,7 @@ public class AppVersionPageRequest extends JpaPageableDataRequest<CommonAppVersi | |||
@Override | |||
public HqlBuilder toSelectHql() { | |||
HqlBuilder hql = new HqlBuilder("from " + CommonAppVersion.class.getName() + " where 1=1 and deleted = 0"); | |||
HqlBuilder hql = new HqlBuilder("from " + CommonAppVersion.class.getName() + " where 1=1"); | |||
hql.append(" and version like :version ", like(version)); | |||
hql.append(" and status = :status ", status); | |||
hql.append(" and releaseTime >= :startTime ", startTime); |
@@ -8,6 +8,7 @@ import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
@Setter | |||
@Getter | |||
@@ -19,7 +20,7 @@ public class AppVersionUpdateStatusRequestDTO extends AbstractStaffBizRequestDTO | |||
private String id; | |||
@ApiModelProperty(value = "状态") | |||
@NotBlank(message = "状态不能为空") | |||
@NotNull(message = "状态不能为空") | |||
private EnableStatus status; | |||
@@ -61,9 +61,11 @@ public class AppVersionManagerImpl extends AbstractManagewManager implements App | |||
if (appVersion == null){ | |||
throw new ManagerException("未获取到该版本数据"); | |||
} | |||
CommonAppVersion version = appVersionRepo.findByVersion(dto.getVersion()); | |||
if (version != null){ | |||
throw new ManagerException("当前版本已存在"); | |||
if (appVersion.getVersion() != dto.getVersion()){ | |||
CommonAppVersion version = appVersionRepo.findByVersion(dto.getVersion()); | |||
if (version != null){ | |||
throw new ManagerException("当前版本已存在"); | |||
} | |||
} | |||
BeanTools.copyProperties(dto, appVersion); | |||
appVersion.setUpdateTime(LocalDateTime.now()); | |||
@@ -83,7 +85,7 @@ public class AppVersionManagerImpl extends AbstractManagewManager implements App | |||
if (appVersion.getStatus() == EnableStatus.ENABLE){ | |||
throw new ManagerException("该版本启用状态,不能删除"); | |||
} | |||
appVersion.setDeleted(false); | |||
appVersion.setDeleted(true); | |||
appVersionRepo.persist(appVersion); | |||
//日志 | |||
persistOperateLog(OperateType.APP_VERSION_DELETE, appVersion.getId(), dto.getOrderSource(), findOpenIdByToken(dto.getAccessToken()), "APP版本删除"); |