增加 查询版本接口

master
wanghao 2 months ago
parent 33c2abb4de
commit 69ecc818c0

@ -0,0 +1,38 @@
package com.ruoyi.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.api.domain.APKVersion;
import com.ruoyi.api.service.IPdaApkVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class PdaVersionController {
@Autowired
private IPdaApkVersionService service;
@GetMapping("/getVersion")
public String getVersion(){
APKVersion apkVersion=service.getVersion();
apkVersion.setCode(0);
apkVersion.setMsg("");
if (apkVersion==null){
apkVersion=new APKVersion();
apkVersion.setUpdateStatus(0);
}else {
apkVersion.setUpdateStatus(1);
}
String s = JSONObject.toJSONString(apkVersion);
System.out.println("请求版本信息"+s);
return s;
}
}

@ -1,5 +1,6 @@
package com.ruoyi.api.mapper;
import com.ruoyi.api.domain.APKVersion;
import com.ruoyi.api.domain.PdaApkVersion;
import org.springframework.stereotype.Repository;
@ -61,4 +62,6 @@ public interface PdaApkVersionMapper
* @return
*/
public int deletePdaApkVersionByObjids(String[] objids);
APKVersion getVersion();
}

@ -1,5 +1,6 @@
package com.ruoyi.api.service;
import com.ruoyi.api.domain.APKVersion;
import com.ruoyi.api.domain.PdaApkVersion;
import java.util.List;
@ -59,4 +60,6 @@ public interface IPdaApkVersionService {
* @return
*/
public int deletePdaApkVersionByObjid(Long objid);
APKVersion getVersion();
}

@ -1,5 +1,6 @@
package com.ruoyi.api.service.impl;
import com.ruoyi.api.domain.APKVersion;
import com.ruoyi.api.domain.PdaApkVersion;
import com.ruoyi.api.mapper.PdaApkVersionMapper;
import com.ruoyi.common.core.text.Convert;
@ -95,4 +96,9 @@ public class PdaApkVersionServiceImpl implements IPdaApkVersionService
{
return pdaApkVersionMapper.deletePdaApkVersionByObjid(objid);
}
@Override
public APKVersion getVersion() {
return pdaApkVersionMapper.getVersion();
}
}

@ -1,18 +1,18 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.api.mapper.PdaApkVersionMapper">
<resultMap type="com.ruoyi.api.domain.PdaApkVersion" id="PdaApkVersionResult">
<result property="objid" column="objid" />
<result property="versionCode" column="version_code" />
<result property="versionName" column="version_name" />
<result property="modifyContent" column="modify_content" />
<result property="downloadUrl" column="download_url" />
<result property="apkSize" column="apk_size" />
<result property="apkMd5" column="apk_md5" />
<result property="createTime" column="create_time" />
<result property="objid" column="objid"/>
<result property="versionCode" column="version_code"/>
<result property="versionName" column="version_name"/>
<result property="modifyContent" column="modify_content"/>
<result property="downloadUrl" column="download_url"/>
<result property="apkSize" column="apk_size"/>
<result property="apkMd5" column="apk_md5"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectPdaApkVersionVo">
@ -21,16 +21,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPdaApkVersionList" parameterType="PdaApkVersion" resultMap="PdaApkVersionResult">
<include refid="selectPdaApkVersionVo"/>
<where>
<if test="versionCode != null "> and version_code = #{versionCode}</if>
<where>
<if test="versionCode != null ">and version_code = #{versionCode}</if>
</where>
</select>
<select id="selectPdaApkVersionByObjid" parameterType="Long" resultMap="PdaApkVersionResult">
<include refid="selectPdaApkVersionVo"/>
where objid = #{objid}
</select>
<insert id="insertPdaApkVersion" parameterType="PdaApkVersion" useGeneratedKeys="true" keyProperty="objid">
insert into pda_apk_version
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="apkSize != null">apk_size,</if>
<if test="apkMd5 != null">apk_md5,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="versionCode != null">#{versionCode},</if>
<if test="versionName != null">#{versionName},</if>
@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="apkSize != null">#{apkSize},</if>
<if test="apkMd5 != null">#{apkMd5},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updatePdaApkVersion" parameterType="PdaApkVersion">
@ -72,10 +72,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deletePdaApkVersionByObjids" parameterType="String">
delete from pda_apk_version where objid in
delete from pda_apk_version where objid in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
<select id="getVersion" resultType="com.ruoyi.api.domain.APKVersion">
select version_code, version_name, modify_content, download_url, apk_size, apk_md5 from pda_apk_version order by create_time desc limit 1
</select>
</mapper>
Loading…
Cancel
Save