diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysUserController.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysUserController.java index 690c574..562106a 100644 --- a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysUserController.java +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysUserController.java @@ -66,6 +66,8 @@ public class SysUserController { private OptSysDeptService optSysDeptService; @Autowired private SysEpmetUserRelationService sysEpmetUserRelationService; + @Autowired + private SysPropertyUserService sysPropertyUserService; @GetMapping("page") @ApiOperation("分页") @@ -86,6 +88,8 @@ public class SysUserController { @ApiOperation("信息") public Result get(@PathVariable("id") Long id) { SysUserDTO data = sysUserService.get(id); + //设置物业id + data.setProjectId(sysPropertyUserService.getByUserId(id.toString())); //用户角色列表 List roleIdList = sysRoleUserService.getRoleIdList(id); diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/SysPropertyUserDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/SysPropertyUserDao.java new file mode 100644 index 0000000..088f307 --- /dev/null +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/SysPropertyUserDao.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.SysPropertyUserDTO; +import com.elink.esua.epdc.entity.SysPropertyUserEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 物业项目-用户关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-10 + */ +@Mapper +public interface SysPropertyUserDao extends BaseDao { + + int updateByUserId(SysPropertyUserDTO dto); + + String selectByUserId(@Param("userId") String UserId); + + +} \ No newline at end of file diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/SysPropertyUserEntity.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/SysPropertyUserEntity.java new file mode 100644 index 0000000..f2c5575 --- /dev/null +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/SysPropertyUserEntity.java @@ -0,0 +1,50 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 物业项目-用户关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_property_user") +public class SysPropertyUserEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + + /** + * 用户ID + */ + private String userId; + + /** + * 业务项目id + */ + private String projectId; + + +} \ No newline at end of file diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/SysPropertyUserService.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/SysPropertyUserService.java new file mode 100644 index 0000000..9f43a37 --- /dev/null +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/SysPropertyUserService.java @@ -0,0 +1,108 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.SysPropertyUserDTO; +import com.elink.esua.epdc.entity.SysPropertyUserEntity; + +import java.util.List; +import java.util.Map; + +/** + * 物业项目-用户关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-10 + */ +public interface SysPropertyUserService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-09-10 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-09-10 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return SysPropertyUserDTO + * @author generator + * @date 2021-09-10 + */ + SysPropertyUserDTO get(String id); + + /** + * @Author zhangfenghe + * @Description 获取物业id + * @Date 15:16 2021/9/15 + * @Param [userId] + * @return java.lang.String + **/ + String getByUserId(String userId); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-10 + */ + void save(SysPropertyUserDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-10 + */ + void update(SysPropertyUserDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-09-10 + */ + void delete(String[] ids); + + void savePropertyUser(String userId,String projectId); + + void updatePropertyUser(String userId,String projectId); +} \ No newline at end of file diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysPropertyUserServiceImpl.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysPropertyUserServiceImpl.java new file mode 100644 index 0000000..51b63d6 --- /dev/null +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysPropertyUserServiceImpl.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dao.SysPropertyUserDao; +import com.elink.esua.epdc.dto.SysPropertyUserDTO; +import com.elink.esua.epdc.entity.SysPropertyUserEntity; +import com.elink.esua.epdc.service.SysPropertyUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 物业项目-用户关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-10 + */ +@Service +public class SysPropertyUserServiceImpl extends BaseServiceImpl implements SysPropertyUserService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, SysPropertyUserDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, SysPropertyUserDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public SysPropertyUserDTO get(String id) { + SysPropertyUserEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, SysPropertyUserDTO.class); + } + + @Override + public String getByUserId(String userId) { + return baseDao.selectByUserId(userId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(SysPropertyUserDTO dto) { + SysPropertyUserEntity entity = ConvertUtils.sourceToTarget(dto, SysPropertyUserEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SysPropertyUserDTO dto) { + SysPropertyUserEntity entity = ConvertUtils.sourceToTarget(dto, SysPropertyUserEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public void savePropertyUser(String userId,String projectId) { + SysPropertyUserDTO dto = new SysPropertyUserDTO(); + dto.setUserId(userId); + dto.setProjectId(projectId); + SysPropertyUserEntity entity = ConvertUtils.sourceToTarget(dto, SysPropertyUserEntity.class); + insert(entity); + } + + @Override + public void updatePropertyUser(String userId, String projectId) { + SysPropertyUserDTO dto = new SysPropertyUserDTO(); + dto.setUserId(userId); + dto.setProjectId(projectId); + baseDao.updateByUserId(dto); + } + +} \ No newline at end of file diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java index b724edc..21fa2f0 100644 --- a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java +++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java @@ -31,10 +31,7 @@ import com.elink.esua.epdc.dto.epdc.GridLeaderRegisterDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcAppGridManFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppGridManListResultDTO; import com.elink.esua.epdc.entity.SysUserEntity; -import com.elink.esua.epdc.service.SysDeptService; -import com.elink.esua.epdc.service.SysEpmetUserRelationService; -import com.elink.esua.epdc.service.SysRoleUserService; -import com.elink.esua.epdc.service.SysUserService; +import com.elink.esua.epdc.service.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -56,7 +53,8 @@ public class SysUserServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + update yushan_esua_epdc_admin.sys_property_user + set project_id = #{projectId} + where user_id = #{userId} + + + + \ No newline at end of file