src/main/java/org/springblade/modules/house/controller/HouseholdController.java
@@ -137,7 +137,7 @@ */ @PostMapping("/saveOrUpdateHousehold") @ApiOperation(value = "自定义新增或修改", notes = "传入household") public R saveOrUpdateHousehold(@Valid @RequestBody HouseholdEntity household) { public R saveOrUpdateHousehold(@Valid @RequestBody HouseholdVO household) { return R.status(householdService.saveOrUpdateHousehold(household)); } src/main/java/org/springblade/modules/house/entity/HouseholdEntity.java
@@ -1,19 +1,3 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.house.entity; import com.baomidou.mybatisplus.annotation.*; @@ -114,6 +98,16 @@ @ApiModelProperty(value = "身份证") private String idCard; /** * 证件类型,业务字典 cardType */ @ApiModelProperty(value = "证件类型,业务字典 cardType") private Integer cardType; /** * 证件号码 */ @ApiModelProperty(value = "证件号码") private String cardNo; /** * 港澳台通行证 */ @ApiModelProperty(value = "港澳台通行证") @@ -134,20 +128,92 @@ @ApiModelProperty(value = "学历") private Integer education; /** * 户籍类型 业务字典:residentType */ @ApiModelProperty(value = "户籍类型 业务字典:residentType") private Integer residentType; /** * 户籍地址 */ @ApiModelProperty(value = "户籍地址") private String residentAddr; /** * 户籍登记地 */ @ApiModelProperty(value = "户籍登记地") private String hukouRegistration; /** * 户籍地址编码 */ @ApiModelProperty(value = "户籍地址编码") private String residentAddrNo; /** * 户籍地行政区划 */ @ApiModelProperty(value = "户籍地行政区划") private String residentAdcode; /** * 籍贯地行政区划 */ @ApiModelProperty(value = "籍贯地行政区划") private String nativePlaceAdcode; /** * 宗教信仰 */ @ApiModelProperty(value = "宗教信仰") private String religiousBelief; /** * 健康状况 业务字典 healthStatus */ @ApiModelProperty(value = "健康状况 业务字典 healthStatus") private Integer healthStatus; /** * 疾病名称 */ @ApiModelProperty(value = "疾病名称") private String diseaseName; /** * 工作状态 */ @ApiModelProperty(value = "工作状态") private Integer workStatus; /** * 工作单位 * 工作单位(就职单位) */ @ApiModelProperty(value = "工作单位") @ApiModelProperty(value = "工作单位(就职单位)") private String employer; /** * 职业类别 */ @ApiModelProperty(value = "职业类别") private String occupation; /** * 就职单位地址 */ @ApiModelProperty(value = "就职单位地址") private String cmpyRegAddr; /** * 外出详址 */ @ApiModelProperty(value = "外出详址") private String goOutAddr; /** * 外出去向 */ @ApiModelProperty(value = "外出去向") private String goOutWhere; /** * 外出时间 */ @ApiModelProperty(value = "外出时间") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") private Date goOutTime; /** * 外出原因 */ @ApiModelProperty(value = "外出原因") private String goOutReason; /** * 婚姻状态 */ @@ -231,6 +297,9 @@ @ApiModelProperty("是否审核 0:否:1 是") private Integer confirmFlag; /** * 出租屋id */ @ApiModelProperty("出租屋id") private Long housingRentalId; src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -85,6 +85,7 @@ <collection property="householdLabelList" javaType="java.util.List" ofType="org.springblade.modules.house.vo.HouseholdLabelVO" autoMapping="true"> <id property="id" column="cid"/> <id property="houseCode" column="houseCodes"/> <result property="remark" column="cremark"/> </collection> </resultMap> @@ -223,7 +224,15 @@ <select id="getHouseholdListByCode" resultMap="householdAndLabelMap" > select jh.*, jhl.id as cid,jhl.*,jhl.remark as cremark jhl.id as cid, jhl.house_code houseCodes, jhl.label_id, jhl.label_name, jhl.color, jhl.user_id, jhl.lable_type, jhl.household_id, jhl.remark as cremark from jczz_household jh left join jczz_user_house_label jhl on jh.id = jhl.household_id where 1=1 and jh.is_deleted = 0 @@ -234,7 +243,15 @@ <select id="getHouseholdListById" resultMap="householdAndLabelMap" > select jh.*, jhl.id as cid,jhl.*,jhl.remark as cremark jhl.id as cid, jhl.house_code houseCodes, jhl.label_id, jhl.label_name, jhl.color, jhl.user_id, jhl.lable_type, jhl.household_id, jhl.remark as cremark from jczz_household jh left join jczz_user_house_label jhl on jh.id = jhl.household_id where 1=1 and is_deleted = 0 src/main/java/org/springblade/modules/house/service/IHouseholdService.java
@@ -61,7 +61,7 @@ * @param household * @return */ boolean saveOrUpdateHousehold(HouseholdEntity household); boolean saveOrUpdateHousehold(HouseholdVO household); /** * 住户 自定义查询详情 src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.logging.log4j.util.Strings; import org.springblade.common.node.TreeStringNode; import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.utils.AuthUtil; @@ -28,6 +29,8 @@ import org.springblade.modules.house.excel.HouseHoldExcel; import org.springblade.modules.house.mapper.HouseholdMapper; import org.springblade.modules.house.service.IHouseholdService; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.vo.HouseholdOtherVO; import org.springblade.modules.house.vo.HouseholdVO; import org.springblade.modules.system.entity.Dept; @@ -53,7 +56,7 @@ public class HouseholdServiceImpl extends ServiceImpl<HouseholdMapper, HouseholdEntity> implements IHouseholdService { @Autowired private IGridService gridService; private IUserHouseLabelService userHouseLabelService; @Autowired private IDictBizService dictBizService; @@ -143,15 +146,8 @@ * @return */ @Override public boolean saveOrUpdateHousehold(HouseholdEntity household) { // 判断添加人是否房屋业主 // Long count = count(Wrappers.<HouseholdEntity>lambdaQuery() // .eq(HouseholdEntity::getHouseCode, household.getHouseCode()) // .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId()) // .eq(HouseholdEntity::getRelationship, 1)); // if (count == 0) { // return false; // } @Transactional(rollbackFor = Exception.class) public boolean saveOrUpdateHousehold(HouseholdVO household) { boolean flag = false; household.setUpdateTime(new Date()); household.setUpdateUser(AuthUtil.getUserId()); @@ -160,6 +156,8 @@ flag = updateById(household); // 更新用户信息 updateUserInfo(household); // 更新标签信息 updateUserLabelInfo(household); } else { // 新增 household.setCreateTime(new Date()); @@ -167,11 +165,31 @@ flag = save(household); // 更新用户信息 updateUserInfo(household); // 更新标签信息 updateUserLabelInfo(household); } return flag; } /** * 更新用户标签信息 * @param household */ public void updateUserLabelInfo(HouseholdVO household) { if (household.getHouseholdLabelList().size()>0){ List<HouseholdLabelVO> householdLabelList = household.getHouseholdLabelList(); for (HouseholdLabelVO householdLabelVO : householdLabelList) { if (!Strings.isBlank(household.getHouseCode())) { householdLabelVO.setHouseCode(household.getHouseCode()); } householdLabelVO.setHouseholdId(household.getId()); // 先删除对应绑定的信息 userHouseLabelService.saveOrUpdateHouseholdLabel(householdLabelVO); } } } /** * 更新用户信息 * @param household */