Commit 500ba214 authored by 耿迪迪's avatar 耿迪迪

值班人员接口返回手机号及搜索查询修改

parent 91fd1658
......@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.vo.TUserLocationVo;
import com.zehong.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -62,7 +63,8 @@ public class TUserLocationController extends BaseController
*/
@GetMapping("/getInspectorLocations")
public AjaxResult getInspectorLocations(TUserLocationVo tUserLocationVo){
if(null == tUserLocationVo.getUserId()){
//巡检人员初始化
if(null == tUserLocationVo.getUserId() && StringUtils.isEmpty(tUserLocationVo.getUserName())){
List<SysUser> inspectors = userService.selectInspectorList();
List<TUserLocation> inspectorLocations = new ArrayList<>();
Map<String,Object> map = new HashMap<>(16);
......@@ -73,11 +75,18 @@ public class TUserLocationController extends BaseController
}
return AjaxResult.success(inspectorLocations);
}
//查询巡检人员路线
if(StringUtils.isEmpty(tUserLocationVo.getUserName())){
Map<String,Object> map = new HashMap<>(16);
map.put("userId",tUserLocationVo.getUserId());
map.put("beginTime",tUserLocationVo.getBeginTime());
map.put("endTime",tUserLocationVo.getEndTime());
return AjaxResult.success(tUserLocationService.selectTUserLocationListByMap(map));
}
//搜索
Map<String,Object> map = new HashMap<>(16);
map.put("userId",tUserLocationVo.getUserId());
map.put("beginTime",tUserLocationVo.getBeginTime());
map.put("endTime",tUserLocationVo.getEndTime());
map.put("userName",tUserLocationVo.getUserName());
map.put("initInspectors","initInspectors");
return AjaxResult.success(tUserLocationService.selectTUserLocationListByMap(map));
}
......
......@@ -33,6 +33,8 @@ public class TUserLocation extends BaseEntity
private String userName;
private String phonenumber;
public String getUserName() {
return userName;
}
......@@ -41,6 +43,14 @@ public class TUserLocation extends BaseEntity
this.userName = userName;
}
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public void setLocationId(Long locationId)
{
this.locationId = locationId;
......
......@@ -19,6 +19,16 @@ public class TUserLocationVo {
*/
private Date endTime;
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getUserId() {
return userId;
}
......
......@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTUserLocationVo">
select location.location_id, location.user_id, location.longitude, location.latitude, location.create_time,(SELECT sysU.user_name FROM sys_user sysU WHERE sysU.user_id = location.user_id) AS userName from t_user_location location
select location.location_id, location.user_id, location.longitude, location.latitude, location.create_time,(SELECT sysU.user_name FROM sys_user sysU WHERE sysU.user_id = location.user_id) AS userName,(SELECT sysU.phonenumber FROM sys_user sysU WHERE sysU.user_id = location.user_id) AS phonenumber from t_user_location location
</sql>
<select id="selectTUserLocationList" parameterType="TUserLocation" resultMap="TUserLocationResult">
......@@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="beginTime != null and endTime != null"> and create_time BETWEEN #{beginTime} AND #{endTime}</if>
</where>
<if test="userName !=null and userName != ''">HAVING userName LIKE concat('%', #{userName}, '%')</if>
ORDER BY create_time DESC
<if test="initInspectors == 'initInspectors'">
LIMIT 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment