山海关古城测试--房产房屋

news2024/11/15 5:45:45

1.树状图搜索房产

1.1实现思路

  1. 因为树状图搜索要显示在界面中,所以需要在html文件中进行添加树状结构
  2.  而树状结构怎么来的,所以需要在controller中新写一个方法来传输一个树状结构,让html直接访问它即可
  3. 树状结构在framework->web->Ztree.Java中已经写好了,所以我们不用重新自己编写树状结构,直接调用即可,但是树结点的设置还没写,所以我们需要在service中新写一个方法来完成树的建立
  4. 树的各结点为街道和片区,所以我们还需要得到这些街道及片区的主键ID和具体名称,因此还需要在片区的mapper中新写一个方法来取到这些片区和街道

1.2修改片区的mapper文件

        mapper.Java 新写一个函数selectPqJdTree,表示查询Tree需要的PqJd的数据

        mapper.xml 具体实现selectPqJdTree方法

1.3修改房产的service文件

        service 新写一个selectPqJdTree方法,表示利用PqJd来建立需要的Tree

        servicImp 具体实现需要的Tree结构

   
    /**
     * 查询片区街道树结构
     *
     * @return 片区集合
     */
    @Override
    public List<Ztree> selectPqJdTree(){
    	///利用刚刚新写的片区的selectPqJdTree查询出正常使用的所有pq和jd,并全部存在片区pqs中
    	List <TBxwPqZhk> pqs = tBxwPqZhkMapper.selectPqJdTree();
    	/创建树tree,每个结点为Ztree数据
    	List <Ztree> tree = new ArrayList <Ztree> ();
    	for(TBxwPqZhk pq : pqs) {
    		//设置树结点中的片区结点Id,Name,Title,父节点Pid
    		Ztree zt = new Ztree();
//注意这里设置片区的结点id为负数,因为片区id和街道id有可能重复,会导致树的结点id一致,从而导致街道结点的父节点可能为街道,所以导致树状结构错误。而我们在点击树状图中的结点时,只需要街道id,所以片区结点id可以为负数
    		zt.setId(0-(long)Integer.parseInt(pq.getId()));
    		zt.setName(pq.getPqmc());
    		zt.setTitle(pq.getPqmc());
    		将片区的父节点id设置为0,后续在判断树中点击的是街道还是片区时,只需要判断该结点的父节点是否为0即可
    		zt.setpId(0L);
    		将该片区结点加入到tree中去
    		tree.add(zt);
    		取出存储在pq中的街道信息
    		List <TBxwPqJdZhk> jds = pq.gettBxwPqJdZhks();
    		if(jds == null)continue;
    		for(TBxwPqJdZhk jd : jds) {
    			//将街道信息存入Ztree中,并加入到tree,设置父节点id为所属片区结点id
    			Ztree ztjd = new Ztree();
    			ztjd.setId((long)Integer.parseInt(jd.getId()));
    			ztjd.setName(jd.getJdmc());
    			ztjd.setTitle(jd.getJdmc());
    			ztjd.setpId(0-(long)Integer.parseInt(pq.getId()));
    			tree.add(ztjd);
    		}
    	}
    	return tree;
    }

        如果设置片区的结点id也为片区id时,有可能会出现下图错误:左图为正常显示,右图为错误显示

   

        出现原因就是:南大街的街道id与西区的片区id一致,所以在产生西大街结点时,误认为它的父节点是南大街,导致出现树状结果错误

1.4修改房产的controller文件

        新写一个接口,负责传输该树状结构:

    
    @GetMapping("/treeData")
    @ResponseBody
    public List<Ztree> treeData()
    {
        List<Ztree> ztrees = tBxwFcZhkService.selectPqJdTree();

        return ztrees;
    }

1.5修改fc.html 

        具体代码:

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('房产列表')" />
    <th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>

<body class="gray-bg">
	<div class="ui-layout-west">
		<div class="box box-main">
			<div class="box-header">
				<div class="box-title">
					<i class="fa icon-grid"></i> 街道信息
				</div>
				<div class="box-tools pull-right">
					<a type="button" class="btn btn-box-tool" href="#"
						onclick="tjcjd()" title="街道管理"><i class="fa fa-edit"></i></a>
					<button type="button" class="btn btn-box-tool" id="btnExpand"
						title="展开" style="display: none;">
						<i class="fa fa-chevron-up"></i>
					</button>
					<button type="button" class="btn btn-box-tool" id="btnCollapse"
						title="折叠">
						<i class="fa fa-chevron-down"></i>
					</button>
					<button type="button" class="btn btn-box-tool" id="btnRefresh"
						title="刷新街道">
						<i class="fa fa-refresh"></i>
					</button>
				</div>
			</div>
			<div class="ui-layout-content">
				<div id="tree" class="ztree"></div>
			</div>
		</div>
	</div>
	
	<div class="ui-layout-center">
	<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<form id="formId">
						<input id="tBxwPqJdZhkId" type="hidden" name="tBxwPqJdZhkId" />
						<div class="select-list">
							<ul>
								<li><label>房产编号:</label> <input type="text" name="fcbh" />
								</li>
								<li ><label>产权人:</label> <input type="text" name="cqr" /></li>
								<li ><label>产权人身份证号码:</label> <input type="text"
									name="cqrsfz" /></li>
							
							
								<li><label>居住人:</label> <input type="text" name="jzr" /></li>
								<li><label>房屋产权证号:</label> <input type="text" name="fwcqz" />
								</li>
								<li><label>土地使用证号:</label> <input type="text" name="tdsyzh" />
								</li>
							
							
								<li><label>注销标志:</label> <select name="zxbz"
									th:with="type=${@dict.getType('t_jc_zxzt')}">
										<option value="">所有</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
											th:value="${dict.dictValue}"></option>
								</select></li>
								<li><a class="btn btn-primary btn-rounded btn-sm"
									onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
									<a class="btn btn-warning btn-rounded btn-sm"
									onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>

				<div class="btn-group-sm" id="toolbar" role="group">
					<a class="btn btn-success" onclick="$.operate.add()"
						shiro:hasPermission="jcxx:fc:add"> <i class="fa fa-plus"></i>
						添加
					</a> <a class="btn btn-primary single disabled"
						onclick="$.operate.edit()" shiro:hasPermission="jcxx:fc:edit">
						<i class="fa fa-edit"></i> 修改
					</a> <a class="btn btn-danger multiple disabled"
						onclick="$.operate.removeAll()"
						shiro:hasPermission="jcxx:fc:remove"> <i class="fa fa-remove"></i>
						删除
					</a> <a class="btn btn-warning" onclick="$.table.exportExcel()"
						shiro:hasPermission="jcxx:fc:export"> <i
						class="fa fa-download"></i> 导出
					</a>
				</div>
				<div class="col-sm-12 select-table table-striped">

					<table id="bootstrap-table"></table>
					</div>
			</div>
		</div>
	</div>

    <th:block th:include="include :: footer" />
    <th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: ztree-js" />
	
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('jcxx:fc:edit')}]];
        var removeFlag = [[${@permission.hasPermi('jcxx:fc:remove')}]];
        var qllxDatas = [[${@dict.getType('t_jc_qllx')}]];
        var qlxzDatas = [[${@dict.getType('t_jc_qlxz')}]];
        var sfwzfDatas = [[${@dict.getType('t_jc_sfwzf')}]];
        var fccsDatas = [[${@dict.getType('t_jc_fccs')}]];
        var fwcbDatas = [[${@dict.getType('t_jc_fwcb')}]];
        var zxbzDatas = [[${@dict.getType('t_jc_zxztlx')}]];
        var prefix = ctx + "jcxx/fc";

        $(function() {
		    var panehHidden = false;
		    if ($(this).width() < 769) {
		        panehHidden = true;
		    }
		    $('body').layout({ initClosed: panehHidden, west__size: 185 });
	     	// 回到顶部绑定
	    	if ($.fn.toTop !== undefined) {
	    		var opt = {
	    			win:$('.ui-layout-center'),
	    			doc:$('.ui-layout-center')
	    		};
	    		$('#scroll-up').toTop(opt);
	    	}
	    	queryFcList();
	    	queryJdTree();
		});
        
        function queryFcList(){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "房产",
                sortable:true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'fcmc',
                    title: '房产名称'               
                },
                {
                    field: 'tBxwPqJdZhk.pqmc',
                    title: '所属片区',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"50px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"100px",
                             }
                         }
                     }
                   
                },
                {
                    field: 'tBxwPqJdZhk.jdmc',
                    title: '所属街道',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"100px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"150px",
                             }
                         }
                     }
                    
                },
                {
                    field: 'fwcb',
                    title: '房屋产别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(fwcbDatas, value);
                    }
                },
                {
                    field: 'fwzl',
                    title: '房屋座落',
                   formatter:function (value, row, index,field) {
                       return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                    },
                  
                    cellStyle:function (value, row, index,field) {
                        return {
                            css:{
                                "min-width":"150px",
                                "white-space":"nowrap",
                                "test-overflow":"ellipsis",
                                "overflow":"hidden",
                                "max-width":"300px",
                            }
                        }
                    }
                },
                {
                    field: 'cqr',
                    title: '产权人',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"50px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"100px",
                             }
                         }
                     }
                    
                },
                {
                    field: 'cqrsfz',
                    title: '产权人身份证号码',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"150px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"300px",
                             }
                         }
                     }
                },
                {
                    field: 'cqrlxdh',
                    title: '产权人联系电话',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"150px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"250px",
                             }
                         }
                     }
                },
                {
                    field: 'jzr',
                    title: '居住人',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"50px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"100px",
                             }
                         }
                     }
                },
                {
                    field: 'jzrlxdh',
                    title: '居住人联系电话',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"150px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"250px",
                             }
                         }
                     }
                },
                {
                    field: 'fwcqz',
                    title: '房屋产权证号',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"200px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"300px",
                             }
                         }
                     }
                },
                {
                    field: 'tdsyzh',
                    title: '土地使用证号',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"150px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"300px",
                             }
                         }
                     }
                },
                {
                    field: 'tdsymj',
                    title: '土地使用面积'
                },
                {
                    field: 'qllx',
                    title: '权利类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(qllxDatas, value);
                    }
                },
                {
                    field: 'qlxz',
                    title: '权利性质',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(qlxzDatas, value);
                    }
                },
                {
                    field: 'sfwzf',
                    title: '是否无证房',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(sfwzfDatas, value);
                    }
                },
                {
                    field: 'fccs',
                    title: '房产出售',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(fccsDatas, value);
                    }
                },
                {
                    field: 'zxbz',
                    title: '注销标志',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(zxbzDatas, value);
                    }
                },
                {
                    field: 'bz',
                    title: '备注',
                    formatter:function (value, row, index,field) {
                        return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title="+value+">"+value+"</span>"
                     },
                   
                     cellStyle:function (value, row, index,field) {
                         return {
                             css:{
                                 "min-width":"50px",
                                 "white-space":"nowrap",
                                 "test-overflow":"ellipsis",
                                 "overflow":"hidden",
                                 "max-width":"100px",
                             }
                         }
                     }
                },
                {
                    field: 'jzmj',
                    title: '建筑面积'
                },
                {
                    field: 'fwjs',
                    title: '房屋间数'
                },
                {
                    field: 'fwtms',
                    title: '房屋条目数'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
  		 }
        
        function queryJdTree()
		{
			var url = prefix + "/treeData";
			var options = {
		        url: url,
		        expandLevel: 2,
		        onClick : zOnClick
		    };
			$.tree.init(options);
			
			function zOnClick(event, treeId, treeNode) {
				if(treeNode.id == -2)$("#tBxwPqJdZhkId").val('');
				else $("#tBxwPqJdZhkId").val(treeNode.id);
				if (treeNode.pId == null)
				    {$.modal.alert('请选择要查询的街道!');}
				else {

				$.table.search();
				}
			}
		}
        
        $('#btnExpand').click(function() {
			$._tree.expandAll(true);
		    $(this).hide();
		    $('#btnCollapse').show();
		});
		
		$('#btnCollapse').click(function() {
			$._tree.expandAll(false);
		    $(this).hide();
		    $('#btnExpand').show();
		});
		$('#btnRefresh').click(function() {
			queryJdTree();
		});
		
		/* 辖区信息 */
		function tjcjd() {
			var url = ctx + "jcxx/jd";
			$.modal.openTab("辖区管理", url);
		}
		
    </script>
</body>
</html>

1.6具体实现

2.房屋连接房产

修改房产的domain属性

        因为需要在房产之中显示房屋属性,所以应该在房产的domain属性中加入房屋的集合、

        domain代码:

package com.xyt.project.shggc.jcxx.fc.domain;

import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xyt.framework.aspectj.lang.annotation.Excel;
import com.xyt.framework.web.domain.BaseEntity;
import com.xyt.project.shggc.jcxx.fw.domain.TBxwFcFwZhk;
import com.xyt.project.shggc.jcxx.jd.domain.TBxwPqJdZhk;

/**
 * 房产对象 t_bxw_fc_zhk
 *
 * @author ruoyi
 * @date 2024-08-08
 */
public class TBxwFcZhk extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    private String id;

    /** 街道id */
    @Excel(name = "街道id")
    private String tBxwPqJdZhkId;

    /***********导出属性*************/
    
    @Excel(name = "所属片区")
    private String pqmc; 
    
    @Excel(name = "所属街道")
    private String jdmc;  
    
    /** 房产编号 */
    @Excel(name = "房产编号")
    private String fcbh;

    /** 房产名称 */
    @Excel(name = "房产名称")
    private String fcmc;

    /** 房屋坐落 */
    @Excel(name = "房屋坐落")
    private String fwzl;

    /** 产权人 */
    @Excel(name = "产权人")
    private String cqr;

    /** 产权人身份证 */
    @Excel(name = "产权人身份证")
    private String cqrsfz;

    /** 产权人联系电话 */
    @Excel(name = "产权人联系电话")
    private String cqrlxdh;

    /** 居住人 */
    @Excel(name = "居住人")
    private String jzr;

    /** 居住人联系电话 */
    @Excel(name = "居住人联系电话")
    private String jzrlxdh;

    /** 房屋产权证号 */
    @Excel(name = "房屋产权证号")
    private String fwcqzh;

    /** 土地使用证号 */
    @Excel(name = "土地使用证号")
    private String tdsyzh;

    /** 土地使用面积 */
    @Excel(name = "土地使用面积")
    private Long tdsymj;

    /** 权利类型 */
    @Excel(name = "权利类型")
    private String qllx;

    /** 权利性质 */
    @Excel(name = "权利性质")
    private String qlxz;

    /** 是否无证房 */
    @Excel(name = "是否无证房")
    private String sfwzf;

    /** 房屋出售 */
    @Excel(name = "房屋出售")
    private String fccs;

    /** 房屋产别 */
    @Excel(name = "房屋产别")
    private String fwcb;

    /** 建筑面积 */
    @Excel(name = "建筑面积")
    private double jzmj;
    
    /** 房屋间数 */
    @Excel(name = "房屋间数 ")
    private double fwjs;
    
    /** 房屋条目数 */
    @Excel(name = "房屋条目数")
    private int fwtms;
    
    /** 注销标志 */
    @Excel(name = "注销标志")
    private String zxbz;

    /** 备注 */
    @Excel(name = "备注")
    private String bz;

    /***********数据库扩展属性*************/
    
    /** 扩展1 */
    @Excel(name = "扩展1")
    private String kz1;

    /** 扩展2 */
    @Excel(name = "扩展2")
    private String kz2;

    
    /***********一对一及一对多属性*************/
    /** 街道信息 */
    private TBxwPqJdZhk tBxwPqJdZhk;

    /** 房屋信息 */
    List <TBxwFcFwZhk> tBxwFcFwZhks;
    public void setId(String id)
    {
        this.id = id;
    }

    public String getId()
    {
        return id;
    }
    
    
    public String getPqmc() {
		return pqmc;
	}

	public void setPqmc(String pqmc) {
		this.pqmc = pqmc;
	}

	public String getJdmc() {
		return jdmc;
	}

	public void setJdmc(String jdmc) {
		this.jdmc = jdmc;
	}

	public void settBxwPqJdZhkId(String tBxwPqJdZhkId)
    {
        this.tBxwPqJdZhkId = tBxwPqJdZhkId;
    }

    public String gettBxwPqJdZhkId()
    {
        return tBxwPqJdZhkId;
    }
    public void setFcbh(String fcbh)
    {
        this.fcbh = fcbh;
    }

    public String getFcbh()
    {
        return fcbh;
    }
    public void setFcmc(String fcmc)
    {
        this.fcmc = fcmc;
    }

    public String getFcmc()
    {
        return fcmc;
    }
    public void setFwzl(String fwzl)
    {
        this.fwzl = fwzl;
    }

    public String getFwzl()
    {
        return fwzl;
    }
    public void setCqr(String cqr)
    {
        this.cqr = cqr;
    }

    public String getCqr()
    {
        return cqr;
    }
    public void setCqrsfz(String cqrsfz)
    {
        this.cqrsfz = cqrsfz;
    }

    public String getCqrsfz()
    {
        return cqrsfz;
    }
    public void setCqrlxdh(String cqrlxdh)
    {
        this.cqrlxdh = cqrlxdh;
    }

    public String getCqrlxdh()
    {
        return cqrlxdh;
    }
    public void setJzr(String jzr)
    {
        this.jzr = jzr;
    }

    public String getJzr()
    {
        return jzr;
    }
    public void setJzrlxdh(String jzrlxdh)
    {
        this.jzrlxdh = jzrlxdh;
    }

    public String getJzrlxdh()
    {
        return jzrlxdh;
    }
    public void setFwcqzh(String fwcqzh)
    {
        this.fwcqzh = fwcqzh;
    }

    public String getFwcqzh()
    {
        return fwcqzh;
    }
    public void setTdsyzh(String tdsyzh)
    {
        this.tdsyzh = tdsyzh;
    }

    public String getTdsyzh()
    {
        return tdsyzh;
    }
    public void setTdsymj(Long tdsymj)
    {
        this.tdsymj = tdsymj;
    }

    public Long getTdsymj()
    {
        return tdsymj;
    }
    public void setQllx(String qllx)
    {
        this.qllx = qllx;
    }

    public String getQllx()
    {
        return qllx;
    }
    public void setQlxz(String qlxz)
    {
        this.qlxz = qlxz;
    }

    public String getQlxz()
    {
        return qlxz;
    }
    public void setSfwzf(String sfwzf)
    {
        this.sfwzf = sfwzf;
    }

    public String getSfwzf()
    {
        return sfwzf;
    }
    public void setFccs(String fccs)
    {
        this.fccs = fccs;
    }

    public String getFccs()
    {
        return fccs;
    }
    public void setFwcb(String fwcb)
    {
        this.fwcb = fwcb;
    }

    public String getFwcb()
    {
        return fwcb;
    }
    
    
    
    public double getJzmj() {
		return jzmj;
	}

	public void setJzmj(double jzmj) {
		this.jzmj = jzmj;
	}

	public double getFwjs() {
		return fwjs;
	}

	public void setFwjs(double fwjs) {
		this.fwjs = fwjs;
	}

	public int getFwtms() {
		return fwtms;
	}

	public void setFwtms(int fwtms) {
		this.fwtms = fwtms;
	}

	public List<TBxwFcFwZhk> gettBxwFcFwZhks() {
		return tBxwFcFwZhks;
	}

	public void settBxwFcFwZhks(List<TBxwFcFwZhk> tBxwFcFwZhks) {
		this.tBxwFcFwZhks = tBxwFcFwZhks;
	}

	public void setZxbz(String zxbz)
    {
        this.zxbz = zxbz;
    }

    public String getZxbz()
    {
        return zxbz;
    }
    public void setBz(String bz)
    {
        this.bz = bz;
    }

    public String getBz()
    {
        return bz;
    }
    public void setKz1(String kz1)
    {
        this.kz1 = kz1;
    }

    public String getKz1()
    {
        return kz1;
    }
    public void setKz2(String kz2)
    {
        this.kz2 = kz2;
    }

    public String getKz2()
    {
        return kz2;
    }
    

    public TBxwPqJdZhk gettBxwPqJdZhk() {
		return tBxwPqJdZhk;
	}

	public void settBxwPqJdZhk(TBxwPqJdZhk tBxwPqJdZhk) {
		this.tBxwPqJdZhk = tBxwPqJdZhk;
	}

	@Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("tBxwPqJdZhkId", gettBxwPqJdZhkId())
            .append("fcbh", getFcbh())
            .append("fcmc", getFcmc())
            .append("fwzl", getFwzl())
            .append("cqr", getCqr())
            .append("cqrsfz", getCqrsfz())
            .append("cqrlxdh", getCqrlxdh())
            .append("jzr", getJzr())
            .append("jzrlxdh", getJzrlxdh())
            .append("fwcqzh", getFwcqzh())
            .append("tdsyzh", getTdsyzh())
            .append("tdsymj", getTdsymj())
            .append("qllx", getQllx())
            .append("qlxz", getQlxz())
            .append("sfwzf", getSfwzf())
            .append("fccs", getFccs())
            .append("fwcb", getFwcb())
            .append("zxbz", getZxbz())
            .append("bz", getBz())
            .append("kz1", getKz1())
            .append("kz2", getKz2())
            .toString();
    }
}

修改房产的xml文件

        因为需要在房产中显示房屋信息,所以在SQL查询时就需要将房屋信息给查询出来,并且房产信息与片区街道有关,所以在搜索阶段一共需要连接四张表,片区表,街道表,房产表,房屋表,而在插入删除修改等阶段只需要三张表,片区表,街道表,房产表,所以为了代码方便,我们写了两个SQL查询语句,利用连表查询来查询需要的信息。

        需要查询的信息:

        总的查询SQL语句:

        具体连表操作:

        xml文件具体代码:

<?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.xyt.project.shggc.jcxx.fc.mapper.TBxwFcZhkMapper">

	<resultMap type="com.xyt.project.shggc.jcxx.fc.domain.TBxwFcZhk" id="TBxwFcZhkResult">
		<result property="id"    column="id"    />
		<result property="tBxwPqJdZhkId"    column="t_bxw_pq_jd_zhk_id"    />
		<result property="fcbh"    column="fcbh"    />
		<result property="fcmc"    column="fcmc"    />
		<result property="fwzl"    column="fwzl"    />
		<result property="cqr"    column="cqr"    />
		<result property="cqrsfz"    column="cqrsfz"    />
		<result property="cqrlxdh"    column="cqrlxdh"    />
		<result property="jzr"    column="jzr"    />
		<result property="jzrlxdh"    column="jzrlxdh"    />
		<result property="fwcqzh"    column="fwcqzh"    />
		<result property="tdsyzh"    column="tdsyzh"    />
		<result property="tdsymj"    column="tdsymj"    />
		<result property="qllx"    column="qllx"    />
		<result property="qlxz"    column="qlxz"    />
		<result property="sfwzf"    column="sfwzf"    />
		<result property="fccs"    column="fccs"    />
		<result property="fwcb"    column="fwcb"    />
		<result property="zxbz"    column="zxbz"    />
		<result property="bz"    column="bz"    />
		<result property="kz1"    column="kz1"    />
		<result property="kz2"    column="kz2"    />
		<association property="tBxwPqJdZhk" javaType="com.xyt.project.shggc.jcxx.jd.domain.TBxwPqJdZhk">
			<id property="id" column="t_bxw_pq_jd_zhk_id"/>
			<result property="pqmc" column="pqmc"/>
			<result property="jdmc" column="jdmc"/>
		</association>
		<collection property="tBxwFcFwZhks" ofType="com.xyt.project.shggc.jcxx.fw.domain.TBxwFcFwZhk">
			<id property="id" column="fwid"/>
			<result property="tBxwFcZhkId" column="t_bxw_fc_zhk_id"/>
			<result property="fwjs" column="fwjs"/>
			<result property="jzmj" column="jzmj"/>
			<result property="zxbz" column="fwzxbz"/>
			<result property="bz" column="fwbz"/>
		</collection>
	</resultMap>

	<sql id="selectTBxwFcZhkVo">
		select fc.id as id, t_bxw_pq_jd_zhk_id,pq.pqmc as pqmc, jd.jdmc as jdmc, fcbh, fcmc, fwzl, cqr, cqrsfz, cqrlxdh, jzr, jzrlxdh, fwcqzh, tdsyzh, tdsymj, qllx, qlxz, sfwzf, fccs, fwcb,
		fc.zxbz as zxbz, fc.bz as bz, fc.kz1 as kz1, fc.kz2 as kz2 
		from t_bxw_fc_zhk fc ,t_bxw_pq_jd_zhk jd , t_bxw_pq_zhk pq 
	</sql>

	<sql id="selectTBxwFcFwZhkVo">
		select id as fwid, t_bxw_fc_zhk_id, fwjs, jzmj, zxbz as fwzxbz, bz as fwbz from t_bxw_fc_fw_zhk
	</sql>
	
	<select id="selectTBxwFcZhkList" parameterType="com.xyt.project.shggc.jcxx.fc.domain.TBxwFcZhk" resultMap="TBxwFcZhkResult">
		select a.*, b.* from (
		<include refid="selectTBxwFcZhkVo"/>
		<where>
			t_bxw_pq_zhk_id = pq.id and t_bxw_pq_jd_zhk_id = jd.id and pq.zxbz = '0' and jd.zxbz = '0'
			<if test="tBxwPqJdZhkId != null  and tBxwPqJdZhkId != ''"> and t_bxw_pq_jd_zhk_id = #{tBxwPqJdZhkId}</if>
			<if test="fcbh != null  and fcbh != ''"> and fcbh = #{fcbh}</if>
			<if test="fcmc != null  and fcmc != ''"> and fcmc like concat(concat('%', #{fcmc}), '%')</if>
			<if test="cqr != null  and cqr != ''"> and cqr like concat(concat('%', #{cqr}), '%')</if>
			<if test="cqrsfz != null  and cqrsfz != ''"> and cqrsfz = #{cqrsfz}</if>
			<if test="jzr != null  and jzr != ''"> and jzr like concat(concat('%', #{jzr}), '%')</if>
			<if test="fwcqzh != null  and fwcqzh != ''"> and fwcqzh = #{fwcqzh}</if>
			<if test="zxbz != null  and zxbz != ''"> and zxbz = #{zxbz}</if>
			<if test="bz != null  and bz != ''"> and bz = #{bz}</if>
		</where>
		) a left join (
		<include refid="selectTBxwFcFwZhkVo"/>
		) b on id=t_bxw_fc_zhk_id		
	</select>

	<select id="selectTBxwFcZhkById" parameterType="java.lang.String" resultMap="TBxwFcZhkResult">
		select a.*, b.* from (
		<include refid="selectTBxwFcZhkVo"/>
		<where>
		t_bxw_pq_zhk_id = pq.id and t_bxw_pq_jd_zhk_id = jd.id and fc.id = #{id}
		</where> 
		) a left join (
		<include refid="selectTBxwFcFwZhkVo"/>
		) b on id=t_bxw_fc_zhk_id		
	</select>

	<select id="generateFcbh" resultType="java.lang.Integer">
		SELECT seq_fcbh_zhk.NEXTVAL as fcbh FROM DUAL
	</select>
	
	<select id="selectTBxwFcZhkByJdId" parameterType="java.lang.String" resultMap="TBxwFcZhkResult">
		select * from t_bxw_fc_zhk where t_bxw_pq_jd_zhk_id=#{tBxwPqJdZhkId}	
	</select>
	
	<insert id="insertTBxwFcZhk" parameterType="com.xyt.project.shggc.jcxx.fc.domain.TBxwFcZhk">
		<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
			SELECT seq_t_bxw_fc_zhk.NEXTVAL as id FROM DUAL
		</selectKey> 
		insert into t_bxw_fc_zhk
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">id,</if>
			<if test="tBxwPqJdZhk != null and tBxwPqJdZhk != ''">t_bxw_pq_jd_zhk_id,</if>
			<if test="fcbh != null and fcbh != ''">fcbh,</if>
			<if test="fcmc != null and fcmc != ''">fcmc,</if>
			<if test="fwzl != null">fwzl,</if>
			<if test="cqr != null">cqr,</if>
			<if test="cqrsfz != null">cqrsfz,</if>
			<if test="cqrlxdh != null">cqrlxdh,</if>
			<if test="jzr != null">jzr,</if>
			<if test="jzrlxdh != null">jzrlxdh,</if>
			<if test="fwcqzh != null">fwcqzh,</if>
			<if test="tdsyzh != null">tdsyzh,</if>
			<if test="tdsymj != null">tdsymj,</if>
			<if test="qllx != null">qllx,</if>
			<if test="qlxz != null">qlxz,</if>
			<if test="sfwzf != null">sfwzf,</if>
			<if test="fccs != null">fccs,</if>
			<if test="fwcb != null">fwcb,</if>
			<if test="zxbz != null and zxbz != ''">zxbz,</if>
			<if test="bz != null">bz,</if>
			<if test="kz1 != null">kz1,</if>
			<if test="kz2 != null">kz2,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">#{id},</if>
			<if test="tBxwPqJdZhk != null and tBxwPqJdZhk != ''">#{tBxwPqJdZhk.id},</if>
			<if test="fcbh != null and fcbh != ''">#{fcbh},</if>
			<if test="fcmc != null and fcmc != ''">#{fcmc},</if>
			<if test="fwzl != null">#{fwzl},</if>
			<if test="cqr != null">#{cqr},</if>
			<if test="cqrsfz != null">#{cqrsfz},</if>
			<if test="cqrlxdh != null">#{cqrlxdh},</if>
			<if test="jzr != null">#{jzr},</if>
			<if test="jzrlxdh != null">#{jzrlxdh},</if>
			<if test="fwcqzh != null">#{fwcqzh},</if>
			<if test="tdsyzh != null">#{tdsyzh},</if>
			<if test="tdsymj != null">#{tdsymj},</if>
			<if test="qllx != null">#{qllx},</if>
			<if test="qlxz != null">#{qlxz},</if>
			<if test="sfwzf != null">#{sfwzf},</if>
			<if test="fccs != null">#{fccs},</if>
			<if test="fwcb != null">#{fwcb},</if>
			<if test="zxbz != null and zxbz != ''">#{zxbz},</if>
			<if test="bz != null">#{bz},</if>
			<if test="kz1 != null">#{kz1},</if>
			<if test="kz2 != null">#{kz2},</if>
		</trim>
	</insert>

	<update id="updateTBxwFcZhk" parameterType="com.xyt.project.shggc.jcxx.fc.domain.TBxwFcZhk">
		update t_bxw_fc_zhk
		<trim prefix="SET" suffixOverrides=",">
			<if test="tBxwPqJdZhkId != null and tBxwPqJdZhkId != ''">t_bxw_pq_jd_zhk_id = #{tBxwPqJdZhkId},</if>
			<if test="fcbh != null and fcbh != ''">fcbh = #{fcbh},</if>
			<if test="fcmc != null and fcmc != ''">fcmc = #{fcmc},</if>
			<if test="fwzl != null">fwzl = #{fwzl},</if>
			<if test="cqr != null">cqr = #{cqr},</if>
			<if test="cqrsfz != null">cqrsfz = #{cqrsfz},</if>
			<if test="cqrlxdh != null">cqrlxdh = #{cqrlxdh},</if>
			<if test="jzr != null">jzr = #{jzr},</if>
			<if test="jzrlxdh != null">jzrlxdh = #{jzrlxdh},</if>
			<if test="fwcqzh != null">fwcqzh = #{fwcqzh},</if>
			<if test="tdsyzh != null">tdsyzh = #{tdsyzh},</if>
			<if test="tdsymj != null">tdsymj = #{tdsymj},</if>
			<if test="qllx != null">qllx = #{qllx},</if>
			<if test="qlxz != null">qlxz = #{qlxz},</if>
			<if test="sfwzf != null">sfwzf = #{sfwzf},</if>
			<if test="fccs != null">fccs = #{fccs},</if>
			<if test="fwcb != null">fwcb = #{fwcb},</if>
			<if test="zxbz != null and zxbz != ''">zxbz = #{zxbz},</if>
			<if test="bz != null">bz = #{bz},</if>
			<if test="kz1 != null">kz1 = #{kz1},</if>
			<if test="kz2 != null">kz2 = #{kz2},</if>
		</trim>
		where id = #{id}
	</update>

	<delete id="deleteTBxwFcZhkById" parameterType="com.xyt.project.shggc.jcxx.fc.domain.TBxwFcZhk">
        delete from t_bxw_fc_zhk where id = #{id}
    </delete>

	<delete id="deleteTBxwFcZhkByIds" parameterType="java.lang.String">
		delete from t_bxw_fc_zhk where id in
		<foreach item="id" collection="array" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>
</mapper>

3.房屋列表显示

3.1实现思路

  1. 查询出房产的房屋信息,回显在房产的edit功能中
  2. 修改房产后,将界面下的全部房屋信息进行存储(无论是否修改)
  3. 将该房产原有的房屋信息全部删除
  4. 依次添加存储的房屋信息

3.2修改房产的edit.html

        完整代码

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改房产')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fc-edit" th:object="${tBxwFcZhk}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
              <label class="col-sm-3 control-label is-required">街道:</label>
	                <div class="col-sm-8">
	                      <select id="tBxwPqJdZhk" name="tBxwPqJdZhkId" class="form-control select2-single required" single>
	                      	  <option th:value="*{tBxwPqJdZhk.id}" th:text="*{tBxwPqJdZhk.jdmc}" ></option>
							  <option th:each="jd:${jds}" th:value="${jd.id}" th:text="${jd.jdmc}" ></option>
						  </select>
	                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">房产编号:</label>
                <div class="col-sm-8">
                    <input name="fcbh" th:field="*{fcbh}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">房产名称:</label>
                <div class="col-sm-8">
                    <input name="fcmc" th:field="*{fcmc}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋坐落:</label>
                <div class="col-sm-8">
                    <input name="fwzl" th:field="*{fwzl}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人:</label>
                <div class="col-sm-8">
                    <input name="cqr" th:field="*{cqr}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人身份证:</label>
                <div class="col-sm-8">
                    <input name="cqrsfz" th:field="*{cqrsfz}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人联系电话:</label>
                <div class="col-sm-8">
                    <input name="cqrlxdh" th:field="*{cqrlxdh}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">居住人:</label>
                <div class="col-sm-8">
                    <input name="jzr" th:field="*{jzr}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">居住人联系电话:</label>
                <div class="col-sm-8">
                    <input name="jzrlxdh" th:field="*{jzrlxdh}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋产权证号:</label>
                <div class="col-sm-8">
                    <input name="fwcqzh" th:field="*{fwcqzh}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">土地使用证号:</label>
                <div class="col-sm-8">
                    <input name="tdsyzh" th:field="*{tdsyzh}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">土地使用面积:</label>
                <div class="col-sm-8">
                    <input name="tdsymj" th:field="*{tdsymj}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权利类型:</label>
                <div class="col-sm-8">
                    <select name="qllx" class="form-control m-b" th:with="type=${@dict.getType('t_jc_qllx')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qllx}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权利性质:</label>
                <div class="col-sm-8">
                    <select name="qlxz" class="form-control m-b" th:with="type=${@dict.getType('t_jc_qlxz')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qlxz}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否无证房:</label>
                <div class="col-sm-8">
                    <select name="sfwzf" class="form-control m-b" th:with="type=${@dict.getType('t_jc_sfwzf')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sfwzf}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋出售:</label>
                <div class="col-sm-8">
                    <select name="fccs" class="form-control m-b" th:with="type=${@dict.getType('t_jc_fccs')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fccs}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋产别:</label>
                <div class="col-sm-8">
                    <select name="fwcb" class="form-control m-b" th:with="type=${@dict.getType('t_jc_fwcb')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fwcb}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">注销标志:</label>
                <div class="col-sm-8">
                    <select name="zxbz" class="form-control m-b" th:with="type=${@dict.getType('t_jc_zxztlx')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{zxbz}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注:</label>
                <div class="col-sm-8">
                    <input name="bz" th:field="*{bz}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">扩展1:</label>
                <div class="col-sm-8">
                    <input name="kz1" th:field="*{kz1}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">扩展2:</label>
                <div class="col-sm-8">
                    <input name="kz2" th:field="*{kz2}" class="form-control" type="text">
                </div>
            </div>
      
     	<div class="row">
                <div class="col-sm-12">
           			<h4 class="form-header h4">房屋信息</h4>
                    <button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table" style="table-layout:fixed;word-break:break-all;"></table>
                    </div>
                </div>
            </div>
              </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "jcxx/fc";
        var zxztDatas = [[${@dict.getType('t_jc_zxzt')}]];
        $("#form-fc-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-fc-edit').serialize());
            }
        }
        
        
        $(function() {
            var options = {
            	data: [[${tBxwFcZhk.tBxwFcFwZhks}]],
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true,
                    width: '10%'
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序",
                    formatter: function (value, row, index) {     
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    },
                    width: '8%'
                },
                {
                    field: 'fwjs',
                    align: 'center',
                    title: '房屋间数',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].fwjs' value='%s'>", index, value);
                        return html;
                    },
                    width: '30%'
                },
                {
                    field: 'jzmj',
                    align: 'center',
                    title: '建筑面积',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].jzmj' value='%s'>", index, value);
                        return html;
                    },
                    width: '40%'
                },
                {
                    field: 'zxbz',
                    align: 'center',
                    title: '注销标志',
                    formatter: function(value, row, index) {
                        var name = $.common.sprintf("tBxwFcFwZhks[%s].zxbz", index);
                        return $.common.dictToSelect(zxztDatas, value, name);
                    },               
                    width: '20%'
                },
                {
                    field: 'bz',
                    align: 'center',
                    title: '备注',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].bz' value='%s'>", index, value);
                        return html;
                    },
                    width: '30%'
                }]
            };
            $.table.init(options);
        });
        
        function addColumn() {
            var count = $("#" + table.options.id).bootstrapTable('getData').length + 1;  
            sub.editColumn();
            $("#" + table.options.id).bootstrapTable('insertRow', {
                index: count,
                row: {
                	index: $.table.serialNumber(count),
                    fwjs: "0",
                    jzmj: "0",
                    zxbz: "0",
                    bz: ""
                }
            });
        }
    </script>
</body>
</html>

3.3修改房产的serviceImp

        updateTbxwFcZhk函数

  /**
     * 修改房产
     *
     * @param tBxwFcZhk 房产
     * @return 结果
     */
    @Override
    public int updateTBxwFcZhk(TBxwFcZhk tBxwFcZhk)
    {
    	/先读取修改后的所有的fw,存进fws中
    	List <TBxwFcFwZhk> fws = tBxwFcZhk.gettBxwFcFwZhks();
    	修改房产信息成功的话,fcNum=1,修改失败=0
    	int fcNum  = tBxwFcZhkMapper.updateTBxwFcZhk(tBxwFcZhk);
    	///删除该房产下的全部房屋
        tBxwFcFwZhkMapper.deleteTBxwFcFwZhkByFcId(tBxwFcZhk.getId()); 
        如果修改之后没有传房屋信息,直接返回fcNum
        if(fws == null)return fcNum;
        如果有房屋,遍历进行插入房屋到房产中
    	for(TBxwFcFwZhk fw : fws ) {
    		///设置房产id
    		fw.settBxwFcZhkId(tBxwFcZhk.getId());
    		//插入一个房屋,fwNum+1,不过在该功能中fwNum无关紧要,只要执行插入操作即可
    		int fwNum =tBxwFcFwZhkMapper.insertTBxwFcFwZhk(fw);
    		fcNum += fwNum;
    	}
    	///返回fcNum,如果fcNum=0,说明修改失败,fcNum>0,说明修改成功,在该代码中,有没有fcNum影响不大,直接return 1 也不影响
        return fcNum;
    }

