app版本记录
This commit is contained in:
parent
79412c21de
commit
5790b234ef
|
|
@ -0,0 +1,91 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmAppVersion;
|
||||
import com.bonus.bmw.service.BmAppVersionService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP版本表(bm_app_version)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bm_app_version")
|
||||
public class BmAppVersionController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private BmAppVersionService service;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param o
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false), requiresPermissions = @RequiresPermissions("worker:question:list"))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "APP版本更新记录", businessType = OperaType.QUERY, logType = 0, module = "APP版本更新记录", details = "APP版本更新记录")
|
||||
public TableDataInfo list(BmAppVersion o) {
|
||||
try {
|
||||
startPage();
|
||||
List<BmAppVersion> list = service.selectAppVersionList(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@PostMapping("/insert")
|
||||
@SysLog(title = "新增版本更新记录", businessType = OperaType.UPDATE, logType = 0, module = "新增版本更新记录", details = "新增版本更新记录")
|
||||
public AjaxResult exit(@RequestBody BmAppVersion o) {
|
||||
try {
|
||||
return service.insert(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
@PostMapping("/del")
|
||||
@SysLog(title = "删除版本更新记录", businessType = OperaType.UPDATE, logType = 0, module = "删除版本更新记录")
|
||||
public AjaxResult del(@Validated @RequestBody BmAppVersion o) {
|
||||
try {
|
||||
int res = service.delete(o.getId());
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("删除失败");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
@PostMapping("/selectLatestVersion")
|
||||
@SysLog(title = "删除版本更新记录", businessType = OperaType.UPDATE, logType = 0, module = "删除版本更新记录")
|
||||
public AjaxResult selectLatestVersion() {
|
||||
try {
|
||||
return service.selectLatestVersion();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmAppVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BmAppVersionMapper {
|
||||
/**
|
||||
* delete by primary key
|
||||
* @param id primaryKey
|
||||
* @return deleteCount
|
||||
*/
|
||||
int delete(Integer id);
|
||||
|
||||
/**
|
||||
* insert record to table
|
||||
* @param record the record
|
||||
* @return insert count
|
||||
*/
|
||||
int insert(BmAppVersion record);
|
||||
|
||||
/**
|
||||
* insert record to table selective
|
||||
* @param record the record
|
||||
* @return insert count
|
||||
*/
|
||||
int insertSelective(BmAppVersion record);
|
||||
|
||||
/**
|
||||
* select by primary key
|
||||
* @param id primary key
|
||||
* @return object by primary key
|
||||
*/
|
||||
BmAppVersion selectByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* update record selective
|
||||
* @param record the updated record
|
||||
* @return update count
|
||||
*/
|
||||
int updateByPrimaryKeySelective(BmAppVersion record);
|
||||
|
||||
/**
|
||||
* update record
|
||||
* @param record the updated record
|
||||
* @return update count
|
||||
*/
|
||||
int updateByPrimaryKey(BmAppVersion record);
|
||||
|
||||
List<BmAppVersion> selectAppVersionList(BmAppVersion o);
|
||||
|
||||
BmAppVersion selectLatestVersion();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmAppVersion;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BmAppVersionService{
|
||||
|
||||
int delete(Integer id);
|
||||
|
||||
AjaxResult insert(BmAppVersion record);
|
||||
|
||||
List<BmAppVersion> selectAppVersionList(BmAppVersion o);
|
||||
|
||||
AjaxResult selectLatestVersion();
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmAppVersion;
|
||||
import com.bonus.bmw.mapper.BmAppVersionMapper;
|
||||
import com.bonus.bmw.service.BmAppVersionService;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BmAppVersionServiceImpl implements BmAppVersionService{
|
||||
|
||||
@Resource
|
||||
private BmAppVersionMapper mapper;
|
||||
|
||||
@Override
|
||||
public int delete(Integer id) {
|
||||
return mapper.delete(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insert(BmAppVersion record) {
|
||||
int insert = mapper.insert(record);
|
||||
return insert > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BmAppVersion> selectAppVersionList(BmAppVersion o) {
|
||||
return mapper.selectAppVersionList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectLatestVersion() {
|
||||
BmAppVersion o = mapper.selectLatestVersion();
|
||||
return AjaxResult.success(o);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<?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.bonus.bmw.mapper.BmAppVersionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.bonus.bmw.domain.vo.BmAppVersion">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table bm_app_version-->
|
||||
<id column="id" property="id" />
|
||||
<result column="version" property="version" />
|
||||
<result column="apk_name" property="apkName" />
|
||||
<result column="apk_path" property="apkPath" />
|
||||
<result column="update_content" property="updateContent" />
|
||||
<result column="deploy_time" property="deployTime" />
|
||||
<result column="deploy_user" property="deployUser" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, version, apk_name, apk_path, update_content, deploy_time, deploy_user, remark
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_app_version
|
||||
where id = #{id}
|
||||
</select>
|
||||
<delete id="delete" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from bm_app_version
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.bmw.domain.vo.BmAppVersion" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into bm_app_version (version, apk_name, apk_path, update_content, remark)
|
||||
values (#{version}, #{apkName}, #{apkPath}, #{updateContent}, #{remark})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.bmw.domain.vo.BmAppVersion" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into bm_app_version
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="version != null">
|
||||
version,
|
||||
</if>
|
||||
<if test="apkName != null">
|
||||
apk_name,
|
||||
</if>
|
||||
<if test="apkPath != null">
|
||||
apk_path,
|
||||
</if>
|
||||
<if test="updateContent != null">
|
||||
update_content,
|
||||
</if>
|
||||
<if test="deployTime != null">
|
||||
deploy_time,
|
||||
</if>
|
||||
<if test="deployUser != null">
|
||||
deploy_user,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="version != null">
|
||||
#{version},
|
||||
</if>
|
||||
<if test="apkName != null">
|
||||
#{apkName},
|
||||
</if>
|
||||
<if test="apkPath != null">
|
||||
#{apkPath},
|
||||
</if>
|
||||
<if test="updateContent != null">
|
||||
#{updateContent},
|
||||
</if>
|
||||
<if test="deployTime != null">
|
||||
#{deployTime},
|
||||
</if>
|
||||
<if test="deployUser != null">
|
||||
#{deployUser},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.bmw.domain.vo.BmAppVersion">
|
||||
<!--@mbg.generated-->
|
||||
update bm_app_version
|
||||
<set>
|
||||
<if test="version != null">
|
||||
version = #{version},
|
||||
</if>
|
||||
<if test="apkName != null">
|
||||
apk_name = #{apkName},
|
||||
</if>
|
||||
<if test="apkPath != null">
|
||||
apk_path = #{apkPath},
|
||||
</if>
|
||||
<if test="updateContent != null">
|
||||
update_content = #{updateContent},
|
||||
</if>
|
||||
<if test="deployTime != null">
|
||||
deploy_time = #{deployTime},
|
||||
</if>
|
||||
<if test="deployUser != null">
|
||||
deploy_user = #{deployUser},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.bonus.bmw.domain.vo.BmAppVersion">
|
||||
<!--@mbg.generated-->
|
||||
update bm_app_version
|
||||
set version = #{version},
|
||||
apk_name = #{apkName},
|
||||
apk_path = #{apkPath},
|
||||
update_content = #{updateContent},
|
||||
deploy_time = #{deployTime},
|
||||
deploy_user = #{deployUser},
|
||||
remark = #{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectAppVersionList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_app_version
|
||||
order by deploy_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectLatestVersion" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_app_version
|
||||
order by deploy_time desc
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
<if test="createTime != null and createTime != ''">
|
||||
and locate( #{createTime},qr.create_time)
|
||||
</if>
|
||||
order by create_time desc
|
||||
</where>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue