Commit cb162782 authored by 赵啸非's avatar 赵啸非

添加应用发布

parent fc40e759
<template>
<!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="应用编码" prop="appCode" v-model="form.appCode" type="textarea" placeholder="请输入应用编码"/>
<Field label="应用名称" prop="appName" v-model="form.appName" type="textarea" placeholder="请输入应用名称"/>
<Field label="文件路径地址"><fileUpload v-model="form.filePath" prePath="/file/uploadfile"/></Field>
<Field label="文件部署路径地址"><fileUpload v-model="form.distributeFilePath" prePath="/file/uploadfile"/></Field>
<Field label="应用类型" prop="appType" v-model="form.appType" type="select" :enumData="dict.appType" placeholder="请选择应用类型"/>
<Field label="是否部署" prop="distribute" v-model="form.distribute" type="select" :enumData="dict.distribute" placeholder="请选择是否部署"/>
<Field label="版本" prop="version" v-model="form.version" type="textarea" placeholder="请输入版本"/>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow";
import FileUpload from '@/components/FileUpload';
export default {
mixins: [form],
components: {
dialogShow ,
FileUpload,
},
data() {
return {
// 遮罩层
loading: true,
// 弹出层标题
title: "应用发布部署",
// 是否显示弹出层
open: false,
toString:[
"appType",
"distribute",
],
// 表单校验
rules: {
appType: [
{required: true,message: "请输入应用类型", trigger: "blur" },
],
distribute: [
{required: true,message: "请输入是否部署", trigger: "blur" },
],
}
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="app/publish/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改应用发布部署";
},
/** 新增 */
add(row) {
this.reset()
this.urls.currUrl = "app/publish/add";
this.getData();
this.pageInfo.type="add"
this.title = "新增应用发布部署";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="app/publish/view";
this.getData();
this.pageInfo.type="view"
this.title = "应用发布部署详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
appCode : null,
appName : null,
filePath : null,
distributeFilePath : null,
appType : null,
distribute : null,
version : null,
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
<template>
<div class="page">
<LayoutTable :data="tableData" :config="tableConfig">
</LayoutTable>
<dialog-show ref="dialogform" @ok="getData" />
</div>
</template>
<script>
/** 表单弹出框模式需引入 */
import dialogShow from "./dialogshow";
import table from "@/assets/mixins/table";
export default {
name: "AppPublishList",
components: {
dialogShow
},
mixins: [table],
created() {
},
methods: {
/** 重写新增方法 */
toAdd(row) {
this.$refs.dialogform.add(row);
},
/** 重写编辑方法 */
toEdit(row) {
this.$refs.dialogform.edit(row);
},
/** 重写查看方法 */
toView(row) {
this.$refs.dialogform.view(row);
},
},
data() {
return {
config: {
search: [
],
columns: [
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
{label: "应用编码", prop: "appCode"},
{label: "应用名称", prop: "appName"},
{label: "文件路径地址", prop: "filePath"},
{label: "文件部署路径地址", prop: "distributeFilePath"},
{label: "应用类型", prop: "appType",formatter: this.formatter},
{label: "是否部署", prop: "distribute",formatter: this.formatter},
{label: "版本", prop: "version"},
{
label: "操作",
width: 240,
formatter: row => {
return (
<table-buttons noAdd row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
);
}
}
]
}
};
}
};
</script>
\ No newline at end of file
<template>
<layout-view>
<el-descriptions :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
基本详细信息
</template>
<template slot="extra">
<el-button type="primary" @click="$router.go(-1)" size="small">返回</el-button>
</template>
<el-descriptions-item label="应用编码" label-class-name="labelClass" content-class-name="contentClass">
{{form.appCode}}
</el-descriptions-item>
<el-descriptions-item label="应用名称" label-class-name="labelClass" content-class-name="contentClass">
{{form.appName}}
</el-descriptions-item>
<el-descriptions-item label="文件路径地址" label-class-name="labelClass" content-class-name="contentClass">
<fileUpload v-model="form.filePath" prePath="/file/uploadfile"/>
</el-descriptions-item>
<el-descriptions-item label="文件部署路径地址" label-class-name="labelClass" content-class-name="contentClass">
<fileUpload v-model="form.distributeFilePath" prePath="/file/uploadfile"/>
</el-descriptions-item>
<el-descriptions-item label="应用类型" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("appType", form.appType) }}
</el-descriptions-item>
<el-descriptions-item label="是否部署" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("distribute", form.distribute) }}
</el-descriptions-item>
<el-descriptions-item label="版本" label-class-name="labelClass" content-class-name="contentClass">
{{form.version}}
</el-descriptions-item>
</el-descriptions>
</layout-view>
</template>
<script>
import view from "@/assets/mixins/view";
import FileUpload from '@/components/FileUpload';
export default {
mixins: [view],
components: {
FileUpload,
},
methods: {
},
data() {
return {
size:"small",
column:2,
toString:[
"appType",
"distribute",
],
toArrays: [
],
toDate: [
]
}
}
}
</script>
<style lang="less">
.labelClass{
width: 200px;
}
.el-descriptions__body{
margin-left: 5px;
margin-right: 5px;
color: #606266;
background-color: #FFF;
}
.contentClass{
width: 600px;
}
</style>
\ No newline at end of file
...@@ -339,5 +339,23 @@ CREATE TABLE mortals_xhx_product_version ...@@ -339,5 +339,23 @@ CREATE TABLE mortals_xhx_product_version
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品客户端版本'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品客户端版本';
-- ----------------------------
-- 应用发布部署表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_app_publish`;
CREATE TABLE mortals_xhx_app_publish(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`appCode` varchar(256) COMMENT '应用编码',
`appName` varchar(256) COMMENT '应用名称',
`filePath` varchar(256) COMMENT '文件路径地址',
`distributeFilePath` varchar(256) COMMENT '文件部署路径地址',
`appType` tinyint(2) NOT NULL COMMENT '应用类型(0.前端,1.后端)',
`distribute` tinyint(2) NOT NULL COMMENT '是否部署(0.否,1.是)',
`version` varchar(256) COMMENT '版本',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应用发布部署';
...@@ -69,3 +69,9 @@ INSERT INTO `mortals_xhx_task` VALUES (5, '设备统计任务', 'deviceTotalStat ...@@ -69,3 +69,9 @@ INSERT INTO `mortals_xhx_task` VALUES (5, '设备统计任务', 'deviceTotalStat
INSERT INTO `mortals_xhx_task`VALUES (6, '短信发送任务', 'smsSendTask', 0, 'SmsSendTask', NULL, NULL, 4, 10, '00', NULL, '127.0.1.1', '2023-01-13 14:42:18', 0, '2022-07-05 16:34:25', 1, '系统管理员'); INSERT INTO `mortals_xhx_task`VALUES (6, '短信发送任务', 'smsSendTask', 0, 'SmsSendTask', NULL, NULL, 4, 10, '00', NULL, '127.0.1.1', '2023-01-13 14:42:18', 0, '2022-07-05 16:34:25', 1, '系统管理员');
INSERT INTO `mortals_xhx_task`VALUES (7, '用户同步', 'syncUserTask', 0, 'SyncUserTask', NULL, NULL, 4, 120, '00', NULL, '127.0.1.1', '2023-01-13 14:41:35', 0, '2022-07-06 10:49:48', 1, '系统管理员'); INSERT INTO `mortals_xhx_task`VALUES (7, '用户同步', 'syncUserTask', 0, 'SyncUserTask', NULL, NULL, 4, 120, '00', NULL, '127.0.1.1', '2023-01-13 14:41:35', 0, '2022-07-06 10:49:48', 1, '系统管理员');
INSERT INTO `mortals_xhx_task` VALUES (9, '设备状态修正任务', 'deviceStatTask', 0, 'DeviceStatTask', NULL, NULL, 4, 120, '00', NULL, '127.0.1.1', '2023-01-13 14:41:35', 0, '2022-07-20 16:50:42', 1, '系统管理员'); INSERT INTO `mortals_xhx_task` VALUES (9, '设备状态修正任务', 'deviceStatTask', 0, 'DeviceStatTask', NULL, NULL, 4, 120, '00', NULL, '127.0.1.1', '2023-01-13 14:41:35', 0, '2022-07-20 16:50:42', 1, '系统管理员');
INSERT INTO `mortals_xhx_param` VALUES (null, '设备资源部署细致', NULL, NULL, 'distribute_path', '/home/publish/device-manager-ui/homeDeviceUrl', 1, 4, 0, NULL, '2022-11-14 10:02:41', 1, '系统管理员');
INSERT INTO `mortals_xhx_param` VALUES (null, '应用发布编码', 'appPublish', NULL, '信息发布屏', 'information-publish', 1, 4, 0, 'appPublish', NULL, NULL, NULL);
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 应用类型(0.前端,1.后端)枚举类
*
* @author zxfei
*/
public enum AppTypeEnum {
前端(0, "前端"),
后端(1, "后端");
private Integer value;
private String desc;
AppTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static AppTypeEnum getByValue(Integer value) {
for (AppTypeEnum appTypeEnum : AppTypeEnum.values()) {
if (appTypeEnum.getValue() == value) {
return appTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (AppTypeEnum item : AppTypeEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.module.app.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.app.model.AppPublishEntity;
import java.util.List;
/**
* 应用发布部署Dao
* 应用发布部署 DAO接口
*
* @author zxfei
* @date 2023-02-01
*/
public interface AppPublishDao extends ICRUDDao<AppPublishEntity,Long>{
}
package com.mortals.xhx.module.app.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.app.dao.AppPublishDao;
import com.mortals.xhx.module.app.model.AppPublishEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 应用发布部署DaoImpl DAO接口
*
* @author zxfei
* @date 2023-02-01
*/
@Repository("appPublishDao")
public class AppPublishDaoImpl extends BaseCRUDDaoMybatis<AppPublishEntity,Long> implements AppPublishDao {
}
package com.mortals.xhx.module.app.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.app.model.vo.AppPublishVo;
/**
* 应用发布部署实体对象
*
* @author zxfei
* @date 2023-02-01
*/
public class AppPublishEntity extends AppPublishVo {
private static final long serialVersionUID = 1L;
/**
* 应用编码
*/
private String appCode;
/**
* 应用名称
*/
private String appName;
/**
* 文件路径地址
*/
private String filePath;
/**
* 文件部署路径地址
*/
private String distributeFilePath;
/**
* 应用类型(0.前端,1.后端)
*/
private Integer appType;
/**
* 是否部署(0.否,1.是)
*/
private Integer distribute;
/**
* 版本
*/
private String version;
public AppPublishEntity(){}
/**
* 获取 应用编码
* @return String
*/
public String getAppCode(){
return appCode;
}
/**
* 设置 应用编码
* @param appCode
*/
public void setAppCode(String appCode){
this.appCode = appCode;
}
/**
* 获取 应用名称
* @return String
*/
public String getAppName(){
return appName;
}
/**
* 设置 应用名称
* @param appName
*/
public void setAppName(String appName){
this.appName = appName;
}
/**
* 获取 文件路径地址
* @return String
*/
public String getFilePath(){
return filePath;
}
/**
* 设置 文件路径地址
* @param filePath
*/
public void setFilePath(String filePath){
this.filePath = filePath;
}
/**
* 获取 文件部署路径地址
* @return String
*/
public String getDistributeFilePath(){
return distributeFilePath;
}
/**
* 设置 文件部署路径地址
* @param distributeFilePath
*/
public void setDistributeFilePath(String distributeFilePath){
this.distributeFilePath = distributeFilePath;
}
/**
* 获取 应用类型(0.前端,1.后端)
* @return Integer
*/
public Integer getAppType(){
return appType;
}
/**
* 设置 应用类型(0.前端,1.后端)
* @param appType
*/
public void setAppType(Integer appType){
this.appType = appType;
}
/**
* 获取 是否部署(0.否,1.是)
* @return Integer
*/
public Integer getDistribute(){
return distribute;
}
/**
* 设置 是否部署(0.否,1.是)
* @param distribute
*/
public void setDistribute(Integer distribute){
this.distribute = distribute;
}
/**
* 获取 版本
* @return String
*/
public String getVersion(){
return version;
}
/**
* 设置 版本
* @param version
*/
public void setVersion(String version){
this.version = version;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof AppPublishEntity) {
AppPublishEntity tmp = (AppPublishEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",appCode:").append(getAppCode());
sb.append(",appName:").append(getAppName());
sb.append(",filePath:").append(getFilePath());
sb.append(",distributeFilePath:").append(getDistributeFilePath());
sb.append(",appType:").append(getAppType());
sb.append(",distribute:").append(getDistribute());
sb.append(",version:").append(getVersion());
return sb.toString();
}
public void initAttrValue(){
this.appCode = null;
this.appName = null;
this.filePath = null;
this.distributeFilePath = null;
this.appType = null;
this.distribute = null;
this.version = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.app.model;
import java.util.List;
import com.mortals.xhx.module.app.model.AppPublishEntity;
/**
* 应用发布部署查询对象
*
* @author zxfei
* @date 2023-02-01
*/
public class AppPublishQuery extends AppPublishEntity {
/** 开始 主键ID,主键,自增长 */
private Long idStart;
/** 结束 主键ID,主键,自增长 */
private Long idEnd;
/** 增加 主键ID,主键,自增长 */
private Long idIncrement;
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
/** 应用编码 */
private List<String> appCodeList;
/** 应用名称 */
private List<String> appNameList;
/** 文件路径地址 */
private List<String> filePathList;
/** 文件部署路径地址 */
private List<String> distributeFilePathList;
/** 开始 应用类型(0.前端,1.后端) */
private Integer appTypeStart;
/** 结束 应用类型(0.前端,1.后端) */
private Integer appTypeEnd;
/** 增加 应用类型(0.前端,1.后端) */
private Integer appTypeIncrement;
/** 应用类型(0.前端,1.后端)列表 */
private List <Integer> appTypeList;
/** 开始 是否部署(0.否,1.是) */
private Integer distributeStart;
/** 结束 是否部署(0.否,1.是) */
private Integer distributeEnd;
/** 增加 是否部署(0.否,1.是) */
private Integer distributeIncrement;
/** 是否部署(0.否,1.是)列表 */
private List <Integer> distributeList;
/** 版本 */
private List<String> versionList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 更新用户 */
private Long updateUserIdStart;
/** 结束 更新用户 */
private Long updateUserIdEnd;
/** 增加 更新用户 */
private Long updateUserIdIncrement;
/** 更新用户列表 */
private List <Long> updateUserIdList;
/** 开始 更新时间 */
private String updateTimeStart;
/** 结束 更新时间 */
private String updateTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<AppPublishQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<AppPublishQuery> andConditionList;
public AppPublishQuery(){}
/**
* 获取 开始 主键ID,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 主键ID,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 主键ID,主键,自增长
* @return $idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 主键ID,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 主键ID,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 主键ID,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 主键ID,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 主键ID,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 应用编码
* @return appCodeList
*/
public List<String> getAppCodeList(){
return this.appCodeList;
}
/**
* 设置 应用编码
* @param appCodeList
*/
public void setAppCodeList(List<String> appCodeList){
this.appCodeList = appCodeList;
}
/**
* 获取 应用名称
* @return appNameList
*/
public List<String> getAppNameList(){
return this.appNameList;
}
/**
* 设置 应用名称
* @param appNameList
*/
public void setAppNameList(List<String> appNameList){
this.appNameList = appNameList;
}
/**
* 获取 文件路径地址
* @return filePathList
*/
public List<String> getFilePathList(){
return this.filePathList;
}
/**
* 设置 文件路径地址
* @param filePathList
*/
public void setFilePathList(List<String> filePathList){
this.filePathList = filePathList;
}
/**
* 获取 文件部署路径地址
* @return distributeFilePathList
*/
public List<String> getDistributeFilePathList(){
return this.distributeFilePathList;
}
/**
* 设置 文件部署路径地址
* @param distributeFilePathList
*/
public void setDistributeFilePathList(List<String> distributeFilePathList){
this.distributeFilePathList = distributeFilePathList;
}
/**
* 获取 开始 应用类型(0.前端,1.后端)
* @return appTypeStart
*/
public Integer getAppTypeStart(){
return this.appTypeStart;
}
/**
* 设置 开始 应用类型(0.前端,1.后端)
* @param appTypeStart
*/
public void setAppTypeStart(Integer appTypeStart){
this.appTypeStart = appTypeStart;
}
/**
* 获取 结束 应用类型(0.前端,1.后端)
* @return $appTypeEnd
*/
public Integer getAppTypeEnd(){
return this.appTypeEnd;
}
/**
* 设置 结束 应用类型(0.前端,1.后端)
* @param appTypeEnd
*/
public void setAppTypeEnd(Integer appTypeEnd){
this.appTypeEnd = appTypeEnd;
}
/**
* 获取 增加 应用类型(0.前端,1.后端)
* @return appTypeIncrement
*/
public Integer getAppTypeIncrement(){
return this.appTypeIncrement;
}
/**
* 设置 增加 应用类型(0.前端,1.后端)
* @param appTypeIncrement
*/
public void setAppTypeIncrement(Integer appTypeIncrement){
this.appTypeIncrement = appTypeIncrement;
}
/**
* 获取 应用类型(0.前端,1.后端)
* @return appTypeList
*/
public List<Integer> getAppTypeList(){
return this.appTypeList;
}
/**
* 设置 应用类型(0.前端,1.后端)
* @param appTypeList
*/
public void setAppTypeList(List<Integer> appTypeList){
this.appTypeList = appTypeList;
}
/**
* 获取 开始 是否部署(0.否,1.是)
* @return distributeStart
*/
public Integer getDistributeStart(){
return this.distributeStart;
}
/**
* 设置 开始 是否部署(0.否,1.是)
* @param distributeStart
*/
public void setDistributeStart(Integer distributeStart){
this.distributeStart = distributeStart;
}
/**
* 获取 结束 是否部署(0.否,1.是)
* @return $distributeEnd
*/
public Integer getDistributeEnd(){
return this.distributeEnd;
}
/**
* 设置 结束 是否部署(0.否,1.是)
* @param distributeEnd
*/
public void setDistributeEnd(Integer distributeEnd){
this.distributeEnd = distributeEnd;
}
/**
* 获取 增加 是否部署(0.否,1.是)
* @return distributeIncrement
*/
public Integer getDistributeIncrement(){
return this.distributeIncrement;
}
/**
* 设置 增加 是否部署(0.否,1.是)
* @param distributeIncrement
*/
public void setDistributeIncrement(Integer distributeIncrement){
this.distributeIncrement = distributeIncrement;
}
/**
* 获取 是否部署(0.否,1.是)
* @return distributeList
*/
public List<Integer> getDistributeList(){
return this.distributeList;
}
/**
* 设置 是否部署(0.否,1.是)
* @param distributeList
*/
public void setDistributeList(List<Integer> distributeList){
this.distributeList = distributeList;
}
/**
* 获取 版本
* @return versionList
*/
public List<String> getVersionList(){
return this.versionList;
}
/**
* 设置 版本
* @param versionList
*/
public void setVersionList(List<String> versionList){
this.versionList = versionList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 更新用户
* @return updateUserIdStart
*/
public Long getUpdateUserIdStart(){
return this.updateUserIdStart;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public void setUpdateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
}
/**
* 获取 结束 更新用户
* @return $updateUserIdEnd
*/
public Long getUpdateUserIdEnd(){
return this.updateUserIdEnd;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public void setUpdateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
}
/**
* 获取 增加 更新用户
* @return updateUserIdIncrement
*/
public Long getUpdateUserIdIncrement(){
return this.updateUserIdIncrement;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public void setUpdateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
}
/**
* 获取 更新用户
* @return updateUserIdList
*/
public List<Long> getUpdateUserIdList(){
return this.updateUserIdList;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public void setUpdateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
}
/**
* 获取 开始 更新时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 更新时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 更新时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 更新时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 设置 主键ID,主键,自增长
* @param id
*/
public AppPublishQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 主键ID,主键,自增长
* @param idStart
*/
public AppPublishQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 主键ID,主键,自增长
* @param idEnd
*/
public AppPublishQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 主键ID,主键,自增长
* @param idIncrement
*/
public AppPublishQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 主键ID,主键,自增长
* @param idList
*/
public AppPublishQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 应用编码
* @param appCode
*/
public AppPublishQuery appCode(String appCode){
setAppCode(appCode);
return this;
}
/**
* 设置 应用编码
* @param appCodeList
*/
public AppPublishQuery appCodeList(List<String> appCodeList){
this.appCodeList = appCodeList;
return this;
}
/**
* 设置 应用名称
* @param appName
*/
public AppPublishQuery appName(String appName){
setAppName(appName);
return this;
}
/**
* 设置 应用名称
* @param appNameList
*/
public AppPublishQuery appNameList(List<String> appNameList){
this.appNameList = appNameList;
return this;
}
/**
* 设置 文件路径地址
* @param filePath
*/
public AppPublishQuery filePath(String filePath){
setFilePath(filePath);
return this;
}
/**
* 设置 文件路径地址
* @param filePathList
*/
public AppPublishQuery filePathList(List<String> filePathList){
this.filePathList = filePathList;
return this;
}
/**
* 设置 文件部署路径地址
* @param distributeFilePath
*/
public AppPublishQuery distributeFilePath(String distributeFilePath){
setDistributeFilePath(distributeFilePath);
return this;
}
/**
* 设置 文件部署路径地址
* @param distributeFilePathList
*/
public AppPublishQuery distributeFilePathList(List<String> distributeFilePathList){
this.distributeFilePathList = distributeFilePathList;
return this;
}
/**
* 设置 应用类型(0.前端,1.后端)
* @param appType
*/
public AppPublishQuery appType(Integer appType){
setAppType(appType);
return this;
}
/**
* 设置 开始 应用类型(0.前端,1.后端)
* @param appTypeStart
*/
public AppPublishQuery appTypeStart(Integer appTypeStart){
this.appTypeStart = appTypeStart;
return this;
}
/**
* 设置 结束 应用类型(0.前端,1.后端)
* @param appTypeEnd
*/
public AppPublishQuery appTypeEnd(Integer appTypeEnd){
this.appTypeEnd = appTypeEnd;
return this;
}
/**
* 设置 增加 应用类型(0.前端,1.后端)
* @param appTypeIncrement
*/
public AppPublishQuery appTypeIncrement(Integer appTypeIncrement){
this.appTypeIncrement = appTypeIncrement;
return this;
}
/**
* 设置 应用类型(0.前端,1.后端)
* @param appTypeList
*/
public AppPublishQuery appTypeList(List<Integer> appTypeList){
this.appTypeList = appTypeList;
return this;
}
/**
* 设置 是否部署(0.否,1.是)
* @param distribute
*/
public AppPublishQuery distribute(Integer distribute){
setDistribute(distribute);
return this;
}
/**
* 设置 开始 是否部署(0.否,1.是)
* @param distributeStart
*/
public AppPublishQuery distributeStart(Integer distributeStart){
this.distributeStart = distributeStart;
return this;
}
/**
* 设置 结束 是否部署(0.否,1.是)
* @param distributeEnd
*/
public AppPublishQuery distributeEnd(Integer distributeEnd){
this.distributeEnd = distributeEnd;
return this;
}
/**
* 设置 增加 是否部署(0.否,1.是)
* @param distributeIncrement
*/
public AppPublishQuery distributeIncrement(Integer distributeIncrement){
this.distributeIncrement = distributeIncrement;
return this;
}
/**
* 设置 是否部署(0.否,1.是)
* @param distributeList
*/
public AppPublishQuery distributeList(List<Integer> distributeList){
this.distributeList = distributeList;
return this;
}
/**
* 设置 版本
* @param version
*/
public AppPublishQuery version(String version){
setVersion(version);
return this;
}
/**
* 设置 版本
* @param versionList
*/
public AppPublishQuery versionList(List<String> versionList){
this.versionList = versionList;
return this;
}
/**
* 设置 更新用户
* @param updateUserId
*/
public AppPublishQuery updateUserId(Long updateUserId){
setUpdateUserId(updateUserId);
return this;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public AppPublishQuery updateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
return this;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public AppPublishQuery updateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
return this;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public AppPublishQuery updateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
return this;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public AppPublishQuery updateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<AppPublishQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<AppPublishQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<AppPublishQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<AppPublishQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.app.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.app.model.AppPublishEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 应用发布部署视图对象
*
* @author zxfei
* @date 2023-02-01
*/
public class AppPublishVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.app.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.app.model.AppPublishEntity;
/**
* AppPublishService
*
* 应用发布部署 service接口
*
* @author zxfei
* @date 2023-02-01
*/
public interface AppPublishService extends ICRUDService<AppPublishEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.app.service.impl;
import cn.hutool.core.io.FileUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.module.app.dao.AppPublishDao;
import com.mortals.xhx.module.app.model.AppPublishEntity;
import com.mortals.xhx.module.app.service.AppPublishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
/**
* AppPublishService
* 应用发布部署 service实现
*
* @author zxfei
* @date 2023-02-01
*/
@Service("appPublishService")
public class AppPublishServiceImpl extends AbstractCRUDServiceImpl<AppPublishDao, AppPublishEntity, Long> implements AppPublishService {
@Autowired
private UploadService uploadService;
@Override
protected void saveBefore(AppPublishEntity entity, Context context) throws AppException {
String targetPath="/home/mortals/apps/";
String fileNewName=entity.getAppCode()+"-"+entity.getVersion();
//将zip包移动到指定目录 并更改名称
String realFilePath = uploadService.getFilePath(entity.getFilePath());
if (FileUtil.isEmpty(new File(realFilePath))) {
throw new AppException("部署文件不存在!");
}
if (!FileUtil.getSuffix(entity.getFilePath()).equals("zip")) {
throw new AppException("部署只支持zip文件!");
}
//移动文件并重命名
FileUtil.move(new File(realFilePath),new File(targetPath+fileNewName),true);
super.saveBefore(entity, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.app.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.AppTypeEnum;
import com.mortals.xhx.common.code.DistributeEnum;
import com.mortals.xhx.module.app.model.AppPublishEntity;
import com.mortals.xhx.module.app.service.AppPublishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 应用发布部署
*
* @author zxfei
* @date 2023-02-01
*/
@RestController
@RequestMapping("app/publish")
public class AppPublishController extends BaseCRUDJsonBodyMappingController<AppPublishService, AppPublishEntity, Long> {
@Autowired
private ParamService paramService;
public AppPublishController() {
super.setModuleDesc("应用发布部署");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "appType", AppTypeEnum.getEnumMap());
this.addDict(model, "distribute", DistributeEnum.getEnumMap());
this.addDict(model, "appPublish", paramService.getParamByFirstOrganize("appPublish"));
super.init(model, context);
}
}
\ No newline at end of file
...@@ -63,7 +63,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D ...@@ -63,7 +63,6 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
@Override @Override
public void active(DeviceModuleDistributeEntity distributeEntity, Context context) { public void active(DeviceModuleDistributeEntity distributeEntity, Context context) {
//判断文件是否存在 //判断文件是否存在
String targetFilePath = uploadService.getFilePath(distributeEntity.getFilePath()); String targetFilePath = uploadService.getFilePath(distributeEntity.getFilePath());
if (FileUtil.isEmpty(new File(targetFilePath))) { if (FileUtil.isEmpty(new File(targetFilePath))) {
throw new AppException("部署文件不存在!"); throw new AppException("部署文件不存在!");
...@@ -73,6 +72,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D ...@@ -73,6 +72,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
throw new AppException("部署只支持zip文件!"); throw new AppException("部署只支持zip文件!");
} }
//RuntimeUtil
//部署路径是否存在 如果不存在 创建目录, //部署路径是否存在 如果不存在 创建目录,
String path = GlobalSysInfo.getParamValue(Constant.DISTRIBUTE_PATH, "/home/publish/device-manager-ui/homeDeviceUrl"); String path = GlobalSysInfo.getParamValue(Constant.DISTRIBUTE_PATH, "/home/publish/device-manager-ui/homeDeviceUrl");
String code = distributeEntity.getProductCode(); String code = distributeEntity.getProductCode();
......
package com.mortals.xhx.module.product.service.impl; package com.mortals.xhx.module.product.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
...@@ -94,7 +92,7 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe ...@@ -94,7 +92,7 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
header.put(MessageHeader.MESSAGETYPE, MESSAGETYPE_UPGREAD); header.put(MessageHeader.MESSAGETYPE, MESSAGETYPE_UPGREAD);
header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode()); header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode());
header.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime()); header.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime());
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), Base64.encode( new JSONObject().toJSONString()), header); TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), "W10=", header);
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg)); messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg));
DeviceLogEntity deviceLogEntity = new DeviceLogEntity(); DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
...@@ -105,7 +103,7 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe ...@@ -105,7 +103,7 @@ public class ProductVersionServiceImpl extends AbstractCRUDServiceImpl<ProductVe
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName()); deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode()); deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(MESSAGETYPE_UPGREAD); deviceLogEntity.setMessageHead(MESSAGETYPE_UPGREAD);
deviceLogEntity.setContent("=="); deviceLogEntity.setContent("W10=");
deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue()); deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue());
deviceLogEntity.setCreateUserId(1L); deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date()); deviceLogEntity.setCreateTime(new Date());
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.app.dao.ibatis.AppPublishDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="AppPublishEntity" id="AppPublishEntity-Map">
<id property="id" column="id" />
<result property="appCode" column="appCode" />
<result property="appName" column="appName" />
<result property="filePath" column="filePath" />
<result property="distributeFilePath" column="distributeFilePath" />
<result property="appType" column="appType" />
<result property="distribute" column="distribute" />
<result property="version" column="version" />
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('appCode') or colPickMode == 1 and data.containsKey('appCode')))">
a.appCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('appName') or colPickMode == 1 and data.containsKey('appName')))">
a.appName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('filePath') or colPickMode == 1 and data.containsKey('filePath')))">
a.filePath,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('distributeFilePath') or colPickMode == 1 and data.containsKey('distributeFilePath')))">
a.distributeFilePath,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('appType') or colPickMode == 1 and data.containsKey('appType')))">
a.appType,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('distribute') or colPickMode == 1 and data.containsKey('distribute')))">
a.distribute,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('version') or colPickMode == 1 and data.containsKey('version')))">
a.version,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
a.updateUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="AppPublishEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_app_publish
(appCode,appName,filePath,distributeFilePath,appType,distribute,version,createTime,updateUserId,updateTime)
VALUES
(#{appCode},#{appName},#{filePath},#{distributeFilePath},#{appType},#{distribute},#{version},#{createTime},#{updateUserId},#{updateTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_app_publish
(appCode,appName,filePath,distributeFilePath,appType,distribute,version,createTime,updateUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.appCode},#{item.appName},#{item.filePath},#{item.distributeFilePath},#{item.appType},#{item.distribute},#{item.version},#{item.createTime},#{item.updateUserId},#{item.updateTime})
</foreach>
</insert>
<!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto">
update mortals_xhx_app_publish as a
set
<trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('appCode')) or (colPickMode==1 and !data.containsKey('appCode'))">
a.appCode=#{data.appCode},
</if>
<if test="(colPickMode==0 and data.containsKey('appName')) or (colPickMode==1 and !data.containsKey('appName'))">
a.appName=#{data.appName},
</if>
<if test="(colPickMode==0 and data.containsKey('filePath')) or (colPickMode==1 and !data.containsKey('filePath'))">
a.filePath=#{data.filePath},
</if>
<if test="(colPickMode==0 and data.containsKey('distributeFilePath')) or (colPickMode==1 and !data.containsKey('distributeFilePath'))">
a.distributeFilePath=#{data.distributeFilePath},
</if>
<if test="(colPickMode==0 and data.containsKey('appType')) or (colPickMode==1 and !data.containsKey('appType'))">
a.appType=#{data.appType},
</if>
<if test="(colPickMode==0 and data.containsKey('appTypeIncrement')) or (colPickMode==1 and !data.containsKey('appTypeIncrement'))">
a.appType=ifnull(a.appType,0) + #{data.appTypeIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('distribute')) or (colPickMode==1 and !data.containsKey('distribute'))">
a.distribute=#{data.distribute},
</if>
<if test="(colPickMode==0 and data.containsKey('distributeIncrement')) or (colPickMode==1 and !data.containsKey('distributeIncrement'))">
a.distribute=ifnull(a.distribute,0) + #{data.distributeIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('version')) or (colPickMode==1 and !data.containsKey('version'))">
a.version=#{data.version},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
<if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
a.updateUserId=#{data.updateUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</update>
<!-- 批量更新 -->
<update id="updateBatch" parameterType="paramDto">
update mortals_xhx_app_publish as a
<trim prefix="set" suffixOverrides=",">
<trim prefix="appCode=(case" suffix="ELSE appCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('appCode')) or (colPickMode==1 and !item.containsKey('appCode'))">
when a.id=#{item.id} then #{item.appCode}
</if>
</foreach>
</trim>
<trim prefix="appName=(case" suffix="ELSE appName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('appName')) or (colPickMode==1 and !item.containsKey('appName'))">
when a.id=#{item.id} then #{item.appName}
</if>
</foreach>
</trim>
<trim prefix="filePath=(case" suffix="ELSE filePath end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('filePath')) or (colPickMode==1 and !item.containsKey('filePath'))">
when a.id=#{item.id} then #{item.filePath}
</if>
</foreach>
</trim>
<trim prefix="distributeFilePath=(case" suffix="ELSE distributeFilePath end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('distributeFilePath')) or (colPickMode==1 and !item.containsKey('distributeFilePath'))">
when a.id=#{item.id} then #{item.distributeFilePath}
</if>
</foreach>
</trim>
<trim prefix="appType=(case" suffix="ELSE appType end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('appType')) or (colPickMode==1 and !item.containsKey('appType'))">
when a.id=#{item.id} then #{item.appType}
</when>
<when test="(colPickMode==0 and item.containsKey('appTypeIncrement')) or (colPickMode==1 and !item.containsKey('appTypeIncrement'))">
when a.id=#{item.id} then ifnull(a.appType,0) + #{item.appTypeIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="distribute=(case" suffix="ELSE distribute end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('distribute')) or (colPickMode==1 and !item.containsKey('distribute'))">
when a.id=#{item.id} then #{item.distribute}
</when>
<when test="(colPickMode==0 and item.containsKey('distributeIncrement')) or (colPickMode==1 and !item.containsKey('distributeIncrement'))">
when a.id=#{item.id} then ifnull(a.distribute,0) + #{item.distributeIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="version=(case" suffix="ELSE version end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('version')) or (colPickMode==1 and !item.containsKey('version'))">
when a.id=#{item.id} then #{item.version}
</if>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
when a.id=#{item.id} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
when a.id=#{item.id} then #{item.updateUserId}
</when>
<when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
when a.id=#{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
<!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="AppPublishEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_app_publish as a
where a.id=#{condition.id}
</select>
<!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_app_publish as a where a.id=#{condition.id}
</delete>
<!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys">
delete from mortals_xhx_app_publish where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据主健列表删除一批,针对单一主健有效 -->
<delete id="deleteByKeyList">
delete from mortals_xhx_app_publish where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据对象列表删除一批,针对单一主健有效 -->
<delete id="deleteByEntityList">
delete from mortals_xhx_app_publish where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</delete>
<!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_app_publish as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</delete>
<!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="AppPublishEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_app_publish as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
from mortals_xhx_app_publish as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_condition_">
<if test="condition != null and !condition.isEmpty()">
<!-- 条件映射-普通条件 -->
<include refid="_condition_param_">
<property name="_conditionParam_" value="condition"/>
<property name="_conditionType_" value="and"/>
</include>
<!-- 条件映射-集合之间使用AND,集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
<if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
and
<foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
<trim prefixOverrides="or" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="andCondition"/>
<property name="_conditionType_" value="or"/>
</include>
</trim>
</foreach>
</if>
<!-- 条件映射-集合之间使用OR,集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
<if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
and
<foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
<trim prefixOverrides="and" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="orCondition"/>
<property name="_conditionType_" value="and"/>
</include>
</trim>
</foreach>
</if>
</if>
</sql>
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
</if>
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null ">
${_conditionType_} a.id = #{${_conditionParam_}.id}
</if>
<if test="conditionParamRef.id == null">
${_conditionType_} a.id is null
</if>
</if>
<if test="conditionParamRef.containsKey('idList')">
${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if>
<if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if>
<if test="conditionParamRef.containsKey('appCode')">
<if test="conditionParamRef.appCode != null and conditionParamRef.appCode != ''">
${_conditionType_} a.appCode like #{${_conditionParam_}.appCode}
</if>
<if test="conditionParamRef.appCode == null">
${_conditionType_} a.appCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('appCodeList')">
${_conditionType_} a.appCode in
<foreach collection="conditionParamRef.appCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('appName')">
<if test="conditionParamRef.appName != null and conditionParamRef.appName != ''">
${_conditionType_} a.appName like #{${_conditionParam_}.appName}
</if>
<if test="conditionParamRef.appName == null">
${_conditionType_} a.appName is null
</if>
</if>
<if test="conditionParamRef.containsKey('appNameList')">
${_conditionType_} a.appName in
<foreach collection="conditionParamRef.appNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('filePath')">
<if test="conditionParamRef.filePath != null and conditionParamRef.filePath != ''">
${_conditionType_} a.filePath like #{${_conditionParam_}.filePath}
</if>
<if test="conditionParamRef.filePath == null">
${_conditionType_} a.filePath is null
</if>
</if>
<if test="conditionParamRef.containsKey('filePathList')">
${_conditionType_} a.filePath in
<foreach collection="conditionParamRef.filePathList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('distributeFilePath')">
<if test="conditionParamRef.distributeFilePath != null and conditionParamRef.distributeFilePath != ''">
${_conditionType_} a.distributeFilePath like #{${_conditionParam_}.distributeFilePath}
</if>
<if test="conditionParamRef.distributeFilePath == null">
${_conditionType_} a.distributeFilePath is null
</if>
</if>
<if test="conditionParamRef.containsKey('distributeFilePathList')">
${_conditionType_} a.distributeFilePath in
<foreach collection="conditionParamRef.distributeFilePathList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('appType')">
<if test="conditionParamRef.appType != null ">
${_conditionType_} a.appType = #{${_conditionParam_}.appType}
</if>
<if test="conditionParamRef.appType == null">
${_conditionType_} a.appType is null
</if>
</if>
<if test="conditionParamRef.containsKey('appTypeList')">
${_conditionType_} a.appType in
<foreach collection="conditionParamRef.appTypeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('appTypeStart') and conditionParamRef.appTypeStart != null">
${_conditionType_} a.appType <![CDATA[ >= ]]> #{${_conditionParam_}.appTypeStart}
</if>
<if test="conditionParamRef.containsKey('appTypeEnd') and conditionParamRef.appTypeEnd != null">
${_conditionType_} a.appType <![CDATA[ <= ]]> #{${_conditionParam_}.appTypeEnd}
</if>
<if test="conditionParamRef.containsKey('distribute')">
<if test="conditionParamRef.distribute != null ">
${_conditionType_} a.distribute = #{${_conditionParam_}.distribute}
</if>
<if test="conditionParamRef.distribute == null">
${_conditionType_} a.distribute is null
</if>
</if>
<if test="conditionParamRef.containsKey('distributeList')">
${_conditionType_} a.distribute in
<foreach collection="conditionParamRef.distributeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('distributeStart') and conditionParamRef.distributeStart != null">
${_conditionType_} a.distribute <![CDATA[ >= ]]> #{${_conditionParam_}.distributeStart}
</if>
<if test="conditionParamRef.containsKey('distributeEnd') and conditionParamRef.distributeEnd != null">
${_conditionType_} a.distribute <![CDATA[ <= ]]> #{${_conditionParam_}.distributeEnd}
</if>
<if test="conditionParamRef.containsKey('version')">
<if test="conditionParamRef.version != null and conditionParamRef.version != ''">
${_conditionType_} a.version like #{${_conditionParam_}.version}
</if>
<if test="conditionParamRef.version == null">
${_conditionType_} a.version is null
</if>
</if>
<if test="conditionParamRef.containsKey('versionList')">
${_conditionType_} a.version in
<foreach collection="conditionParamRef.versionList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
</if>
<if test="conditionParamRef.createTime == null">
${_conditionType_} a.createTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateUserId')">
<if test="conditionParamRef.updateUserId != null ">
${_conditionType_} a.updateUserId = #{${_conditionParam_}.updateUserId}
</if>
<if test="conditionParamRef.updateUserId == null">
${_conditionType_} a.updateUserId is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateUserIdList')">
${_conditionType_} a.updateUserId in
<foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('updateUserIdStart') and conditionParamRef.updateUserIdStart != null">
${_conditionType_} a.updateUserId <![CDATA[ >= ]]> #{${_conditionParam_}.updateUserIdStart}
</if>
<if test="conditionParamRef.containsKey('updateUserIdEnd') and conditionParamRef.updateUserIdEnd != null">
${_conditionType_} a.updateUserId <![CDATA[ <= ]]> #{${_conditionParam_}.updateUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind}
</foreach>
</trim>
</if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('appCode')">
a.appCode
<if test='orderCol.appCode != null and "DESC".equalsIgnoreCase(orderCol.appCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('appName')">
a.appName
<if test='orderCol.appName != null and "DESC".equalsIgnoreCase(orderCol.appName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('filePath')">
a.filePath
<if test='orderCol.filePath != null and "DESC".equalsIgnoreCase(orderCol.filePath)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('distributeFilePath')">
a.distributeFilePath
<if test='orderCol.distributeFilePath != null and "DESC".equalsIgnoreCase(orderCol.distributeFilePath)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('appType')">
a.appType
<if test='orderCol.appType != null and "DESC".equalsIgnoreCase(orderCol.appType)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('distribute')">
a.distribute
<if test='orderCol.distribute != null and "DESC".equalsIgnoreCase(orderCol.distribute)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('version')">
a.version
<if test='orderCol.version != null and "DESC".equalsIgnoreCase(orderCol.version)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateUserId')">
a.updateUserId
<if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
<sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()">
GROUP BY
<trim suffixOverrides="," suffix="">
<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
${item}
</foreach>
</trim>
</if>
</sql>
</mapper>
\ No newline at end of file
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###应用发布部署列表
POST {{baseUrl}}/app/publish/list
Authorization: {{authToken}}
Content-Type: application/json
{
"appCode":"fvvux8",
"appName":"ky08yt",
"filePath":"zarhfo",
"distributeFilePath":"g3uxc3",
"appType":603,
"distribute":205,
"version":"4ziigy",
"page":1,
"size":10
}
###应用发布部署更新与保存
POST {{baseUrl}}/app/publish/save
Authorization: {{authToken}}
Content-Type: application/json
{
"appCode":"fz9bky",
"appName":"8hrivq",
"filePath":"szqb1k",
"distributeFilePath":"40rn79",
"appType":297,
"distribute":171,
"version":"20jc15",
}
> {%
client.global.set("AppPublish_id", JSON.parse(response.body).data.id);
%}
###应用发布部署查看
GET {{baseUrl}}/app/publish/info?id={{AppPublish_id}}
Authorization: {{authToken}}
Accept: application/json
###应用发布部署编辑
GET {{baseUrl}}/app/publish/edit?id={{AppPublish_id}}
Authorization: {{authToken}}
Accept: application/json
###应用发布部署删除
GET {{baseUrl}}/app/publish/delete?id={{AppPublish_id}}
Authorization: {{authToken}}
Accept: application/json
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