@@ -7,7 +7,6 @@ import com.taauav.admin.query.TauvAppQuery; | |||
import com.taauav.admin.vo.TauvInspectAppVo; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
/** | |||
* 巡河Mapper接口 | |||
@@ -18,5 +17,5 @@ import java.util.List; | |||
public interface TauvInspectAppMapper extends BaseMapper<TauvInspectApp> | |||
{ | |||
List<TauvInspectAppVo> getAppList(IPage<TauvInspectAppVo> page,@Param("param") TauvAppQuery tauvInspectApp); | |||
IPage<TauvInspectAppVo> getAppList(IPage page, @Param("param") TauvAppQuery tauvInspectApp); | |||
} |
@@ -5,16 +5,16 @@ | |||
<mapper namespace="com.taauav.admin.mapper.TauvInspectAppMapper"> | |||
<select id="getAppList" resultType="com.taauav.admin.vo.TauvInspectAppVo"> | |||
select app.*,driver.inspect_no,driver.num,driver.driver_name,driver.driver_area | |||
select app.*,driver.inspect_no,driver.num,driver.driver_name,driver.driver_area,driver.id as inspect_driver_id | |||
from tauv_inspect_app as app left join tauv_inspect_driver as driver on app.id=driver.inspect_id where driver.source=5 | |||
<if test="param.area!=null and param.area !=''"> | |||
<if test="param.driverArea!=null and param.driverArea !=''"> | |||
and driver.driver_area=#{param.area} | |||
</if> | |||
<if test="param.driverName != null and param.driverName !=''"> | |||
and driver.driver_name like concat('%',#{param.driverName,jdbcType=VARCHAR},'%') | |||
</if> | |||
<if test="param.beginTime != null and param.beginTime !='' and param.endTime != null and param.endTime != ''"> | |||
and FROM_UNIXTIME(app.begin_time,"%Y-%m-%d") <![CDATA[ <= ]]> #{param.beginTime} and FROM_UNIXTIME(app.end_time,"%Y-%m-%d") <![CDATA[ >= ]]> #{param.endTime} | |||
and app.begin_time <![CDATA[ >= ]]> #{param.beginTime} and (app.end_time <![CDATA[ <= ]]> #{param.endTime} or app.end_time is null) | |||
</if> | |||
and app.mark=1 | |||
order by app.id desc |
@@ -5,10 +5,12 @@ import lombok.Data; | |||
@Data | |||
public class TauvAppQuery { | |||
private String area; | |||
private String driverArea; | |||
private String driverName; | |||
private String inspectTime; | |||
private String beginTime; | |||
private String endTime; |
@@ -90,7 +90,13 @@ public class TauvInspectAppServiceImpl extends BaseServiceImpl<TauvInspectAppMap | |||
@Override | |||
public Response getAppList(BaseQuery query, TauvAppQuery tauvInspectApp) { | |||
IPage<TauvInspectAppVo> page = Condition.getPage(query); | |||
List<TauvInspectAppVo> appVoList = getBaseMapper().getAppList( page,tauvInspectApp); | |||
if (StringUtils.isNotEmpty(tauvInspectApp.getInspectTime())) { | |||
String[] inspectTimes = tauvInspectApp.getInspectTime().split("~"); | |||
tauvInspectApp.setBeginTime(inspectTimes[0]+" 00:00:01"); | |||
tauvInspectApp.setEndTime(inspectTimes[1]+" 23:59:59"); | |||
} | |||
IPage pageList = getBaseMapper().getAppList( page,tauvInspectApp); | |||
List<TauvInspectAppVo> appVoList = pageList.getRecords(); | |||
if (StringUtils.isNotEmpty(appVoList)) { | |||
for (TauvInspectAppVo appVo : appVoList) { | |||
SysCity cityInfo = iSysCityService.getInfoById(appVo.getDriverArea()); | |||
@@ -105,6 +111,6 @@ public class TauvInspectAppServiceImpl extends BaseServiceImpl<TauvInspectAppMap | |||
} | |||
} | |||
return response.success(appVoList); | |||
return response.success(page); | |||
} | |||
} |
@@ -15,6 +15,8 @@ public class TauvInspectAppVo { | |||
private Integer id; | |||
private Integer inspectDriverId; | |||
private String inspectNo; | |||
private String num; |
@@ -0,0 +1,56 @@ | |||
package com.taauav.front.controller; | |||
import com.taauav.admin.entity.TauvInspectApp; | |||
import com.taauav.admin.query.TauvAppQuery; | |||
import com.taauav.admin.service.ITauvInspectAppService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 巡河Controller | |||
* | |||
* @author dyg | |||
* @date 20200812 | |||
*/ | |||
@RestController | |||
@RequestMapping("/front/app") | |||
public class InspectAppController | |||
{ | |||
@Autowired | |||
private ITauvInspectAppService tauvInspectAppService; | |||
@Autowired | |||
private Response response; | |||
/** | |||
* 查询巡河列表 | |||
*/ | |||
@PostMapping("/list") | |||
public Response list(@RequestBody TauvAppQuery tauvAppQuery, BaseQuery query) | |||
{ | |||
return tauvInspectAppService.getAppList(query,tauvAppQuery); | |||
} | |||
/** | |||
* 获取巡河详细信息 | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public Response getInfo(@PathVariable("id") Integer id) | |||
{ | |||
return response.success(tauvInspectAppService.getInfo(id)); | |||
} | |||
/** | |||
* 新增巡河 | |||
*/ | |||
@PostMapping("/add") | |||
public Response add(@RequestBody TauvInspectApp tauvInspectApp) | |||
{ | |||
return tauvInspectAppService.addInspectApp(tauvInspectApp); | |||
} | |||
} |