-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7539249
commit f40c5a4
Showing
17 changed files
with
224 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.blackstar.softwarelab.bean; | ||
|
||
import com.blackstar.softwarelab.entity.App; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AppInfo extends App { | ||
|
||
private Integer usedCount; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/blackstar/softwarelab/entity/AppExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.blackstar.softwarelab.entity; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import lombok.*; | ||
import lombok.experimental.Accessors; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* <p> | ||
* | ||
* </p> | ||
* | ||
* @author blackstar | ||
* @since 2020-10-25 | ||
*/ | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = false) | ||
@Accessors(chain = true) | ||
public class AppExtension implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@TableId | ||
private String appName; | ||
|
||
private Integer usedCount; | ||
|
||
private LocalDateTime createTime; | ||
|
||
private LocalDateTime updateTime; | ||
|
||
private Integer status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/blackstar/softwarelab/mapper/AppExtensionMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.blackstar.softwarelab.mapper; | ||
|
||
import com.blackstar.softwarelab.entity.AppExtension; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
|
||
/** | ||
* <p> | ||
* Mapper 接口 | ||
* </p> | ||
* | ||
* @author blackstar | ||
* @since 2020-10-25 | ||
*/ | ||
public interface AppExtensionMapper extends BaseMapper<AppExtension> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/blackstar/softwarelab/service/IAppExtensionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.blackstar.softwarelab.service; | ||
|
||
import com.blackstar.softwarelab.entity.AppExtension; | ||
import com.baomidou.mybatisplus.extension.service.IService; | ||
|
||
/** | ||
* <p> | ||
* 服务类 | ||
* </p> | ||
* | ||
* @author blackstar | ||
* @since 2020-10-25 | ||
*/ | ||
public interface IAppExtensionService extends IService<AppExtension> { | ||
|
||
void addUsedCount(String appName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/blackstar/softwarelab/service/impl/AppExtensionServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.blackstar.softwarelab.service.impl; | ||
|
||
import com.blackstar.softwarelab.common.DbConst; | ||
import com.blackstar.softwarelab.entity.AppExtension; | ||
import com.blackstar.softwarelab.mapper.AppExtensionMapper; | ||
import com.blackstar.softwarelab.service.IAppExtensionService; | ||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* <p> | ||
* 服务实现类 | ||
* </p> | ||
* | ||
* @author blackstar | ||
* @since 2020-10-25 | ||
*/ | ||
@Service | ||
public class AppExtensionServiceImpl extends ServiceImpl<AppExtensionMapper, AppExtension> implements IAppExtensionService { | ||
|
||
@Override | ||
public void addUsedCount(String appName) { | ||
LocalDateTime now = LocalDateTime.now(); | ||
AppExtension appExtension = this.getById(appName); | ||
if (appExtension != null) { | ||
// | ||
appExtension.setUsedCount(appExtension.getUsedCount() + 1) | ||
.setUpdateTime(now); | ||
} else { | ||
appExtension = AppExtension.builder() | ||
.appName(appName) | ||
.usedCount(1) | ||
.createTime(now) | ||
.updateTime(now) | ||
.status(DbConst.STATUS_NORMAL) | ||
.build(); | ||
|
||
} | ||
this.saveOrUpdate(appExtension); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.