@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
@@ -62,4 +63,7 @@ public class Camera extends BaseEntity implements Serializable { | |||
* 备注 | |||
*/ | |||
private String remark; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
@@ -53,4 +54,7 @@ public class Goods extends BaseEntity implements Serializable { | |||
*/ | |||
private String goodsAction; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
@@ -48,4 +49,7 @@ public class Warehouse extends BaseEntity implements Serializable { | |||
*/ | |||
private String location; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -16,6 +16,7 @@ import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -36,6 +37,9 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
@@ -79,11 +83,13 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){ | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
@@ -100,7 +106,11 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp | |||
.eq(Camera::getMark, MarkTypeEnum.VALID.getCode()) | |||
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName()) | |||
.orderByDesc(Camera::getCreateTime)); | |||
for (Camera record : pageData.getRecords()) { | |||
User user = userMapper.selectById(record.getUpdateUser()); | |||
record.setUpdateUserName(user.getRealname()); | |||
} | |||
return JsonResult.success(pageData); | |||
} |
@@ -61,7 +61,9 @@ public class GoodsServiceImpl extends BaseServiceImpl<GoodsMapper, Goods> implem | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} |
@@ -73,11 +73,13 @@ public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Wareh | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if (StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())) { | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} |
@@ -24,13 +24,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</sql> | |||
<select id="getListByWarehouseId" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest" resultMap="GoodsResult"> | |||
<include refid="selectGoodsVo"/> | |||
select | |||
g.id, | |||
g.tenant_id, | |||
g.warehouse_id, | |||
g.goods_name, | |||
g.goods_type, | |||
g.goods_stock, | |||
g.goods_action, | |||
g.create_user, | |||
g.create_time, | |||
g.update_user, | |||
g.update_time, | |||
g.mark, | |||
u.realname AS updateUserName | |||
from th_goods g | |||
LEFT JOIN sys_user u ON g.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> | |||
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if> | |||
<if test="1 == 1"> and g.mark = 1 </if> | |||
<if test="tenantId != null "> and g.tenant_id = #{tenantId}</if> | |||
<if test="warehouseId != null "> and g.warehouse_id = #{warehouseId}</if> | |||
</where> | |||
order by create_time desc | |||
order by g.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="GoodsResult"> |
@@ -23,15 +23,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest" resultMap="WarehouseResult"> | |||
<include refid="selectWarehouseVo"/> | |||
SELECT | |||
w.id, | |||
w.tenant_id, | |||
w.warehouse_name, | |||
w.longitude, | |||
w.latitude, | |||
w.location, | |||
w.create_user, | |||
w.create_time, | |||
w.update_user, | |||
w.update_time, | |||
w.mark, | |||
u.realname AS updateUserName | |||
FROM | |||
th_warehouse w | |||
LEFT JOIN sys_user u ON w.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="request.tenantId != null and request.tenantId != 0"> and tenant_id = #{request.tenantId}</if> | |||
<if test="1 == 1"> and w.mark = 1 </if> | |||
<if test="request.tenantId != null and request.tenantId != 0"> and w.tenant_id = #{request.tenantId}</if> | |||
<if test="request.warehouseName != null and request.warehouseName != ''"> | |||
and warehouse_name like concat('%',#{request.warehouseName},'%') | |||
and w.warehouse_name like concat('%',#{request.warehouseName},'%') | |||
</if> | |||
</where> | |||
order by create_time desc | |||
order by w.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarehouseResult"> |