新增库存过滤方式,新增内网版本更新
parent
9904fff69f
commit
30813b31bd
@ -0,0 +1,31 @@
|
||||
package com.glxp.api.controller.system;
|
||||
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.system.VersionEntity;
|
||||
import com.glxp.api.req.system.FilterVersionRequest;
|
||||
import com.glxp.api.service.system.VersionService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
public class VersionController {
|
||||
|
||||
|
||||
@Resource
|
||||
private VersionService versionService;
|
||||
|
||||
@GetMapping("/sale/version")
|
||||
public BaseResponse getVersion(@Valid FilterVersionRequest filterVersionRequest, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
VersionEntity versionEntity = versionService.getVersion(filterVersionRequest);
|
||||
return ResultVOUtils.success(versionEntity);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.api.dao.system;
|
||||
|
||||
import com.glxp.api.dao.BaseMapperPlus;
|
||||
import com.glxp.api.entity.system.VersionEntity;
|
||||
import com.glxp.api.req.system.FilterVersionRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface VersionDao extends BaseMapperPlus<VersionDao, VersionEntity, VersionEntity> {
|
||||
|
||||
VersionEntity getVersion(FilterVersionRequest filterVersionRequest);
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.entity.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VersionEntity {
|
||||
|
||||
private String id;
|
||||
private String type;
|
||||
private String versionName;
|
||||
private String versionCode;
|
||||
private String appName;
|
||||
private String createTime;
|
||||
private String downloadUrl;
|
||||
private String updateLog;
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.glxp.api.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterVersionRequest {
|
||||
|
||||
private String type;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.glxp.api.service.system;
|
||||
|
||||
|
||||
import com.glxp.api.entity.system.VersionEntity;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.system.FilterVersionRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VersionService {
|
||||
|
||||
boolean insertVersion(VersionEntity versionEntity);
|
||||
|
||||
boolean insertVersionList(List<VersionEntity> versionEntities);
|
||||
|
||||
VersionEntity getVersion(FilterVersionRequest filterVersionRequest);
|
||||
|
||||
boolean deleteVersion(DeleteRequest deleteVersionRequest);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.glxp.api.service.system.impl;
|
||||
|
||||
import com.glxp.api.dao.system.VersionDao;
|
||||
import com.glxp.api.entity.system.VersionEntity;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.system.FilterVersionRequest;
|
||||
import com.glxp.api.service.system.VersionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class VersionServiceImpl implements VersionService {
|
||||
|
||||
@Resource
|
||||
VersionDao versionDao;
|
||||
|
||||
@Override
|
||||
public boolean insertVersion(VersionEntity versionEntity) {
|
||||
return versionDao.insert(versionEntity) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertVersionList(List<VersionEntity> versionEntities) {
|
||||
return versionDao.insertBatch(versionEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionEntity getVersion(FilterVersionRequest filterVersionRequest) {
|
||||
return versionDao.getVersion(filterVersionRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteVersion(DeleteRequest deleteVersionRequest) {
|
||||
return versionDao.deleteById(deleteVersionRequest.getId()) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.system.VersionDao">
|
||||
<select id="getVersion" parameterType="com.glxp.api.req.system.FilterVersionRequest"
|
||||
resultType="com.glxp.api.entity.system.VersionEntity">
|
||||
select *
|
||||
from sys_app_version
|
||||
<where>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
</where>
|
||||
order by versionCode desc
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue