Commit c3d9f31c authored by hanfeng's avatar hanfeng

app上传

parent 05b38cac
package com.xxfc.platform.app.vo;
import lombok.Data;
@Data
public class appVersionQuery {
private Integer page;
private Integer limit;
/**
* 版本名称
*/
private String versionName;
/**
* 版本号
*/
private String version;
/**
* 更新内容
*/
private String content;
}
package com.xxfc.platform.app.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.vo.appVersionQuery;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.RowBounds;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
......@@ -124,13 +128,10 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
appVersion.setDownloadSwitch(0);
insertSelective(appVersion);
}
public AppVersion get(Integer id) {
if (id==null) {
throw new IllegalArgumentException("Parameter is null");
}
return selectById(id);
}
......@@ -138,7 +139,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
* 修改一条信息
* @param appVersion
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
public void updateAppVersionById(AppVersion appVersion) {
updateSelectiveById(appVersion);
}
......@@ -155,4 +156,11 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
.build();
mapper.updateByExampleSelective(appVersion,example);
}
public PageInfo<AppVersion> getAll(appVersionQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit());
List<AppVersion> appVersionList = mapper.getAllByquery(query);
return PageInfo.of(appVersionList);
}
}
\ No newline at end of file
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.AppVersion;
import com.xxfc.platform.app.vo.appVersionQuery;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
*
*
......@@ -12,4 +16,5 @@ import tk.mybatis.mapper.common.Mapper;
*/
public interface AppVersionMapper extends Mapper<AppVersion> {
List<AppVersion> getAllByquery(appVersionQuery query);
}
package com.xxfc.platform.app.rest;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.biz.AppVersionBiz;
import com.xxfc.platform.app.entity.AppVersion;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.vo.appVersionQuery;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import io.swagger.annotations.ApiModelProperty;
......@@ -51,7 +54,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@Override
@ApiOperation("添加")
@RequestMapping(value = "/add",method = RequestMethod.POST)
@RequestMapping(value = "/background/add",method = RequestMethod.POST)
public ObjectRestResponse<AppVersion> add(@RequestBody AppVersion appVersion){
baseBiz.insertAppVersion(appVersion);
return new ObjectRestResponse<AppVersion>();
......@@ -59,21 +62,27 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@ApiOperation("查询")
@RequestMapping(value = "/getAppVersion/{id}",method = RequestMethod.GET)
@RequestMapping(value = "/background/getAppVersion/{id}",method = RequestMethod.GET)
public ObjectRestResponse<AppVersion> getAppVersion(@PathVariable Integer id){
return ObjectRestResponse.succ(baseBiz.get(id));
}
@ApiOperation("查询所有")
@RequestMapping(value = "/background/getAppVersions",method = RequestMethod.POST)
public ObjectRestResponse<PageInfo<AppVersion>> getAppVersions(@RequestBody appVersionQuery query){
return ObjectRestResponse.succ(baseBiz.getAll(query));
}
@Override
@ApiOperation("修改")
@RequestMapping(value = "/update/{id}",method = RequestMethod.PUT)
@RequestMapping(value = "/background/update/{id}",method = RequestMethod.PUT)
public ObjectRestResponse<AppVersion> update(@RequestBody AppVersion appVersion){
baseBiz.updateAppVersionById(appVersion);
return new ObjectRestResponse<AppVersion>();
}
@ApiOperation("删除")
@DeleteMapping(value = "/remove/{id}")
@DeleteMapping(value = "/background/remove/{id}")
public ObjectRestResponse<AppVersion> remove(@PathVariable Integer id){
baseBiz.remove(id);
return new ObjectRestResponse<AppVersion>();
......
<?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.xxfc.platform.app.mapper.AppVersionMapper">
<select id="getAllByquery" parameterType="com.xxfc.platform.app.vo.appVersionQuery"
resultType="com.xxfc.platform.app.entity.AppVersion">
select * from app_version
where 1=1
<if test="versionName !=null and versionName != ''">
and version_name like concat('%',#{versionName},'%')
</if>
<if test="version !=null and version != ''">
and version like concat('%',#{version},'%')
</if>
<if test="content != null and content != ''">
and content like concat('%',#{content},'%')
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment