关联表添加id

main
hansha 2 years ago
parent a376bb2626
commit cf80a9cabc

@ -9,22 +9,36 @@ import com.ruoyi.common.core.domain.BaseEntity;
* szxc_cs_fw * szxc_cs_fw
* *
* @author hs * @author hs
* @date 2024-03-29 * @date 2024-03-30
*/ */
public class SzxcCsFw extends BaseEntity public class SzxcCsFw extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 场所id */ /** 场所id */
@Excel(name = "场所id")
private Long csId; private Long csId;
/** 房屋id */ /** 房屋id */
@Excel(name = "房屋id")
private Long fwId; private Long fwId;
/** 房屋名称 */ /** 房屋名称 */
@Excel(name = "房屋名称") @Excel(name = "房屋名称")
private String fwName; private String fwName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCsId(Long csId) public void setCsId(Long csId)
{ {
this.csId = csId; this.csId = csId;
@ -56,6 +70,7 @@ public class SzxcCsFw extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("csId", getCsId()) .append("csId", getCsId())
.append("fwId", getFwId()) .append("fwId", getFwId())
.append("fwName", getFwName()) .append("fwName", getFwName())

@ -1,40 +1,55 @@
package com.ruoyi.szxc.domain; 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.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* szxc_jm_car * szxc_jm_car
* *
* @author hs * @author hs
* @date 2024-03-16 * @date 2024-03-30
*/ */
public class SzxcJmCar extends BaseEntity public class SzxcJmCar extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 居民id */ /** 居民id */
@Excel(name = "居民id")
private Long jmId; private Long jmId;
/** 车辆id */ /** 车辆id */
@Excel(name = "车辆id")
private Long carId; private Long carId;
public void setJmId(Long jmId) public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setJmId(Long jmId)
{ {
this.jmId = jmId; this.jmId = jmId;
} }
public Long getJmId() public Long getJmId()
{ {
return jmId; return jmId;
} }
public void setCarId(Long carId) public void setCarId(Long carId)
{ {
this.carId = carId; this.carId = carId;
} }
public Long getCarId() public Long getCarId()
{ {
return carId; return carId;
} }
@ -42,8 +57,9 @@ public class SzxcJmCar extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("jmId", getJmId()) .append("id", getId())
.append("carId", getCarId()) .append("jmId", getJmId())
.toString(); .append("carId", getCarId())
.toString();
} }
} }

@ -7,35 +7,49 @@ import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* szxc_jm_house * szxc_jm_house
* *
* @author hs * @author hs
* @date 2024-03-16 * @date 2024-03-30
*/ */
public class SzxcJmHouse extends BaseEntity public class SzxcJmHouse extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 居民id */ /** 居民id */
@Excel(name = "居民id")
private Long jmId; private Long jmId;
/** 房屋id */ /** 房屋id */
@Excel(name = "房屋id")
private Long houseId; private Long houseId;
public void setJmId(Long jmId) public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setJmId(Long jmId)
{ {
this.jmId = jmId; this.jmId = jmId;
} }
public Long getJmId() public Long getJmId()
{ {
return jmId; return jmId;
} }
public void setHouseId(Long houseId) public void setHouseId(Long houseId)
{ {
this.houseId = houseId; this.houseId = houseId;
} }
public Long getHouseId() public Long getHouseId()
{ {
return houseId; return houseId;
} }
@ -43,8 +57,9 @@ public class SzxcJmHouse extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("jmId", getJmId()) .append("id", getId())
.append("houseId", getHouseId()) .append("jmId", getJmId())
.toString(); .append("houseId", getHouseId())
.toString();
} }
} }

@ -9,22 +9,36 @@ import com.ruoyi.common.core.domain.BaseEntity;
* szxc_jm_tag * szxc_jm_tag
* *
* @author hs * @author hs
* @date 2024-03-21 * @date 2024-03-30
*/ */
public class SzxcJmTag extends BaseEntity public class SzxcJmTag extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 居民id */ /** 居民id */
@Excel(name = "居民id")
private Long jmId; private Long jmId;
/** 标签id */ /** 标签id */
@Excel(name = "标签id")
private Long tagId; private Long tagId;
/** 标签名称 */ /** 标签名称 */
@Excel(name = "标签名称") @Excel(name = "标签名称")
private String tagName; private String tagName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setJmId(Long jmId) public void setJmId(Long jmId)
{ {
this.jmId = jmId; this.jmId = jmId;
@ -56,6 +70,7 @@ public class SzxcJmTag extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("jmId", getJmId()) .append("jmId", getJmId())
.append("tagId", getTagId()) .append("tagId", getTagId())
.append("tagName", getTagName()) .append("tagName", getTagName())

@ -5,28 +5,31 @@
<mapper namespace="com.ruoyi.szxc.mapper.SzxcCsFwMapper"> <mapper namespace="com.ruoyi.szxc.mapper.SzxcCsFwMapper">
<resultMap type="SzxcCsFw" id="SzxcCsFwResult"> <resultMap type="SzxcCsFw" id="SzxcCsFwResult">
<result property="id" column="id" />
<result property="csId" column="cs_id" /> <result property="csId" column="cs_id" />
<result property="fwId" column="fw_id" /> <result property="fwId" column="fw_id" />
<result property="fwName" column="fw_name" /> <result property="fwName" column="fw_name" />
</resultMap> </resultMap>
<sql id="selectSzxcCsFwVo"> <sql id="selectSzxcCsFwVo">
select cs_id, fw_id, fw_name from szxc_cs_fw select id, cs_id, fw_id, fw_name from szxc_cs_fw
</sql> </sql>
<select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult"> <select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult">
<include refid="selectSzxcCsFwVo"/> <include refid="selectSzxcCsFwVo"/>
<where> <where>
<if test="csId != null "> and cs_id = #{csId}</if>
<if test="fwId != null "> and fw_id = #{fwId}</if>
<if test="fwName != null and fwName != ''"> and fw_name like concat('%', #{fwName}, '%')</if> <if test="fwName != null and fwName != ''"> and fw_name like concat('%', #{fwName}, '%')</if>
</where> </where>
</select> </select>
<select id="selectSzxcCsFwByCsId" parameterType="Long" resultMap="SzxcCsFwResult"> <select id="selectSzxcCsFwById" parameterType="Long" resultMap="SzxcCsFwResult">
<include refid="selectSzxcCsFwVo"/> <include refid="selectSzxcCsFwVo"/>
where cs_id = #{csId} where id = #{id}
</select> </select>
<insert id="insertSzxcCsFw" parameterType="SzxcCsFw"> <insert id="insertSzxcCsFw" parameterType="SzxcCsFw" useGeneratedKeys="true" keyProperty="id">
insert into szxc_cs_fw insert into szxc_cs_fw
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="csId != null">cs_id,</if> <if test="csId != null">cs_id,</if>
@ -43,20 +46,21 @@
<update id="updateSzxcCsFw" parameterType="SzxcCsFw"> <update id="updateSzxcCsFw" parameterType="SzxcCsFw">
update szxc_cs_fw update szxc_cs_fw
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="csId != null">cs_id = #{csId},</if>
<if test="fwId != null">fw_id = #{fwId},</if> <if test="fwId != null">fw_id = #{fwId},</if>
<if test="fwName != null and fwName != ''">fw_name = #{fwName},</if> <if test="fwName != null and fwName != ''">fw_name = #{fwName},</if>
</trim> </trim>
where cs_id = #{csId} where id = #{id}
</update> </update>
<delete id="deleteSzxcCsFwByCsId" parameterType="Long"> <delete id="deleteSzxcCsFwById" parameterType="Long">
delete from szxc_cs_fw where cs_id = #{csId} delete from szxc_cs_fw where id = #{id}
</delete> </delete>
<delete id="deleteSzxcCsFwByCsIds" parameterType="String"> <delete id="deleteSzxcCsFwByIds" parameterType="String">
delete from szxc_cs_fw where cs_id in delete from szxc_cs_fw where id in
<foreach item="csId" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{csId} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

@ -0,0 +1,61 @@
<?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.ruoyi.szxc.mapper.SzxcJmCarMapper">
<resultMap type="SzxcJmCar" id="SzxcJmCarResult">
<result property="id" column="id" />
<result property="jmId" column="jm_id" />
<result property="carId" column="car_id" />
</resultMap>
<sql id="selectSzxcJmCarVo">
select id, jm_id, car_id from szxc_jm_car
</sql>
<select id="selectSzxcJmCarList" parameterType="SzxcJmCar" resultMap="SzxcJmCarResult">
<include refid="selectSzxcJmCarVo"/>
<where>
<if test="jmId != null "> and jm_id = #{jmId}</if>
<if test="carId != null "> and car_id = #{carId}</if>
</where>
</select>
<select id="selectSzxcJmCarById" parameterType="Long" resultMap="SzxcJmCarResult">
<include refid="selectSzxcJmCarVo"/>
where id = #{id}
</select>
<insert id="insertSzxcJmCar" parameterType="SzxcJmCar" useGeneratedKeys="true" keyProperty="id">
insert into szxc_jm_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jmId != null">jm_id,</if>
<if test="carId != null">car_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jmId != null">#{jmId},</if>
<if test="carId != null">#{carId},</if>
</trim>
</insert>
<update id="updateSzxcJmCar" parameterType="SzxcJmCar">
update szxc_jm_car
<trim prefix="SET" suffixOverrides=",">
<if test="jmId != null">jm_id = #{jmId},</if>
<if test="carId != null">car_id = #{carId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSzxcJmCarById" parameterType="Long">
delete from szxc_jm_car where id = #{id}
</delete>
<delete id="deleteSzxcJmCarByIds" parameterType="String">
delete from szxc_jm_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,61 @@
<?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.ruoyi.szxc.mapper.SzxcJmHouseMapper">
<resultMap type="SzxcJmHouse" id="SzxcJmHouseResult">
<result property="id" column="id" />
<result property="jmId" column="jm_id" />
<result property="houseId" column="house_id" />
</resultMap>
<sql id="selectSzxcJmHouseVo">
select id, jm_id, house_id from szxc_jm_house
</sql>
<select id="selectSzxcJmHouseList" parameterType="SzxcJmHouse" resultMap="SzxcJmHouseResult">
<include refid="selectSzxcJmHouseVo"/>
<where>
<if test="jmId != null "> and jm_id = #{jmId}</if>
<if test="houseId != null "> and house_id = #{houseId}</if>
</where>
</select>
<select id="selectSzxcJmHouseById" parameterType="Long" resultMap="SzxcJmHouseResult">
<include refid="selectSzxcJmHouseVo"/>
where id = #{id}
</select>
<insert id="insertSzxcJmHouse" parameterType="SzxcJmHouse" useGeneratedKeys="true" keyProperty="id">
insert into szxc_jm_house
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jmId != null">jm_id,</if>
<if test="houseId != null">house_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jmId != null">#{jmId},</if>
<if test="houseId != null">#{houseId},</if>
</trim>
</insert>
<update id="updateSzxcJmHouse" parameterType="SzxcJmHouse">
update szxc_jm_house
<trim prefix="SET" suffixOverrides=",">
<if test="jmId != null">jm_id = #{jmId},</if>
<if test="houseId != null">house_id = #{houseId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSzxcJmHouseById" parameterType="Long">
delete from szxc_jm_house where id = #{id}
</delete>
<delete id="deleteSzxcJmHouseByIds" parameterType="String">
delete from szxc_jm_house where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -5,30 +5,31 @@
<mapper namespace="com.ruoyi.szxc.mapper.SzxcJmTagMapper"> <mapper namespace="com.ruoyi.szxc.mapper.SzxcJmTagMapper">
<resultMap type="SzxcJmTag" id="SzxcJmTagResult"> <resultMap type="SzxcJmTag" id="SzxcJmTagResult">
<result property="id" column="id" />
<result property="jmId" column="jm_id" /> <result property="jmId" column="jm_id" />
<result property="tagId" column="tag_id" /> <result property="tagId" column="tag_id" />
<result property="tagName" column="tag_name" /> <result property="tagName" column="tag_name" />
</resultMap> </resultMap>
<sql id="selectSzxcJmTagVo"> <sql id="selectSzxcJmTagVo">
select jm_id, tag_id, tag_name from szxc_jm_tag select id, jm_id, tag_id, tag_name from szxc_jm_tag
</sql> </sql>
<select id="selectSzxcJmTagList" parameterType="SzxcJmTag" resultMap="SzxcJmTagResult"> <select id="selectSzxcJmTagList" parameterType="SzxcJmTag" resultMap="SzxcJmTagResult">
<include refid="selectSzxcJmTagVo"/> <include refid="selectSzxcJmTagVo"/>
<where> <where>
<if test=" jmId!= null "> and jm_id=#{jmId}</if> <if test="jmId != null "> and jm_id = #{jmId}</if>
<if test=" tagId!= null "> and tag_id=#{tagId}</if> <if test="tagId != null "> and tag_id = #{tagId}</if>
<if test="tagName != null and tagName != ''"> and tag_name like concat('%', #{tagName}, '%')</if> <if test="tagName != null and tagName != ''"> and tag_name like concat('%', #{tagName}, '%')</if>
</where> </where>
</select> </select>
<select id="selectSzxcJmTagByJmId" parameterType="Long" resultMap="SzxcJmTagResult"> <select id="selectSzxcJmTagById" parameterType="Long" resultMap="SzxcJmTagResult">
<include refid="selectSzxcJmTagVo"/> <include refid="selectSzxcJmTagVo"/>
where jm_id = #{jmId} where id = #{id}
</select> </select>
<insert id="insertSzxcJmTag" parameterType="SzxcJmTag"> <insert id="insertSzxcJmTag" parameterType="SzxcJmTag" useGeneratedKeys="true" keyProperty="id">
insert into szxc_jm_tag insert into szxc_jm_tag
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jmId != null">jm_id,</if> <if test="jmId != null">jm_id,</if>
@ -45,20 +46,21 @@
<update id="updateSzxcJmTag" parameterType="SzxcJmTag"> <update id="updateSzxcJmTag" parameterType="SzxcJmTag">
update szxc_jm_tag update szxc_jm_tag
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="jmId != null">jm_id = #{jmId},</if>
<if test="tagId != null">tag_id = #{tagId},</if> <if test="tagId != null">tag_id = #{tagId},</if>
<if test="tagName != null">tag_name = #{tagName},</if> <if test="tagName != null">tag_name = #{tagName},</if>
</trim> </trim>
where jm_id = #{jmId} where id = #{id}
</update> </update>
<delete id="deleteSzxcJmTagByJmId" parameterType="Long"> <delete id="deleteSzxcJmTagById" parameterType="Long">
delete from szxc_jm_tag where jm_id = #{jmId} delete from szxc_jm_tag where id = #{id}
</delete> </delete>
<delete id="deleteSzxcJmTagByJmIds" parameterType="String"> <delete id="deleteSzxcJmTagByIds" parameterType="String">
delete from szxc_jm_tag where jm_id in delete from szxc_jm_tag where id in
<foreach item="jmId" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{jmId} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

@ -1,6 +1,22 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="场所id" prop="csId">
<el-input
v-model="queryParams.csId"
placeholder="请输入场所id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="房屋id" prop="fwId">
<el-input
v-model="queryParams.fwId"
placeholder="请输入房屋id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="房屋名称" prop="fwName"> <el-form-item label="房屋名称" prop="fwName">
<el-input <el-input
v-model="queryParams.fwName" v-model="queryParams.fwName"
@ -63,6 +79,7 @@
<el-table v-loading="loading" :data="cs_fwList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="cs_fwList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="场所id" align="center" prop="csId" /> <el-table-column label="场所id" align="center" prop="csId" />
<el-table-column label="房屋id" align="center" prop="fwId" /> <el-table-column label="房屋id" align="center" prop="fwId" />
<el-table-column label="房屋名称" align="center" prop="fwName" /> <el-table-column label="房屋名称" align="center" prop="fwName" />
@ -138,6 +155,8 @@
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
csId: null,
fwId: null,
fwName: null fwName: null
}, },
// //
@ -171,6 +190,7 @@
// //
reset() { reset() {
this.form = { this.form = {
id: null,
csId: null, csId: null,
fwId: null, fwId: null,
fwName: null fwName: null
@ -189,7 +209,7 @@
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.csId) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -202,8 +222,8 @@
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const csId = row.csId || this.ids const id = row.id || this.ids
getCs_fw(csId).then(response => { getCs_fw(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改场所房屋关联"; this.title = "修改场所房屋关联";
@ -213,7 +233,7 @@
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.csId != null) { if (this.form.id != null) {
updateCs_fw(this.form).then(response => { updateCs_fw(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -231,9 +251,9 @@
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const csIds = row.csId || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除场所房屋关联编号为"' + csIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除场所房屋关联编号为"' + ids + '"的数据项?').then(function() {
return delCs_fw(csIds); return delCs_fw(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");

Loading…
Cancel
Save