From 9e3d409abac477fee06da262f531628f6e97e36c Mon Sep 17 00:00:00 2001 From: LNH <15186596+lnh123@user.noreply.gitee.com> Date: Thu, 26 Dec 2024 14:23:03 +0800 Subject: [PATCH] =?UTF-8?q?lnh=E7=89=A9=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/JsqCustomerController.java | 1 - .../controller/JsqPropertyController.java | 99 ++++ .../com/ruoyi/yonghu/domain/JsqProperty.java | 52 ++ .../yonghu/mapper/JsqPropertyMapper.java | 63 +++ .../yonghu/service/IJsqPropertyService.java | 59 +++ .../service/impl/JsqPropertyServiceImpl.java | 154 ++++++ .../mapper/yonghu/JsqPropertyMapper.xml | 106 ++++ .../ruoyi-ui/src/api/yonghu/property.js | 8 +- .../src/views/yonghu/property/index.vue | 459 ------------------ 9 files changed, 537 insertions(+), 464 deletions(-) create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/domain/JsqProperty.java create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/mapper/JsqPropertyMapper.java create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java create mode 100644 RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/resources/mapper/yonghu/JsqPropertyMapper.xml delete mode 100644 RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java index 9798002..09ddd28 100644 --- a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqCustomerController.java @@ -11,7 +11,6 @@ import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.system.api.RemoteUserRoleService; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.yonghu.domain.JsqCustomer; -import com.ruoyi.yonghu.domain.SysUserRole; import com.ruoyi.yonghu.domain.dto.CustromerUserDto; import com.ruoyi.yonghu.service.JsqCustomerService; import org.slf4j.Logger; diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java new file mode 100644 index 0000000..ad6f1cc --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/controller/JsqPropertyController.java @@ -0,0 +1,99 @@ +package com.ruoyi.yonghu.controller; + +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.yonghu.domain.JsqProperty; +import com.ruoyi.yonghu.service.IJsqPropertyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + +/** + * @Author: LNH + * @Date: 2024-12-24-9:46 + * @Description: + */ +@RestController +@EnableFeignClients +@RequestMapping("/property") +public class JsqPropertyController extends BaseController { + + @Autowired + private IJsqPropertyService jsqPropertyService; + + + /** + * 查询物业人员列表 + */ + @RequiresPermissions("yonghu:property:list") + @GetMapping("/list") + public TableDataInfo list(JsqProperty jsqProperty) { + startPage(); + List list = jsqPropertyService.selectJsqPropertyList(jsqProperty); + return getDataTable(list); + } + + /** + * 获取物业人员详细信息 + */ + @RequiresPermissions("yonghu:property:query") + @GetMapping(value = "/{userId}") + public AjaxResult getInfo(@PathVariable("userId") Long userId) { + return success(jsqPropertyService.selectJsqPropertyByPropertyId(userId)); + } + + + /** + * 新增物业人员 + */ + @RequiresPermissions("yonghu:property:add") + @Log(title = "物业人员", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Map data) { + + return toAjax(jsqPropertyService.insertJsqProperty(data)); + } + + /** + * 修改物业人员 + */ + @RequiresPermissions("yonghu:property:edit") + @Log(title = "物业人员", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody Map data) { + return toAjax(jsqPropertyService.updateJsqProperty(data)); + } + + /** + * 删除物业人员 + */ + @RequiresPermissions("yonghu:property:remove") + @Log(title = "物业人员", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) { + return toAjax(jsqPropertyService.deleteJsqPropertyByPropertyIds(userIds)); + } + + /** + * 导出物业人员列表 + */ + @RequiresPermissions("yonghu:property:export") + @Log(title = "物业人员", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, JsqProperty jsqProperty) + { + List list = jsqPropertyService.selectJsqPropertyList(jsqProperty); + ExcelUtil util = new ExcelUtil(JsqProperty.class); + util.exportExcel(response, list, "物业人员数据"); + } +} diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/domain/JsqProperty.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/domain/JsqProperty.java new file mode 100644 index 0000000..85c6a52 --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/domain/JsqProperty.java @@ -0,0 +1,52 @@ +package com.ruoyi.yonghu.domain; + +import com.ruoyi.system.api.domain.SysUser; +import lombok.Data; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 物业人员对象 jsq_property + * + * @author ruoyi + * @date 2024-12-22 + */ +@Data +public class JsqProperty extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long propertyId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + private SysUser sysUser; + /** 年龄 */ + @Excel(name = "姓名") + private String propertyName; + + private String phonenumber; + /** 年龄 */ + @Excel(name = "年龄") + private Long propertyAge; + + /** 性别 */ + @Excel(name = "性别") + private String propertySex; + + /** 详细地址 */ + @Excel(name = "详细地址") + private String propertyAddress; + + /** 社区ID */ + @Excel(name = "社区ID") + private Long communityId; + + /** 逻辑删除 */ + private String delFlag; + + +} diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/mapper/JsqPropertyMapper.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/mapper/JsqPropertyMapper.java new file mode 100644 index 0000000..971e053 --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/mapper/JsqPropertyMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.yonghu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.yonghu.domain.JsqProperty; + +import java.util.List; + +/** + * @Author: LNH + * @Date: 2024-12-24-9:39 + * @Description: + */ +public interface JsqPropertyMapper extends BaseMapper { + + public int insertJsqProperty(JsqProperty jsqProperty, SysUser sysUser); + + + /** + * 查询物业人员 + * @param propertyId 物业人员主键 + * @return 物业人员 + */ + public JsqProperty selectJsqPropertyByPropertyId(Long propertyId); + + /** + * 查询物业人员列表 + * + * @param jsqProperty 物业人员 + * @return 物业人员集合 + */ + public List selectJsqPropertyList(JsqProperty jsqProperty); + + /** + * 新增物业人员 + * + * @param jsqProperty 物业人员 + * @return 结果 + */ + public int insertJsqProperty(JsqProperty jsqProperty); + + + /** + * 修改物业人员 + * + * @param jsqProperty 物业人员 + * @return 结果 + */ + public int updateJsqProperty(JsqProperty jsqProperty); + + /** + * 删除物业人员 + * @return 结果 + */ + public int deleteJsqPropertyByPropertyId(Long userId); + + /** + * 批量删除物业人员 + * @return 结果 + */ + public int deleteJsqPropertyByPropertyIds(Long[] userIds); + +} diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java new file mode 100644 index 0000000..1054c85 --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/IJsqPropertyService.java @@ -0,0 +1,59 @@ +package com.ruoyi.yonghu.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.yonghu.domain.JsqProperty; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; +import java.util.Map; + +/** + * @Author: LNH + * @Date: 2024-12-24-9:41 + * @Description: + */ +public interface IJsqPropertyService extends IService { + + public int insertJsqProperty(Map data); + + + /** + * 查询物业人员 + * @return 物业人员 + */ + public JsqProperty selectJsqPropertyByPropertyId(Long userId); + + /** + * 查询物业人员列表 + * + * @param jsqProperty 物业人员 + * @return 物业人员集合 + */ + public List selectJsqPropertyList(JsqProperty jsqProperty); + + /** + * 新增物业人员 + * + * @return 结果 + */ + //public int insertJsqProperty(JsqProperty jsqProperty); + + /** + * 修改物业人员 + * @return 结果 + */ + public int updateJsqProperty(@Validated @RequestBody Map data); + + /** + * 批量删除物业人员 + * @return 结果 + */ + public int deleteJsqPropertyByPropertyIds(Long[] userIds); + + /** + * 删除物业人员信息 + * @return 结果 + */ + public int deleteJsqPropertyByPropertyId(Long userId); +} diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java new file mode 100644 index 0000000..cbae109 --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/java/com/ruoyi/yonghu/service/impl/JsqPropertyServiceImpl.java @@ -0,0 +1,154 @@ +package com.ruoyi.yonghu.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.yonghu.domain.JsqProperty; +import com.ruoyi.yonghu.mapper.JsqPropertyMapper; + +import com.ruoyi.yonghu.service.IJsqPropertyService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.RemoteUserRoleService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Author: LNH + * @Date: 2024-12-24-9:42 + * @Description: + */ +@Service +public class JsqPropertyServiceImpl extends ServiceImpl implements IJsqPropertyService { + + @Resource + private JsqPropertyMapper jsqPropertyMapper; + + @Resource + private RemoteUserRoleService remoteUserRoleService; + + + /** + * 新增物业人员 + * @return 结果 + */ + @Transactional + public int insertJsqProperty(Map data){ + + SysUser sysUser = new SysUser(); + JsqProperty jsqProperty = new JsqProperty(); + + Long[] roleIds = new Long[1]; + roleIds[0] = 4L; + sysUser.setRoleIds(roleIds); + sysUser.setPhonenumber((String) data.get("phonenumber")); + sysUser.setPassword((String) data.get("password")); + sysUser.setStatus("0"); + sysUser.setCreateBy(SecurityUtils.getUsername()); + sysUser.setCreateTime(jsqProperty.getCreateTime()); + + R integerR = remoteUserRoleService.addApi(sysUser, "inner" ); + + jsqProperty.setCommunityId(Long.valueOf((String)data.get("communityId"))); + jsqProperty.setPropertyName((String)data.get("propertyName")); + jsqProperty.setPropertyAddress((String) data.get("propertyAddress")); + jsqProperty.setPropertyAge(Long.valueOf((String)data.get("propertyAge"))); + jsqProperty.setPropertySex((String) data.get("propertySex")); + jsqProperty.setUserId(Long.parseLong(integerR.getData().toString())); + + + return jsqPropertyMapper.insertJsqProperty(jsqProperty); + } + + + /** + * 查询物业人员 + * @return 物业人员 + */ + @Override + public JsqProperty selectJsqPropertyByPropertyId(Long userId) + { + return jsqPropertyMapper.selectJsqPropertyByPropertyId(userId); + } + + /** + * 查询物业人员列表 + * @return 物业人员 + */ + @Override + public List selectJsqPropertyList(JsqProperty jsqProperty) + { + return jsqPropertyMapper.selectJsqPropertyList(jsqProperty); + } + + + /** + * 修改物业人员 + * @return 结果 + */ + @Override + @Transactional + public int updateJsqProperty(@Validated @RequestBody Map data) + { + SysUser sysUser = new SysUser(); + + Long[] roleIds = new Long[1]; + roleIds[0] = 4L; + sysUser.setRoleIds(roleIds); + sysUser.setPhonenumber((String) data.get("phonenumber")); + sysUser.setPassword((String) data.get("password")); + sysUser.setSex(data.get("sex").toString()); + sysUser.setStatus("0"); + sysUser.setCreateBy(SecurityUtils.getUsername()); + + JsqProperty jsqProperty = new JsqProperty(); + sysUser.setCreateTime(jsqProperty.getCreateTime()); + + R integerR = remoteUserRoleService.editApi(sysUser, "inner" ); + + jsqProperty.setUserId(integerR.getData().longValue()); + + jsqProperty.setCommunityId(Long.valueOf(data.get("communityId").toString())); + jsqProperty.setPropertyAddress((String) data.get("propertyAddress")); + jsqProperty.setPropertyName((String)data.get("propertyName")); + jsqProperty.setPropertyAge(Long.valueOf((String)data.get("propertyAge"))); + jsqProperty.setPropertySex((String) data.get("propertySex")); + jsqProperty.setUserId(Long.valueOf(data.get("userId").toString())); + + System.out.println("============="+jsqProperty); + int i = jsqPropertyMapper.updateJsqProperty(jsqProperty); + return i; + } + + /** + * 批量删除物业人员 + * @return 结果 + */ + @Override + @Transactional + public int deleteJsqPropertyByPropertyIds(Long[] userIds) { + + //删除用户表 根据userId删除对应的用户信息 + remoteUserRoleService.removeApi(userIds, "inner"); + + //删除客户表 根据userId删除对应的客户信息,来实现将用户同时从两个表中删除 + return jsqPropertyMapper.deleteJsqPropertyByPropertyIds(userIds); + } + + /** + * 删除物业人员信息 + * + * @return 结果 + */ + @Override + public int deleteJsqPropertyByPropertyId(Long userId) + { + return jsqPropertyMapper.deleteJsqPropertyByPropertyId(userId); + } +} diff --git a/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/resources/mapper/yonghu/JsqPropertyMapper.xml b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/resources/mapper/yonghu/JsqPropertyMapper.xml new file mode 100644 index 0000000..abf5682 --- /dev/null +++ b/RuoYi-Cloud-master/ruoyi-modules/ruoyi-yonghu/src/main/resources/mapper/yonghu/JsqPropertyMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + select a.property_id, a.user_id,a.property_name, a.property_age, a.property_sex, a.property_address, + a.community_id, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, + b.user_id,b.user_name,b.phonenumber,b.`password`,b.sex,b.nick_name + from jsq_property a left join sys_user b on a.user_id = b.user_id + + + + + + + + + + insert into jsq_property + + user_id, + property_age, + property_name, + property_sex, + property_address, + community_id, + create_by, + create_time, + update_by, + update_time, + del_flag, + + + #{userId}, + #{propertyAge}, + #{propertyName}, + #{propertySex}, + #{propertyAddress}, + #{communityId}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{delFlag}, + + + + + + update jsq_property + + user_id = #{userId}, + property_age = #{propertyAge}, + property_name = #{propertyName}, + property_sex = #{propertySex}, + property_address = #{propertyAddress}, + community_id = #{communityId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag}, + + where user_id = #{userId} + + + + update jsq_property set del_flag = '2' where user_id = #{userId} + + + + update jsq_property set del_flag = '2' where user_id in + + #{userId} + + + + diff --git a/RuoYi-Cloud-master/ruoyi-ui/src/api/yonghu/property.js b/RuoYi-Cloud-master/ruoyi-ui/src/api/yonghu/property.js index 6bdc520..49aec3b 100644 --- a/RuoYi-Cloud-master/ruoyi-ui/src/api/yonghu/property.js +++ b/RuoYi-Cloud-master/ruoyi-ui/src/api/yonghu/property.js @@ -10,9 +10,9 @@ export function listProperty(query) { } // 查询物业人员详细 -export function getProperty(propertyId) { +export function getProperty(userId) { return request({ - url: '/yonghu/property/' + propertyId, + url: '/yonghu/property/' + userId, method: 'get' }) } @@ -36,9 +36,9 @@ export function updateProperty(data) { } // 删除物业人员 -export function delProperty(propertyId) { +export function delProperty(userId) { return request({ - url: '/yonghu/property/' + propertyId, + url: '/yonghu/property/' + userId, method: 'delete' }) } diff --git a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue b/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue deleted file mode 100644 index 959944a..0000000 --- a/RuoYi-Cloud-master/ruoyi-ui/src/views/yonghu/property/index.vue +++ /dev/null @@ -1,459 +0,0 @@ - - - - -- Gitee