| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.panzhihua.common.utlis.Snowflake; |
| | | import com.panzhihua.service_community.dao.SysUserMapper; |
| | | import com.panzhihua.service_community.entity.ComBatteryStore; |
| | | import com.panzhihua.service_community.dao.ComBatteryStoreMapper; |
| | |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | * @author lyq |
| | | * @date 2022-03-28 13:44:45 |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public R insert(AddComBatteryStoreDto comBatteryStore) { |
| | | ComBatteryStore entity = new ComBatteryStore(); |
| | |
| | | if (this.baseMapper.insert(entity) > 0) { |
| | | //新增电动车商城商家账号 |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(Snowflake.getId()); |
| | | sysUser.setType(20); |
| | | sysUser.setStatus(SysUser.Status.YES); |
| | | sysUser.setAccount(comBatteryStore.getAccount()); |
| | |
| | | sysUser.setName(comBatteryStore.getName() + "管理员"); |
| | | sysUser.setPlaintextPassword(comBatteryStore.getPassword()); |
| | | sysUser.setCommunityId(entity.getId()); |
| | | sysUser.setAppId("wx0cef797390444b75"); |
| | | userDao.insert(sysUser); |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.fail("未查询到该记录"); |
| | | } |
| | | BeanUtils.copyProperties(editDto, entity); |
| | | //注册手机不可修改 |
| | | entity.setRegPhone(null); |
| | | if (this.baseMapper.updateById(entity) > 0) { |
| | | return R.ok(); |
| | | } |
| | |
| | | entity.setId(id); |
| | | entity.setIsDel(ComBatteryStore.IsDel.YES); |
| | | if (this.baseMapper.updateById(entity) > 0) { |
| | | //同时删除账号 |
| | | this.baseMapper.deleteStoreUserByStoreId(id); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("删除失败"); |