src/main/java/org/springblade/modules/house/controller/HouseLabelController.java
New file @@ -0,0 +1,150 @@ /* * 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.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.house.entity.HouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import org.springblade.modules.house.wrapper.HouseLabelWrapper; import org.springblade.modules.house.service.IHouseLabelService; import org.springblade.core.boot.ctrl.BladeController; /** * 房屋-标签 控制器 * * @author BladeX * @since 2023-10-28 */ @RestController @AllArgsConstructor @RequestMapping("blade-houseLabel/houseLabel") @Api(value = "房屋-标签", tags = "房屋-标签接口") public class HouseLabelController extends BladeController { private final IHouseLabelService houseLabelService; /** * 房屋-标签 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入houseLabel") public R<HouseLabelVO> detail(HouseLabelEntity houseLabel) { HouseLabelEntity detail = houseLabelService.getOne(Condition.getQueryWrapper(houseLabel)); return R.data(HouseLabelWrapper.build().entityVO(detail)); } /** * 房屋-标签 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入houseLabel") public R<IPage<HouseLabelVO>> list(HouseLabelEntity houseLabel, Query query) { IPage<HouseLabelEntity> pages = houseLabelService.page(Condition.getPage(query), Condition.getQueryWrapper(houseLabel)); return R.data(HouseLabelWrapper.build().pageVO(pages)); } /** * 房屋-标签 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入houseLabel") public R<IPage<HouseLabelVO>> page(HouseLabelVO houseLabel, Query query) { IPage<HouseLabelVO> pages = houseLabelService.selectHouseLabelPage(Condition.getPage(query), houseLabel); return R.data(pages); } /** * 房屋-标签 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入houseLabel") public R save(@Valid @RequestBody HouseLabelEntity houseLabel) { return R.status(houseLabelService.save(houseLabel)); } /** * 房屋-标签 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入houseLabel") public R update(@Valid @RequestBody HouseLabelEntity houseLabel) { return R.status(houseLabelService.updateById(houseLabel)); } /** * 房屋-标签 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入houseLabel") public R submit(@Valid @RequestBody HouseLabelEntity houseLabel) { return R.status(houseLabelService.saveOrUpdate(houseLabel)); } /** * 房屋-标签 自定义新增或修改 * @param houseLabel * @return */ @PostMapping("/saveOrUpdateHouseLabel") @ApiOperation(value = "自定义新增或修改", notes = "传入houseLabel") public R saveOrUpdateHouseLabel(@Valid @RequestBody HouseLabelEntity houseLabel) { return R.status(houseLabelService.saveOrUpdateHouseLabel(houseLabel)); } /** * 房屋-标签 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(houseLabelService.removeByIds(Func.toLongList(ids))); } /** * 房屋-标签 自定义删除 */ @PostMapping("/removeHouseLabel") @ApiOperationSupport(order = 7) public R removeHouseLabel(@RequestBody HouseLabelEntity houseLabel) { QueryWrapper<HouseLabelEntity> wrapper = new QueryWrapper<>(); wrapper.eq("label_id",houseLabel.getLabelId()) .eq("house_code",houseLabel.getHouseCode()); // 返回 return R.status(houseLabelService.remove(wrapper)); } } src/main/java/org/springblade/modules/house/controller/HouseholdLabelController.java
File was deleted src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java
@@ -26,140 +26,124 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.AesUtil; import org.springblade.core.tool.utils.Func; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import org.springblade.modules.house.wrapper.HouseLabelWrapper; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.wrapper.HouseholdLabelWrapper; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.core.boot.ctrl.BladeController; import java.util.List; /** * 房屋-标签 控制器 * 住户-标签 控制器 * * @author BladeX * @since 2023-10-28 */ @RestController @AllArgsConstructor @RequestMapping("blade-houseLabel/userHouseLabel") @Api(value = "用户房屋-标签", tags = "用户房屋-标签接口") @RequestMapping("blade-householdLabel/householdLabel") @Api(value = "住户-标签", tags = "住户-标签接口") public class UserHouseLabelController extends BladeController { private final IUserHouseLabelService userHouseLabelService; private final IUserHouseLabelService householdLabelService; /** * 房屋-标签 详情 * 住户-标签 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入houseLabel") public R<HouseLabelVO> detail(UserHouseLabelEntity houseLabel) { UserHouseLabelEntity detail = userHouseLabelService.getOne(Condition.getQueryWrapper(houseLabel)); return R.data(HouseLabelWrapper.build().entityVO(detail)); @ApiOperation(value = "详情", notes = "传入householdLabel") public R<HouseholdLabelVO> detail(UserHouseLabelEntity householdLabel) { UserHouseLabelEntity detail = householdLabelService.getOne(Condition.getQueryWrapper(householdLabel)); return R.data(HouseholdLabelWrapper.build().entityVO(detail)); } /** * 房屋-标签 分页 * 住户-标签 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入houseLabel") public R<IPage<HouseLabelVO>> list(UserHouseLabelEntity houseLabel, Query query) { IPage<UserHouseLabelEntity> pages = userHouseLabelService.page(Condition.getPage(query), Condition.getQueryWrapper(houseLabel)); return R.data(HouseLabelWrapper.build().pageVO(pages)); @ApiOperation(value = "分页", notes = "传入householdLabel") public R<IPage<HouseholdLabelVO>> list(UserHouseLabelEntity householdLabel, Query query) { IPage<UserHouseLabelEntity> pages = householdLabelService.page(Condition.getPage(query), Condition.getQueryWrapper(householdLabel)); return R.data(HouseholdLabelWrapper.build().pageVO(pages)); } /** * 房屋-标签 自定义分页 * 住户-标签 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入houseLabel") public R<IPage<HouseLabelVO>> page(HouseLabelVO houseLabel, Query query) { IPage<HouseLabelVO> pages = userHouseLabelService.selectHouseLabelPage(Condition.getPage(query), houseLabel); @ApiOperation(value = "分页", notes = "传入householdLabel") public R<IPage<HouseholdLabelVO>> page(HouseholdLabelVO householdLabel, Query query) { IPage<HouseholdLabelVO> pages = householdLabelService.selectHouseholdLabelPage(Condition.getPage(query), householdLabel); return R.data(pages); } /** * 房屋-标签 自定义分页 */ @GetMapping("/userLabelList") @ApiOperationSupport(order = 3) @ApiOperation(value = "查询用户的标签", notes = "传入houseLabel") public R<List<Integer>> userLabelList() { List<Integer> pages = userHouseLabelService.selectUserLabelList(new UserHouseLabelDTO()); return R.data(pages); } /** * 房屋-标签 新增 * 住户-标签 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入houseLabel") public R save(@Valid @RequestBody UserHouseLabelEntity houseLabel) { return R.status(userHouseLabelService.save(houseLabel)); @ApiOperation(value = "新增", notes = "传入householdLabel") public R save(@Valid @RequestBody UserHouseLabelEntity householdLabel) { return R.status(householdLabelService.save(householdLabel)); } /** * 房屋-标签 修改 * 住户-标签 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入houseLabel") public R update(@Valid @RequestBody UserHouseLabelEntity houseLabel) { return R.status(userHouseLabelService.updateById(houseLabel)); @ApiOperation(value = "修改", notes = "传入householdLabel") public R update(@Valid @RequestBody UserHouseLabelEntity householdLabel) { return R.status(householdLabelService.updateById(householdLabel)); } /** * 房屋-标签 新增或修改 * 住户-标签 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入houseLabel") public R submit(@Valid @RequestBody UserHouseLabelEntity houseLabel) { return R.status(userHouseLabelService.saveOrUpdate(houseLabel)); @ApiOperation(value = "新增或修改", notes = "传入householdLabel") public R submit(@Valid @RequestBody UserHouseLabelEntity householdLabel) { return R.status(householdLabelService.saveOrUpdate(householdLabel)); } /** * 房屋-标签 自定义新增或修改 * @param houseLabel * 住户-标签 自定义新增或修改 * @param householdLabel * @return */ @PostMapping("/saveOrUpdateHouseLabel") @ApiOperation(value = "自定义新增或修改", notes = "传入houseLabel") public R saveOrUpdateHouseLabel(@Valid @RequestBody UserHouseLabelEntity houseLabel) { return R.status(userHouseLabelService.saveOrUpdateHouseLabel(houseLabel)); @PostMapping("/saveOrUpdateHouseholdLabel") @ApiOperation(value = "自定义新增或修改", notes = "传入householdLabel") public R saveOrUpdateHouseholdLabel(@Valid @RequestBody UserHouseLabelEntity householdLabel) { return R.status(householdLabelService.saveOrUpdateHouseholdLabel(householdLabel)); } /** * 房屋-标签 删除 * 住户-标签 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(userHouseLabelService.removeByIds(Func.toLongList(ids))); return R.status(householdLabelService.removeByIds(Func.toLongList(ids))); } /** * 房屋-标签 自定义删除 * 住户-标签 自定义删除 */ @PostMapping("/removeHouseLabel") @ApiOperationSupport(order = 7) public R removeHouseLabel(@RequestBody UserHouseLabelEntity houseLabel) { @PostMapping("/removeHouseholdLabel") public R removeHouseholdLabel(@RequestBody UserHouseLabelEntity householdLabel) { QueryWrapper<UserHouseLabelEntity> wrapper = new QueryWrapper<>(); wrapper.eq("label_id",houseLabel.getLabelId()) .eq("house_code",houseLabel.getHouseCode()); wrapper.eq("household_id",householdLabel.getHouseholdId()) .eq("label_id",householdLabel.getLabelId()); // 返回 return R.status(userHouseLabelService .remove(wrapper)); return R.status(householdLabelService.remove(wrapper)); } src/main/java/org/springblade/modules/house/dto/HouseLabelDTO.java
File was renamed from src/main/java/org/springblade/modules/house/dto/HouseholdLabelDTO.java @@ -16,19 +16,19 @@ */ package org.springblade.modules.house.dto; import org.springblade.modules.house.entity.HouseholdLabelEntity; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.house.entity.HouseLabelEntity; /** * 住户-标签 数据传输对象实体类 * 房屋-标签 数据传输对象实体类 * * @author BladeX * @since 2023-10-28 */ @Data @EqualsAndHashCode(callSuper = true) public class HouseholdLabelDTO extends HouseholdLabelEntity { public class HouseLabelDTO extends HouseLabelEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/house/dto/UserHouseLabelDTO.java
@@ -21,7 +21,7 @@ import lombok.EqualsAndHashCode; /** * 房屋-标签 数据传输对象实体类 * 住户-标签 数据传输对象实体类 * * @author BladeX * @since 2023-10-28 src/main/java/org/springblade/modules/house/entity/HouseLabelEntity.java
File was renamed from src/main/java/org/springblade/modules/house/entity/HouseholdLabelEntity.java @@ -24,21 +24,19 @@ import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; import java.io.Serializable; /** * 住户-标签 实体类 * 房屋-标签 实体类 * * @author BladeX * @since 2023-10-28 */ @Data @TableName("jczz_household_label") @ApiModel(value = "HouseholdLabel对象", description = "住户-标签") public class HouseholdLabelEntity implements Serializable { @TableName("jczz_house_label") @ApiModel(value = "HouseLabel对象", description = "房屋-标签") public class HouseLabelEntity implements Serializable { private static final long serialVersionUID = 1L; /** @@ -50,15 +48,17 @@ private Long id; /** * 住户ID * 门牌地址编码 */ @ApiModelProperty(value = "住户ID") private Long householdId; @ApiModelProperty(value = "门牌地址编码") private String houseCode; /** * 标签ID */ @ApiModelProperty(value = "标签ID") private Integer labelId; /** * 标签名称 */ @@ -74,5 +74,4 @@ */ @ApiModelProperty(value = "备注") private String remark; } src/main/java/org/springblade/modules/house/entity/UserHouseLabelEntity.java
@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -27,18 +29,16 @@ import java.io.Serializable; /** * 房屋-标签对象 jczz_user_house_label * 住户-标签 实体类 * * @author ${context.author} * @date 2023-11-14 09:56:56 * @author BladeX * @since 2023-10-28 */ @ApiModel(value = "UserHouseLabel对象" , description = "房屋-标签") @Data @TableName("jczz_user_house_label") public class UserHouseLabelEntity implements Serializable { @ApiModel(value = "userHouseLabel对象", description = "住户-标签") public class UserHouseLabelEntity implements Serializable { private static final long serialVersionUID = 1L; /** 主键 */ @ApiModelProperty(value = "主键ID", example = "") @@ -79,4 +79,10 @@ @ApiModelProperty(value = "标签类型:1:人:2房屋", example = "") @TableField("lable_type") private Integer lableType; /** 住户id */ @ApiModelProperty(value = "住户id", example = "") @TableField("household_id") private Integer householdId; } src/main/java/org/springblade/modules/house/mapper/HouseLabelMapper.java
File was renamed from src/main/java/org/springblade/modules/house/mapper/HouseholdLabelMapper.java @@ -16,28 +16,28 @@ */ package org.springblade.modules.house.mapper; import org.apache.ibatis.annotations.Param; import org.springblade.common.node.TreeNode; import org.springblade.modules.house.entity.HouseholdLabelEntity; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.entity.HouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 住户-标签 Mapper 接口 * 房屋-标签 Mapper 接口 * * @author BladeX * @since 2023-10-28 */ public interface HouseholdLabelMapper extends BaseMapper<HouseholdLabelEntity> { public interface HouseLabelMapper extends BaseMapper<HouseLabelEntity> { /** * 自定义分页 * * @param page * @param householdLabel * @param houseLabel * @return */ List<HouseholdLabelVO> selectHouseholdLabelPage(IPage page, HouseholdLabelVO householdLabel); List<HouseLabelVO> selectHouseLabelPage(IPage page, HouseLabelVO houseLabel); } src/main/java/org/springblade/modules/house/mapper/HouseLabelMapper.xml
New file @@ -0,0 +1,15 @@ <?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="org.springblade.modules.house.mapper.HouseLabelMapper"> <!-- 通用查询映射结果 --> <resultMap id="houseLabelResultMap" type="org.springblade.modules.house.entity.HouseLabelEntity"> </resultMap> <select id="selectHouseLabelPage" resultMap="houseLabelResultMap"> select * from jczz_house_label where is_deleted = 0 </select> </mapper> src/main/java/org/springblade/modules/house/mapper/HouseholdLabelMapper.xml
File was deleted src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -112,9 +112,9 @@ jh.*, jhl.id as cid,jhl.*,jhl.remark as cremark from jczz_household jh left join jczz_household_label jhl on jh.id = jhl.household_id where 1=1 and is_deleted = 0 and house_code = #{code} left join jczz_user_house_label jhl on jh.id = jhl.household_id where 1=1 and jh.is_deleted = 0 and jh.house_code = #{code} </select> <!--查询房屋集合信息-按id--> @@ -123,7 +123,7 @@ jh.*, jhl.id as cid,jhl.*,jhl.remark as cremark from jczz_household jh left join jczz_household_label jhl on jh.id = jhl.household_id left join jczz_user_house_label jhl on jh.id = jhl.household_id where 1=1 and is_deleted = 0 and jh.id = #{household.id} </select> src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.java
@@ -18,13 +18,13 @@ import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import org.springblade.modules.house.vo.HouseholdLabelVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 房屋-标签 Mapper 接口 * 住户-标签 Mapper 接口 * * @author BladeX * @since 2023-10-28 @@ -35,11 +35,11 @@ * 自定义分页 * * @param page * @param houseLabel * @param householdLabel * @return */ List<HouseLabelVO> selectHouseLabelPage(IPage page, HouseLabelVO houseLabel); List<HouseholdLabelVO> selectHouseLabelPage(IPage page, HouseholdLabelVO householdLabel); List<Integer> getUserLabelList(UserHouseLabelDTO userHouseLabelDTO); List<Integer> getUserLabelList(UserHouseLabelDTO userHouseLabelDTO); } src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml
@@ -2,7 +2,6 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.springblade.modules.house.mapper.UserHouseLabelMapper"> <resultMap type="org.springblade.modules.house.dto.UserHouseLabelDTO" id="UserHouseLabelDTOResult"> <result property="id" column="id" /> <result property="houseCode" column="house_code" /> @@ -29,19 +28,19 @@ </sql> <!-- <select id="selectUserHouseLabelList" parameterType="org.springblade.modules.house.dto.UserHouseLabelDTO" resultMap="UserHouseLabelDTOResult">--> <!-- <include refid="selectUserHouseLabel"/>--> <!-- <where>--> <!-- <if test="id != null "> and id = #{id}</if>--> <!-- <if test="houseCode != null and houseCode != ''"> and house_code = #{houseCode}</if>--> <!-- <if test="labelId != null "> and label_id = #{labelId}</if>--> <!-- <if test="labelName != null and labelName != ''"> and label_name = #{labelName}</if>--> <!-- <if test="color != null and color != ''"> and color = #{color}</if>--> <!-- <if test="remark != null and remark != ''"> and remark = #{remark}</if>--> <!-- <if test="userId != null "> and user_id = #{userId}</if>--> <!-- <if test="lableType != null "> and lable_type = #{lableType}</if>--> <!-- </where>--> <!-- </select>--> <!-- <select id="selectUserHouseLabelList" parameterType="org.springblade.modules.house.dto.UserHouseLabelDTO" resultMap="UserHouseLabelDTOResult">--> <!-- <include refid="selectUserHouseLabel"/>--> <!-- <where>--> <!-- <if test="id != null "> and id = #{id}</if>--> <!-- <if test="houseCode != null and houseCode != ''"> and house_code = #{houseCode}</if>--> <!-- <if test="labelId != null "> and label_id = #{labelId}</if>--> <!-- <if test="labelName != null and labelName != ''"> and label_name = #{labelName}</if>--> <!-- <if test="color != null and color != ''"> and color = #{color}</if>--> <!-- <if test="remark != null and remark != ''"> and remark = #{remark}</if>--> <!-- <if test="userId != null "> and user_id = #{userId}</if>--> <!-- <if test="lableType != null "> and lable_type = #{lableType}</if>--> <!-- </where>--> <!-- </select>--> <select id="selectHouseLabelPage" resultMap="UserHouseLabelDTOResult"> @@ -62,6 +61,13 @@ </where> </select> <!-- <!–自定义分页查询–>--> <!-- <select id="selectHouseholdLabelPage" resultMap="householdLabelResultMap">--> <!-- select * from jczz_household_label where is_deleted = 0--> <!-- </select>--> <select id="getUserLabelList" resultType="java.lang.Integer" parameterType="org.springblade.modules.house.dto.UserHouseLabelDTO"> select label_id src/main/java/org/springblade/modules/house/service/IHouseLabelService.java
File was renamed from src/main/java/org/springblade/modules/house/service/IHouseholdLabelService.java @@ -17,35 +17,32 @@ package org.springblade.modules.house.service; import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.common.node.TreeNode; import org.springblade.modules.house.entity.HouseholdLabelEntity; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.core.mp.base.BaseService; import org.springblade.modules.house.entity.HouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 住户-标签 服务类 * 房屋-标签 服务类 * * @author BladeX * @since 2023-10-28 */ public interface IHouseholdLabelService extends IService<HouseholdLabelEntity> { public interface IHouseLabelService extends IService<HouseLabelEntity> { /** * 自定义分页 * * @param page * @param householdLabel * @param houseLabel * @return */ IPage<HouseholdLabelVO> selectHouseholdLabelPage(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel); IPage<HouseLabelVO> selectHouseLabelPage(IPage<HouseLabelVO> page, HouseLabelVO houseLabel); /** * 住户-标签 自定义新增或修改 * @param householdLabel * 房屋-标签 自定义新增或修改 * @param houseLabel * @return */ boolean saveOrUpdateHouseholdLabel(HouseholdLabelEntity householdLabel); boolean saveOrUpdateHouseLabel(HouseLabelEntity houseLabel); } src/main/java/org/springblade/modules/house/service/IUserHouseLabelService.java
@@ -19,13 +19,13 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import org.springblade.modules.house.vo.HouseholdLabelVO; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 房屋-标签 服务类 * 住户-标签 服务类 * * @author BladeX * @since 2023-10-28 @@ -36,18 +36,18 @@ * 自定义分页 * * @param page * @param houseLabel * @param householdLabel * @return */ IPage<HouseLabelVO> selectHouseLabelPage(IPage<HouseLabelVO> page, HouseLabelVO houseLabel); IPage<HouseholdLabelVO> selectHouseholdLabelPage(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel); /** * 房屋-标签 自定义新增或修改 * @param houseLabel * 住户-标签 自定义新增或修改 * @param householdLabel * @return */ boolean saveOrUpdateHouseLabel(UserHouseLabelEntity houseLabel); boolean saveOrUpdateHouseholdLabel(UserHouseLabelEntity householdLabel); List<Integer> selectUserLabelList(UserHouseLabelDTO userHouseLabelDTO); } src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java
@@ -18,19 +18,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.entity.HouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import org.springblade.modules.house.mapper.UserHouseLabelMapper; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.modules.house.mapper.HouseLabelMapper; import org.springblade.modules.house.service.IHouseLabelService; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.modules.label.entity.LabelEntity; import org.springblade.modules.label.service.ILabelService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 房屋-标签 服务实现类 @@ -39,7 +36,7 @@ * @since 2023-10-28 */ @Service public class HouseLabelServiceImpl extends ServiceImpl<UserHouseLabelMapper, UserHouseLabelEntity> implements IUserHouseLabelService { public class HouseLabelServiceImpl extends ServiceImpl<HouseLabelMapper, HouseLabelEntity> implements IHouseLabelService { @Autowired private ILabelService labelService; @@ -55,15 +52,15 @@ * @return */ @Override public boolean saveOrUpdateHouseLabel(UserHouseLabelEntity houseLabel) { public boolean saveOrUpdateHouseLabel(HouseLabelEntity houseLabel) { // 查询标签名称 LabelEntity labelEntity = labelService.getById(houseLabel.getLabelId()); houseLabel.setLabelName(labelEntity.getLabelName()); // 判断同一个房屋同一个标签是否已存在,已存在则更新,不存在则新增 QueryWrapper<UserHouseLabelEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<HouseLabelEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("house_code",houseLabel.getHouseCode()) .eq("label_id",houseLabel.getLabelId()); UserHouseLabelEntity one = getOne(queryWrapper); .eq("label_id",houseLabel.getLabelId()); HouseLabelEntity one = getOne(queryWrapper); if (null != one){ houseLabel.setId(one.getId()); // 更新 @@ -72,12 +69,4 @@ // 插入 return save(houseLabel); } @Override public List<Integer> selectUserLabelList(UserHouseLabelDTO userHouseLabelDTO) { userHouseLabelDTO.setUserId(AuthUtil.getUserId()); List<Integer> list = baseMapper.getUserLabelList(userHouseLabelDTO); return list; } } src/main/java/org/springblade/modules/house/service/impl/UserHouseLabelServiceImpl.java
File was renamed from src/main/java/org/springblade/modules/house/service/impl/HouseholdLabelServiceImpl.java @@ -18,13 +18,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.common.node.TreeNode; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.entity.HouseholdLabelEntity; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.mapper.HouseholdLabelMapper; import org.springblade.modules.house.service.IHouseholdLabelService; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.modules.house.mapper.UserHouseLabelMapper; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.modules.label.entity.LabelEntity; import org.springblade.modules.label.service.ILabelService; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +38,7 @@ * @since 2023-10-28 */ @Service public class HouseholdLabelServiceImpl extends ServiceImpl<HouseholdLabelMapper, HouseholdLabelEntity> implements IHouseholdLabelService { public class UserHouseLabelServiceImpl extends ServiceImpl<UserHouseLabelMapper, UserHouseLabelEntity> implements IUserHouseLabelService { @Autowired @@ -48,7 +46,7 @@ @Override public IPage<HouseholdLabelVO> selectHouseholdLabelPage(IPage<HouseholdLabelVO> page, HouseholdLabelVO householdLabel) { return page.setRecords(baseMapper.selectHouseholdLabelPage(page, householdLabel)); return page.setRecords(baseMapper.selectHouseLabelPage(page, householdLabel)); } /** @@ -57,15 +55,15 @@ * @return */ @Override public boolean saveOrUpdateHouseholdLabel(HouseholdLabelEntity householdLabel) { public boolean saveOrUpdateHouseholdLabel(UserHouseLabelEntity householdLabel) { // 查询标签名称 LabelEntity labelEntity = labelService.getById(householdLabel.getLabelId()); householdLabel.setLabelName(labelEntity.getLabelName()); // 判断同一个住户同一个标签是否已存在,已存在则更新,不存在则新增 QueryWrapper<HouseholdLabelEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<UserHouseLabelEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("household_id",householdLabel.getHouseholdId()) .eq("label_id",householdLabel.getLabelId()); HouseholdLabelEntity one = getOne(queryWrapper); UserHouseLabelEntity one = getOne(queryWrapper); if (null != one){ householdLabel.setId(one.getId()); // 更新 @@ -74,4 +72,10 @@ // 插入 return save(householdLabel); } @Override public List<Integer> selectUserLabelList(UserHouseLabelDTO userHouseLabelDTO) { List<Integer> userLabelList = baseMapper.getUserLabelList(userHouseLabelDTO); return userLabelList; } } src/main/java/org/springblade/modules/house/vo/HouseLabelVO.java
@@ -16,10 +16,9 @@ */ package org.springblade.modules.house.vo; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.house.entity.HouseLabelEntity; /** * 房屋-标签 视图实体类 @@ -29,7 +28,7 @@ */ @Data @EqualsAndHashCode(callSuper = true) public class HouseLabelVO extends UserHouseLabelEntity { public class HouseLabelVO extends HouseLabelEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/house/vo/HouseholdLabelVO.java
@@ -16,8 +16,7 @@ */ package org.springblade.modules.house.vo; import org.springblade.modules.house.entity.HouseholdLabelEntity; import org.springblade.core.tool.node.INode; import org.springblade.modules.house.entity.UserHouseLabelEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,7 +28,7 @@ */ @Data @EqualsAndHashCode(callSuper = true) public class HouseholdLabelVO extends HouseholdLabelEntity { public class HouseholdLabelVO extends UserHouseLabelEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/house/wrapper/HouseLabelWrapper.java
@@ -18,8 +18,9 @@ import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.entity.HouseLabelEntity; import org.springblade.modules.house.vo.HouseLabelVO; import java.util.Objects; /** @@ -28,14 +29,14 @@ * @author BladeX * @since 2023-10-28 */ public class HouseLabelWrapper extends BaseEntityWrapper<UserHouseLabelEntity, HouseLabelVO> { public class HouseLabelWrapper extends BaseEntityWrapper<HouseLabelEntity, HouseLabelVO> { public static HouseLabelWrapper build() { return new HouseLabelWrapper(); } @Override public HouseLabelVO entityVO(UserHouseLabelEntity houseLabel) { public HouseLabelVO entityVO(HouseLabelEntity houseLabel) { HouseLabelVO houseLabelVO = Objects.requireNonNull(BeanUtil.copy(houseLabel, HouseLabelVO.class)); //User createUser = UserCache.getUser(houseLabel.getCreateUser()); src/main/java/org/springblade/modules/house/wrapper/HouseholdLabelWrapper.java
@@ -18,7 +18,7 @@ import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.house.entity.HouseholdLabelEntity; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.vo.HouseholdLabelVO; import java.util.Objects; @@ -28,14 +28,14 @@ * @author BladeX * @since 2023-10-28 */ public class HouseholdLabelWrapper extends BaseEntityWrapper<HouseholdLabelEntity, HouseholdLabelVO> { public class HouseholdLabelWrapper extends BaseEntityWrapper<UserHouseLabelEntity, HouseholdLabelVO> { public static HouseholdLabelWrapper build() { return new HouseholdLabelWrapper(); } @Override public HouseholdLabelVO entityVO(HouseholdLabelEntity householdLabel) { public HouseholdLabelVO entityVO(UserHouseLabelEntity householdLabel) { HouseholdLabelVO householdLabelVO = Objects.requireNonNull(BeanUtil.copy(householdLabel, HouseholdLabelVO.class)); //User createUser = UserCache.getUser(householdLabel.getCreateUser()); src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java
@@ -360,7 +360,7 @@ List<List<String>> labelList = menu.getLabelList(); StringBuffer stringBuffer = new StringBuffer(); for (List<String> strings : labelList) { stringBuffer.append(strings.get(2)).append(","); stringBuffer.append(strings.get(strings.size()-1)).append(","); } menu.setLabelId(stringBuffer.toString()); menu.setIsDeleted(BladeConstant.DB_NOT_DELETED);