添加房屋名称

main
hansha 2 years ago
parent 835f8924fb
commit a376bb2626

@ -1,12 +1,13 @@
package com.ruoyi.szxc.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* szxc_cs_fw
*
*
* @author hs
* @date 2024-03-29
*/
@ -20,30 +21,44 @@ public class SzxcCsFw extends BaseEntity
/** 房屋id */
private Long fwId;
public void setCsId(Long csId)
/** 房屋名称 */
@Excel(name = "房屋名称")
private String fwName;
public void setCsId(Long csId)
{
this.csId = csId;
}
public Long getCsId()
public Long getCsId()
{
return csId;
}
public void setFwId(Long fwId)
public void setFwId(Long fwId)
{
this.fwId = fwId;
}
public Long getFwId()
public Long getFwId()
{
return fwId;
}
public void setFwName(String fwName)
{
this.fwName = fwName;
}
public String getFwName()
{
return fwName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("csId", getCsId())
.append("fwId", getFwId())
.toString();
.append("csId", getCsId())
.append("fwId", getFwId())
.append("fwName", getFwName())
.toString();
}
}

@ -1,45 +1,50 @@
<?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.szxc.mapper.SzxcCsFwMapper">
<resultMap type="SzxcCsFw" id="SzxcCsFwResult">
<result property="csId" column="cs_id" />
<result property="fwId" column="fw_id" />
<result property="fwName" column="fw_name" />
</resultMap>
<sql id="selectSzxcCsFwVo">
select cs_id, fw_id from szxc_cs_fw
select cs_id, fw_id, fw_name from szxc_cs_fw
</sql>
<select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult">
<include refid="selectSzxcCsFwVo"/>
<where>
<where>
<if test="fwName != null and fwName != ''"> and fw_name like concat('%', #{fwName}, '%')</if>
</where>
</select>
<select id="selectSzxcCsFwByCsId" parameterType="Long" resultMap="SzxcCsFwResult">
<include refid="selectSzxcCsFwVo"/>
where cs_id = #{csId}
</select>
<insert id="insertSzxcCsFw" parameterType="SzxcCsFw">
insert into szxc_cs_fw
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="csId != null">cs_id,</if>
<if test="fwId != null">fw_id,</if>
</trim>
<if test="fwName != null and fwName != ''">fw_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="csId != null">#{csId},</if>
<if test="fwId != null">#{fwId},</if>
</trim>
<if test="fwName != null and fwName != ''">#{fwName},</if>
</trim>
</insert>
<update id="updateSzxcCsFw" parameterType="SzxcCsFw">
update szxc_cs_fw
<trim prefix="SET" suffixOverrides=",">
<if test="fwId != null">fw_id = #{fwId},</if>
<if test="fwName != null and fwName != ''">fw_name = #{fwName},</if>
</trim>
where cs_id = #{csId}
</update>
@ -49,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteSzxcCsFwByCsIds" parameterType="String">
delete from szxc_cs_fw where cs_id in
delete from szxc_cs_fw where cs_id in
<foreach item="csId" collection="array" open="(" separator="," close=")">
#{csId}
</foreach>

@ -1,6 +1,14 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="房屋名称" prop="fwName">
<el-input
v-model="queryParams.fwName"
placeholder="请输入房屋名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -57,6 +65,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="场所id" align="center" prop="csId" />
<el-table-column label="房屋id" align="center" prop="fwId" />
<el-table-column label="房屋名称" align="center" prop="fwName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -76,7 +85,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -88,6 +97,9 @@
<!-- 添加或修改场所房屋关联对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="房屋名称" prop="fwName">
<el-input v-model="form.fwName" placeholder="请输入房屋名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -98,136 +110,141 @@
</template>
<script>
import { listCs_fw, getCs_fw, delCs_fw, addCs_fw, updateCs_fw } from "@/api/szxc/cs_fw";
import { listCs_fw, getCs_fw, delCs_fw, addCs_fw, updateCs_fw } from "@/api/szxc/cs_fw";
export default {
name: "Cs_fw",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
cs_fwList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询场所房屋关联列表 */
getList() {
this.loading = true;
listCs_fw(this.queryParams).then(response => {
this.cs_fwList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
csId: null,
fwId: null
export default {
name: "Cs_fw",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
cs_fwList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
fwName: null
},
//
form: {},
//
rules: {
fwName: [
{ required: true, message: "房屋名称不能为空", trigger: "blur" }
]
}
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
created() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.csId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加场所房屋关联";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const csId = row.csId || this.ids
getCs_fw(csId).then(response => {
this.form = response.data;
methods: {
/** 查询场所房屋关联列表 */
getList() {
this.loading = true;
listCs_fw(this.queryParams).then(response => {
this.cs_fwList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
csId: null,
fwId: null,
fwName: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.csId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "修改场所房屋关联";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.csId != null) {
updateCs_fw(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCs_fw(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
this.title = "添加场所房屋关联";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const csId = row.csId || this.ids
getCs_fw(csId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改场所房屋关联";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.csId != null) {
updateCs_fw(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCs_fw(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const csIds = row.csId || this.ids;
this.$modal.confirm('是否确认删除场所房屋关联编号为"' + csIds + '"的数据项?').then(function() {
return delCs_fw(csIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('szxc/cs_fw/export', {
...this.queryParams
}, `cs_fw_${new Date().getTime()}.xlsx`)
});
},
/** 删除按钮操作 */
handleDelete(row) {
const csIds = row.csId || this.ids;
this.$modal.confirm('是否确认删除场所房屋关联编号为"' + csIds + '"的数据项?').then(function() {
return delCs_fw(csIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('szxc/cs_fw/export', {
...this.queryParams
}, `cs_fw_${new Date().getTime()}.xlsx`)
}
}
}
};
};
</script>

Loading…
Cancel
Save