3.4修改房屋的mapper

        mapper.Java 添加按房产id删除全部房屋的方法 deleteTBxwFcFwZhkByFcId()

        mapper.xml 具体实现该方法

	<delete id="deleteTBxwFcFwZhkByFcId" parameterType="com.xyt.project.shggc.jcxx.fw.domain.TBxwFcFwZhk">
        delete from t_bxw_fc_fw_zhk where t_bxw_fc_zhk_id = #{tBxwFcZhkId}
    </delete>

3.5功能实现

4.房屋添加,房屋修改

3.1修改房产的add.html

        完整代码

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增房产')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fc-add">
            <div class="form-group">    
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required" >街道:</label>
                <div class="col-sm-8">
                      <select id="jd" name="tBxwPqJdZhk.id" class="form-control select2-single" single>
                   		  <option th:value="-1" th:text="请选择街道"></option>
						  <option th:each="jd:${jds}" th:value="${jd.id}" th:text="${jd.jdmc}" ></option>
					  </select>
                </div>
            </div>
            
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">房产编号:</label>
                <div class="col-sm-8">
                    <input name="fcbh" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">房产名称:</label>
                <div class="col-sm-8">
                    <input name="fcmc" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋坐落:</label>
                <div class="col-sm-8">
                    <input name="fwzl" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人:</label>
                <div class="col-sm-8">
                    <input name="cqr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人身份证:</label>
                <div class="col-sm-8">
                    <input name="cqrsfz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">产权人联系电话:</label>
                <div class="col-sm-8">
                    <input name="cqrlxdh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">居住人:</label>
                <div class="col-sm-8">
                    <input name="jzr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">居住人联系电话:</label>
                <div class="col-sm-8">
                    <input name="jzrlxdh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋产权证号:</label>
                <div class="col-sm-8">
                    <input name="fwcqzh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">土地使用证号:</label>
                <div class="col-sm-8">
                    <input name="tdsyzh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">土地使用面积:</label>
                <div class="col-sm-8">
                    <input name="tdsymj" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权利类型:</label>
                <div class="col-sm-8">
                    <select name="qllx" class="form-control m-b" th:with="type=${@dict.getType('t_jc_qllx')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">权利性质:</label>
                <div class="col-sm-8">
                    <select name="qlxz" class="form-control m-b" th:with="type=${@dict.getType('t_jc_qlxz')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否无证房:</label>
                <div class="col-sm-8">
                    <select name="sfwzf" class="form-control m-b" th:with="type=${@dict.getType('t_jc_sfwzf')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋出售:</label>
                <div class="col-sm-8">
                    <select name="fccs" class="form-control m-b" th:with="type=${@dict.getType('t_jc_fccs')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">房屋产别:</label>
                <div class="col-sm-8">
                    <select name="fwcb" class="form-control m-b" th:with="type=${@dict.getType('t_jc_fwcb')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">注销标志:</label>
                <div class="col-sm-8">
                    <select name="zxbz" class="form-control m-b" th:with="type=${@dict.getType('t_jc_zxztlx')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注:</label>
                <div class="col-sm-8">
                    <input name="bz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">扩展1:</label>
                <div class="col-sm-8">
                    <input name="kz1" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">扩展2:</label>
                <div class="col-sm-8">
                    <input name="kz2" class="form-control" type="text">
                </div>
            </div>

    	<div class="row">
				<div class="col-sm-12">
					<h4 class="form-header h4">房屋信息</h4>
					<button type="button" class="btn btn-white btn-sm"
						onclick="addColumn()">
						<i class="fa fa-plus"> 增加</i>
					</button>
					<button type="button" class="btn btn-white btn-sm"
						onclick="sub.delColumn()">
						<i class="fa fa-minus"> 删除</i>
					</button>
					<div class="col-sm-12 select-table table-striped">
						<table id="bootstrap-table"
							style="table-layout: fixed; word-break: break-all;"></table>
					</div>
				</div>
			</div>
		</form>
	</div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "jcxx/fc"
        var zxztDatas = [[${@dict.getType('t_jc_zxzt')}]];
        $("#form-fc-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {

                $.operate.save(prefix + "/add", $('#form-fc-add').serialize());
            }
        }
        
        $(function() {
            var options = {
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true,
                    width: '10%'
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序",
                    formatter: function (value, row, index) {     
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    },
                    width: '8%'
                },
                {
                    field: 'fwjs',
                    align: 'center',
                    title: '房屋间数',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].fwjs' value='%s' required>", index, value);
                        return html;
                    },
                    width: '30%'
                },
                {
                    field: 'jzmj',
                    align: 'center',
                    title: '建筑面积',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].jzmj' value='%s' required>", index, value);
                        return html;
                    },
                    width: '40%'
                },
                {
                    field: 'zxbz',
                    align: 'center',
                    title: '注销标志',
                    formatter: function(value, row, index) {
                        var name = $.common.sprintf("tBxwFcFwZhks[%s].zxbz", index);
                        return $.common.dictToSelect(zxztDatas, value, name);
                    },               
                    width: '20%'
                },
                {
                    field: 'bz',
                    align: 'center',
                    title: '备注',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='tBxwFcFwZhks[%s].bz' value='%s'>", index, value);
                        return html;
                    },
                    width: '30%'
                }]
            };
            $.table.init(options);
        });
        
        
        function addColumn() {
            var count = $("#" + table.options.id).bootstrapTable('getData').length + 1;  
            sub.editColumn();
            $("#" + table.options.id).bootstrapTable('insertRow', {
                index: count,
                row: {
                	index: $.table.serialNumber(count),
                    fwjs: "0",
                    jzmj: "0",
                    zxbz: "0",
                    bz: ""
                }
            });
        }
       
    </script>
