加了新增用户时的一些判断

master
luojian 2024-12-20 09:24:24 +08:00
parent 1c01993989
commit ba2ba26334
13 changed files with 59 additions and 23 deletions

View File

@ -93,7 +93,7 @@ token:
# 令牌自定义标识 # 令牌自定义标识
header: Authorization header: Authorization
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijk
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 30

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cpxt.biz.domain.BizCustomer; import com.cpxt.biz.domain.BizCustomer;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/** /**
* Mapper * Mapper
@ -14,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface BizCustomerMapper extends BaseMapper<BizCustomer> public interface BizCustomerMapper extends BaseMapper<BizCustomer>
{ } {
@Select("select * from biz_customer where linkphone = #{username}")
BizCustomer selectByLinkPhone(String username);
}

View File

@ -60,6 +60,7 @@ public class BizCarModelServiceImpl implements IBizCarModelService
if (ObjectUtil.isNotEmpty(bizCarModel.getName())) { if (ObjectUtil.isNotEmpty(bizCarModel.getName())) {
queryWrapper.like(BizCarModel::getName, bizCarModel.getName()); queryWrapper.like(BizCarModel::getName, bizCarModel.getName());
} }
queryWrapper.eq(BizCarModel::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -110,9 +111,9 @@ public class BizCarModelServiceImpl implements IBizCarModelService
public int deleteBizCarModelByIds(Long[] ids) public int deleteBizCarModelByIds(Long[] ids)
{ {
UpdateWrapper<BizCarModel> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCarModel> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCarModelMapper.update(null,updateWrapper); return bizCarModelMapper.update(updateWrapper);
} }
/** /**

View File

@ -68,6 +68,7 @@ public class BizCarServiceImpl implements IBizCarService
if (ObjectUtil.isNotEmpty(bizCar.getSerialNo())) { if (ObjectUtil.isNotEmpty(bizCar.getSerialNo())) {
queryWrapper.like(BizCar::getSerialNo, bizCar.getSerialNo()); queryWrapper.like(BizCar::getSerialNo, bizCar.getSerialNo());
} }
queryWrapper.eq(BizCar::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -127,9 +128,9 @@ public class BizCarServiceImpl implements IBizCarService
public int deleteBizCarByIds(Long[] ids) public int deleteBizCarByIds(Long[] ids)
{ {
UpdateWrapper<BizCar> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCar> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCarMapper.update(null,updateWrapper); return bizCarMapper.update(updateWrapper);
} }
/** /**

View File

@ -47,7 +47,7 @@ public class BizCustomerRouteServiceImpl implements IBizCustomerRouteService
public List<BizCustomerRoute> selectBizCustomerRouteList(BizCustomerRoute bizCustomerRoute) public List<BizCustomerRoute> selectBizCustomerRouteList(BizCustomerRoute bizCustomerRoute)
{ {
LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BizCustomerRoute::getStatus,1);
return bizCustomerRouteMapper.selectList(queryWrapper); return bizCustomerRouteMapper.selectList(queryWrapper);
} }
@ -85,7 +85,7 @@ public class BizCustomerRouteServiceImpl implements IBizCustomerRouteService
public int deleteBizCustomerRouteByIds(Long[] ids) public int deleteBizCustomerRouteByIds(Long[] ids)
{ {
UpdateWrapper<BizCustomerRoute> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCustomerRoute> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCustomerRouteMapper.update(null,updateWrapper); return bizCustomerRouteMapper.update(null,updateWrapper);
} }

View File

@ -76,6 +76,7 @@ public class BizCustomerServiceImpl implements IBizCustomerService
if (ObjectUtil.isNotEmpty(bizCustomer.getLevel())){ if (ObjectUtil.isNotEmpty(bizCustomer.getLevel())){
queryWrapper.eq(BizCustomer::getLevel, bizCustomer.getLevel()); queryWrapper.eq(BizCustomer::getLevel, bizCustomer.getLevel());
} }
queryWrapper.eq(BizCustomer::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -153,8 +154,13 @@ public class BizCustomerServiceImpl implements IBizCustomerService
@Override @Override
public int deleteBizCustomerByIds(Long[] ids) public int deleteBizCustomerByIds(Long[] ids)
{ {
// 删除客户对应的用户
for (Long id : ids) {
BizCustomer bizCustomer = bizCustomerMapper.selectById(id);
sysUserMapper.deleteByUserName(bizCustomer.getLinkphone());
}
UpdateWrapper<BizCustomer> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCustomer> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCustomerMapper.update(null,updateWrapper); return bizCustomerMapper.update(null,updateWrapper);
} }

View File

@ -78,6 +78,7 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService
if (ObjectUtil.isNotEmpty(bizCustomerShop.getLinkphone())){ if (ObjectUtil.isNotEmpty(bizCustomerShop.getLinkphone())){
queryWrapper.like(BizCustomerShop::getLinkphone, bizCustomerShop.getLinkphone()); queryWrapper.like(BizCustomerShop::getLinkphone, bizCustomerShop.getLinkphone());
} }
queryWrapper.eq(BizCustomerShop::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -115,7 +116,7 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService
public int deleteBizCustomerShopByIds(Long[] ids) public int deleteBizCustomerShopByIds(Long[] ids)
{ {
UpdateWrapper<BizCustomerShop> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCustomerShop> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCustomerShopMapper.update(null,updateWrapper); return bizCustomerShopMapper.update(null,updateWrapper);
} }

View File

@ -46,6 +46,7 @@ public class BizCustomerUserServiceImpl implements IBizCustomerUserService
public List<BizCustomerUser> selectBizCustomerUserList(BizCustomerUser bizCustomerUser) public List<BizCustomerUser> selectBizCustomerUserList(BizCustomerUser bizCustomerUser)
{ {
LambdaQueryWrapper<BizCustomerUser> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BizCustomerUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BizCustomerUser::getStatus,1);
return bizCustomerUserMapper.selectList(queryWrapper); return bizCustomerUserMapper.selectList(queryWrapper);
} }
@ -83,7 +84,7 @@ public class BizCustomerUserServiceImpl implements IBizCustomerUserService
public int deleteBizCustomerUserByIds(Long[] ids) public int deleteBizCustomerUserByIds(Long[] ids)
{ {
UpdateWrapper<BizCustomerUser> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCustomerUser> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCustomerUserMapper.update(null,updateWrapper); return bizCustomerUserMapper.update(null,updateWrapper);
} }

View File

@ -81,6 +81,7 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer
if (ObjectUtil.isNotEmpty(bizCustomerWarehouse.getAddress())){ if (ObjectUtil.isNotEmpty(bizCustomerWarehouse.getAddress())){
queryWrapper.like(BizCustomerWarehouse::getAddress, bizCustomerWarehouse.getAddress()); queryWrapper.like(BizCustomerWarehouse::getAddress, bizCustomerWarehouse.getAddress());
} }
queryWrapper.eq(BizCustomerWarehouse::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -118,7 +119,7 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer
public int deleteBizCustomerWarehouseByIds(Long[] ids) public int deleteBizCustomerWarehouseByIds(Long[] ids)
{ {
UpdateWrapper<BizCustomerWarehouse> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizCustomerWarehouse> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizCustomerWarehouseMapper.update(null,updateWrapper); return bizCustomerWarehouseMapper.update(null,updateWrapper);
} }

View File

@ -82,6 +82,7 @@ public class BizDriverServiceImpl implements IBizDriverService
if (ObjectUtil.isNotEmpty(bizDriver.getDefaultCarNo())){ if (ObjectUtil.isNotEmpty(bizDriver.getDefaultCarNo())){
queryWrapper.like(BizDriver::getDefaultCarNo, bizDriver.getDefaultCarNo()); queryWrapper.like(BizDriver::getDefaultCarNo, bizDriver.getDefaultCarNo());
} }
queryWrapper.eq(BizDriver::getStatus,"1");
return queryWrapper; return queryWrapper;
} }
@ -139,15 +140,20 @@ public class BizDriverServiceImpl implements IBizDriverService
@Override @Override
public int deleteBizDriverByIds(Long[] ids) public int deleteBizDriverByIds(Long[] ids)
{ {
// 删除司机对应用户
for (Long id : ids) {
BizDriver bizDriver = bizDriverMapper.selectById(id);
sysUserMapper.deleteByUserName(bizDriver.getPhone());
}
UpdateWrapper<BizDriver> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizDriver> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizDriverMapper.update(null,updateWrapper); return bizDriverMapper.update(null,updateWrapper);
} }
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.*; import com.cpxt.biz.domain.*;
import com.cpxt.biz.mapper.*; import com.cpxt.biz.mapper.*;
import com.cpxt.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.cpxt.biz.service.IBizOrderService; import com.cpxt.biz.service.IBizOrderService;
@ -253,6 +254,7 @@ public class BizOrderServiceImpl implements IBizOrderService
if (ObjectUtil.isNotEmpty(bizOrder.getArriveLat())){ if (ObjectUtil.isNotEmpty(bizOrder.getArriveLat())){
queryWrapper.eq(BizOrder::getArriveLat, bizOrder.getArriveLat()); queryWrapper.eq(BizOrder::getArriveLat, bizOrder.getArriveLat());
} }
queryWrapper.eq(BizOrder::getStatus,1);
return queryWrapper; return queryWrapper;
} }
@ -266,6 +268,11 @@ public class BizOrderServiceImpl implements IBizOrderService
public int insertBizOrder(BizOrder bizOrder) public int insertBizOrder(BizOrder bizOrder)
{ {
Long customerId = bizOrder.getCustomerId(); // 客户id Long customerId = bizOrder.getCustomerId(); // 客户id
if (ObjectUtil.isEmpty(customerId)){
String username = SecurityUtils.getUsername();
BizCustomer bizCustomer = bizCustomerMapper.selectByLinkPhone(username);
customerId = bizCustomer.getId();
}
Long routeId = bizOrder.getRouteId(); // 路线id Long routeId = bizOrder.getRouteId(); // 路线id
Long warehouseId = bizOrder.getWarehouseId(); // 仓库id Long warehouseId = bizOrder.getWarehouseId(); // 仓库id
Long shopId = bizOrder.getShopId(); // 店铺id Long shopId = bizOrder.getShopId(); // 店铺id
@ -274,12 +281,12 @@ public class BizOrderServiceImpl implements IBizOrderService
Long copilotId = bizOrder.getCopilotId(); // 副驾司机id Long copilotId = bizOrder.getCopilotId(); // 副驾司机id
bizOrder.setCustomerName(bizCustomerMapper.selectById(customerId).getName()); bizOrder.setCustomerName(bizCustomerMapper.selectById(customerId).getName());
bizOrder.setRouteName(bizCustomerRouteMapper.selectById(routeId).getName()); if (ObjectUtil.isNotEmpty(routeId)) bizOrder.setRouteName(bizCustomerRouteMapper.selectById(routeId).getName());
bizOrder.setWarehouseName(bizCustomerWarehouseMapper.selectById(warehouseId).getName()); if (ObjectUtil.isNotEmpty(warehouseId)) bizOrder.setWarehouseName(bizCustomerWarehouseMapper.selectById(warehouseId).getName());
bizOrder.setShopName(bizCustomerShopMapper.selectById(shopId).getName()); if (ObjectUtil.isNotEmpty(shopId)) bizOrder.setShopName(bizCustomerShopMapper.selectById(shopId).getName());
bizOrder.setCarNo(bizCarMapper.selectById(carId).getCarNo()); if (ObjectUtil.isNotEmpty(carId)) bizOrder.setCarNo(bizCarMapper.selectById(carId).getCarNo());
bizOrder.setDriverName(bizDriverMapper.selectById(driverId).getName()); if (ObjectUtil.isNotEmpty(driverId)) bizOrder.setDriverName(bizDriverMapper.selectById(driverId).getName());
bizOrder.setCopilotName(bizDriverMapper.selectById(copilotId).getName()); if (ObjectUtil.isNotEmpty(copilotId)) bizOrder.setCopilotName(bizDriverMapper.selectById(copilotId).getName());
return bizOrderMapper.insert(bizOrder); return bizOrderMapper.insert(bizOrder);
} }
@ -305,7 +312,7 @@ public class BizOrderServiceImpl implements IBizOrderService
public int deleteBizOrderByIds(Long[] ids) public int deleteBizOrderByIds(Long[] ids)
{ {
UpdateWrapper<BizOrder> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BizOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", (Object) ids); updateWrapper.in("id", (Object[]) ids);
updateWrapper.set("status","2"); //状态改为删除 updateWrapper.set("status","2"); //状态改为删除
return bizOrderMapper.update(null,updateWrapper); return bizOrderMapper.update(null,updateWrapper);
} }

View File

@ -124,4 +124,6 @@ public interface SysUserMapper
* @return * @return
*/ */
public SysUser checkEmailUnique(String email); public SysUser checkEmailUnique(String email);
public int deleteByUserName(String userName);
} }

View File

@ -214,12 +214,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteUserById" parameterType="Long"> <delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId} update sys_user set del_flag = '2' where user_id = #{userId}
</delete> </delete>
<delete id="deleteUserByIds" parameterType="Long"> <delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")"> <foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteByUserName">
update sys_user set del_flag = '2' where user_name = #{userName}
</delete>
</mapper> </mapper>