</body>
</html>

3.2修改房产的serviceImp

         insertTbxwFcZhk函数 插入房屋,房产信息


    /**
     * 新增房产
     *
     * @param tBxwFcZhk 房产
     * @return 结果
     */
    @Override
    public int insertTBxwFcZhk(TBxwFcZhk tBxwFcZhk)
    {


    	List <TBxwFcFwZhk> fws = tBxwFcZhk.gettBxwFcFwZhks();
    	/插入房产信息
    	int fcNum = tBxwFcZhkMapper.insertTBxwFcZhk(tBxwFcZhk);  
    	if(fws == null)return fcNum;
    	for(TBxwFcFwZhk fw:fws ) {
    		fw.settBxwFcZhkId(tBxwFcZhk.getId());
    	/插入房屋信息
    		int fwNum =tBxwFcFwZhkMapper.insertTBxwFcFwZhk(fw);
    		fcNum += fwNum;
    	}
        return fcNum;
    }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2041852.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

ES主分片和副本分片

在 Elasticsearch 中&#xff0c;主分片的数量在创建索引时设置&#xff0c;并且不能在索引创建后更改。主分片的数量因索引而异&#xff0c;对于每个索引&#xff0c;可以根据实际需要进行调整。 主分片数量的设置 默认值&#xff1a; 在 Elasticsearch 中&#xff0c;默认的主…

C++入门基础(太干了,别噎住)

1.C了解&#xff08;可跳过&#xff09; 1.1 C发展历史 C的起源可以追溯到1979年&#xff0c;当时Bjarne Stroustrup(本贾尼斯特劳斯特卢普&#xff0c;这个翻译的名字不同的地方可能有差异)在贝尔实验室从事计算机科学和软件工程的研究工作。面对项目中复杂的软件开发任务&am…

maven配置aspose镜像

问题 安装aspose一直失败&#xff0c;原因是aspose文件不在公共仓库中 <dependency><groupId>com.aspose</groupId><artifactId>aspose-pdf</artifactId><version>21.11</version> </dependency>配置文件如下 <mirror&g…

苍穹外卖-知识点

搭建环境 前端 使用nginx&#xff08;文件路径带中文 会启动不成功&#xff09; 后端

有哪些文档翻译在线免费工具?安利5款文档翻译利器给你

想要翻译文档但却不知道该用什么工具好&#xff1f;这其实是不少学生党和打工人共同的烦恼~ 实际上你既可以借助支持全文翻译的文档翻译工具来获取译文&#xff0c;也可以利用自带划词翻译功能的文档翻译工具来操作。借此机会便给安排上了两种不同翻译类型的文档翻译工具&…

谐波抑制方法分析

一、谐波抑制概述 抑制谐波方法可分为两大类&#xff1a;一是主动型&#xff0c;即从装置本身出发&#xff0c;使其不产生谐波或者降低谐波的产生&#xff1b;被动型&#xff0c;即外加滤波器&#xff0c;吸收或者抵消谐波产生设备注入电网的谐波&#xff0c;比如在电网和设备的…

干货分享|如何使用Stable Diffusion打造会说话的数字人?

数字人已不是什么新鲜名词了。在许多领域&#xff0c;尤其是媒体和娱乐领域&#xff0c;经常可以看到卡通形象的人物或逼真的虚拟主持人。在Stable Diffusion中&#xff0c;我们可以上传一段录制好的音频文件&#xff0c;然后使用SadTalker插件&#xff0c;将音频和图片相结合&…

怎么用打印功能导出为文件为pdf格式

概述 有时候我们再打印的时候需要把文件打印出来的同时&#xff0c;但又想下载下来该文件为pdf格式&#xff01;该怎么办接下来我来教大家解决办法&#xff01; 方法一 安装WPS PDF虚拟打印机&#xff1a;‌首先&#xff0c;‌从可靠的来源下载WPS PDF虚拟打印机的安装包。‌这…

HAProxy负载均衡详细解释

目录 1、HAProxy的负载均衡 1.1socat工具的使用 1.1.1对于单进程 1.1.2对于多进程处理方法(对haproxy做热处理) 2、Haproxy的算法 2.1静态算法 <1>static-rr <2>first 2.2动态算法 <1>roundrobin <2>leastconn <3>random 2.3其他算…

基于SSM的考试管理系统---附源码16535

目录 摘要 Abstract 1 绪论 1.1课题目的及意义 1.2研究背景 1.3研究方法 1.4论文结构与章节安排 2 考试管理系统的设计与实现系统分析 2.1 可行性分析 2.2 系统功能分析 2.3 系统用例分析 2.4本章小结 3 考试管理系统的设计与实现总体设计 3.1 系统架构设计 3.2 …

C语言:基于单链表实现通讯录项目

前言 之前我们用顺序表实现了通讯录&#xff0c;这次我们使用单链表实现。我们定义五个文件&#xff0c; SingleLinkedList.h SingleLinkedList.c Contact.h Contact.c test.c SingleLinkedList.h 是包含了单链表的结构&#xff0c;及各类库文件声明&#xff0c;各个单链表接…

优思学院|六西格玛绿带重不重要?绿带的报考条件是什么?

在最原始的六西格玛管理之中&#xff0c;六西格玛的最主要角色就只有六西格玛黑带&#xff0c;这是Mikel Harry所命名的&#xff0c;意思是一个对六西格玛方法十分熟练的人。 然而&#xff0c;六西格玛黑带也要靠团队才能完成工作&#xff0c;如果团队中只有黑带了解六西格玛流…

AcWing算法提高课笔记——数字三角形

本文给出了几道数字三角形模型的题解。 数字三角形模型通常给定一个矩阵&#xff0c;从矩阵的左上角走到右下角&#xff0c;每次只能向右走或者向下走&#xff0c;求最大值或者最小值。 这种问题可以用f[i, j]来表示从[1, 1]走到[i, j]处的Max\Min&#xff0c;有状态转移方程…

minikube 实践练习4 - 滚动更新

1. 应用版本更新 #查看image kubectl describe pods#设置应用的image为新版本 v1 -> v2 kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcampdocker.io/jocatalin/kubernetes-bootcamp:v2#验证更新结果 export NODE_PORT"$(kubectl get services/…

在Moodle中集成ONLYOFFICE:学习管理+文档功能全面指南

一、引言 随着在线教育的发展&#xff0c;Moodle作为领先的开源学习管理系统&#xff0c;其灵活性和可扩展性为教育工作者提供了丰富的功能。而ONLYOFFICE文档服务器的加入&#xff0c;更是为Moodle用户带来了无缝的文档处理与协作体验。本文将详细指导您如何在Moodle中深度集成…

【数据结构】二叉树篇

文章目录 1.二叉树链式结构功能的实现1.1 前置说明1.2 二叉树的遍历1.2.1 前序、中序以及后序遍历1.2.2 层序遍历 1.3 节点个数以及高度差1.3.1 二叉树的节点个数1.3.2 二叉树叶子节点个数1.3.3 二叉树第K层节点个数1.3.4 二叉树树查找值为x的节点1.3.5 二叉树的销毁 1.4 代码整…

RAG 工具和框架介绍: Haystack、 LangChain 和 LlamaIndex

Haystack、 LangChain 和 LlamaIndex&#xff0c;以及这些工具是如何让我们轻松地构建 RAG 应用程序的&#xff1f; 我们将重点关注以下内容&#xff1a; HaystackLangChainLlamaIndex 增强LLM 那么&#xff0c;为什么会有这些工具存在呢&#xff1f;如你所知&#xff0c;C…

LVS学习与练习

LVS (Linux Virtual Server) 是一种高性能的负载均衡解决方案&#xff0c;它基于 Linux 内核实现。LVS 可以用来构建高可用性和高性能的 Web 服务器集群。LVS 支持多种负载均衡算法和模式&#xff0c;可以有效地分发网络请求到多台后端服务器上。 LVS 的主要组成部分 1. Direc…

InternLM+LlamaIndex RAG 实践

本期实战训练营介绍了使用书生葡语的InternLM和LlamaIndex框架进行RAG项目的实践。内容分为三个部分&#xff1a;回顾InternLM的发展历程&#xff0c;介绍RAG的基本概念和应用&#xff0c;以及实践一个RAG项目。RAG技术结合了检索与生成&#xff0c;通过外部知识库增强大模型的…

开源Docker图形化管理工具DockerUI

DockerUI 是一个 Web 用户界面&#xff0c;它允许用户通过浏览器与 Docker 守护进程进行交互&#xff0c;而无需在命令行中执行 Docker 命令。它为 Docker 容器、镜像、网络等提供了直观的图形界面管理。然而&#xff0c;需要注意的是&#xff0c;DockerUI 已经不再是最流行的 …