2020-08-14 09:59:01.928 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler' | 2020-08-14 09:59:01.928 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler' | ||||
2020-08-14 09:59:02.172 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed | 2020-08-14 09:59:02.172 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed | ||||
2020-08-14 15:08:02.429 [http-nio-8012-exec-2] INFO o.a.s.s.m.AbstractValidatingSessionManager - [enableSessionValidation,233] - Enabling session validation scheduler... |
package com.taauav.api.controller; | |||||
import com.taauav.api.query.DriverQuery; | |||||
import com.taauav.api.service.IDriverService; | |||||
import com.taauav.common.bean.Response; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestBody; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import com.taauav.api.controller.ApiBaseController; | |||||
/** | |||||
* <p> | |||||
* 河道管理表 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author zongjl | |||||
* @since 2020-08-14 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/user/driver") | |||||
public class DriverController extends ApiBaseController { | |||||
@Autowired | |||||
private IDriverService driverService; | |||||
/** | |||||
* 根据数据权限获取河湖列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getDriverList") | |||||
public Response getDriverList(@RequestBody DriverQuery query) { | |||||
return driverService.getDriverList(query); | |||||
} | |||||
} |
return inspectQuestionService.createQuestion(inspectQuestionDto); | return inspectQuestionService.createQuestion(inspectQuestionDto); | ||||
} | } | ||||
/** | |||||
* 获取问题类型列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getQuestionOptionsList") | |||||
public Response getQuestionOptionsList() { | |||||
return inspectQuestionService.getQuestionOptionsList(); | |||||
} | |||||
} | } |
package com.taauav.api.mapper; | |||||
import com.taauav.admin.entity.TauvDriver; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* 河道管理表 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author zongjl | |||||
* @since 2020-08-14 | |||||
*/ | |||||
public interface DriverMapper extends BaseMapper<TauvDriver> { | |||||
} |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.taauav.api.mapper.DriverMapper"> | |||||
</mapper> |
package com.taauav.api.query; | |||||
import com.taauav.common.core.mps.BaseQuery; | |||||
import lombok.Data; | |||||
@Data | |||||
public class DriverQuery extends BaseQuery { | |||||
} |
package com.taauav.api.service; | |||||
import com.taauav.admin.entity.TauvDriver; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.taauav.api.query.DriverQuery; | |||||
import com.taauav.common.bean.Response; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 河道管理表 服务类 | |||||
* </p> | |||||
* | |||||
* @author zongjl | |||||
* @since 2020-08-14 | |||||
*/ | |||||
public interface IDriverService extends IService<TauvDriver> { | |||||
/** | |||||
* 获取河湖列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
Response getDriverList(DriverQuery query); | |||||
} |
*/ | */ | ||||
Response createQuestion(InspectQuestionDto inspectQuestionDto) throws IOException; | Response createQuestion(InspectQuestionDto inspectQuestionDto) throws IOException; | ||||
/** | |||||
* 获取问题类型列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
Response getQuestionOptionsList(); | |||||
} | } |
package com.taauav.api.service.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.taauav.admin.entity.TauvDriver; | |||||
import com.taauav.api.mapper.DriverMapper; | |||||
import com.taauav.api.query.DriverQuery; | |||||
import com.taauav.api.service.IDriverService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.util.ShiroUtils; | |||||
import com.taauav.front.service.IUserAuthGroupService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.util.StringUtils; | |||||
import java.math.BigInteger; | |||||
import java.sql.DriverManager; | |||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
/** | |||||
* <p> | |||||
* 河道管理表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author zongjl | |||||
* @since 2020-08-14 | |||||
*/ | |||||
@Service | |||||
public class DriverServiceImpl extends ServiceImpl<DriverMapper, TauvDriver> implements IDriverService { | |||||
@Autowired | |||||
private DriverMapper driverMapper; | |||||
@Autowired | |||||
private IUserAuthGroupService userAuthGroupService; | |||||
@Autowired | |||||
private Response response; | |||||
/** | |||||
* 获取河湖列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response getDriverList(DriverQuery query) { | |||||
// 数据权限 | |||||
List<BigInteger> driverAreaList = userAuthGroupService.getDriverAreaList(1); | |||||
BigInteger[] driverArea = driverAreaList.toArray(new BigInteger[driverAreaList.size()]); | |||||
// 查询条件 | |||||
QueryWrapper<TauvDriver> queryWrapper = new QueryWrapper<>(); | |||||
queryWrapper.in("driver_area", driverArea); | |||||
queryWrapper.eq("status", 1); | |||||
queryWrapper.eq("mark", 1); | |||||
IPage<TauvDriver> page = new Page<>(query.getPage(), query.getPageSize()); | |||||
IPage<TauvDriver> data = driverMapper.selectPage(page, queryWrapper); | |||||
List<TauvDriver> driverList = data.getRecords(); | |||||
// 返回结果 | |||||
Map<String, Object> result = new HashMap<>(); | |||||
result.put("total", data.getTotal()); | |||||
result.put("size", data.getSize()); | |||||
result.put("current", data.getCurrent()); | |||||
result.put("pages", data.getPages()); | |||||
result.put("records", driverList); | |||||
return response.success(result); | |||||
} | |||||
} |
package com.taauav.api.service.impl; | package com.taauav.api.service.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.taauav.admin.entity.*; | import com.taauav.admin.entity.*; | ||||
list.add(map); | list.add(map); | ||||
return list; | return list; | ||||
} | } | ||||
/** | |||||
* 获取问题类型列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response getQuestionOptionsList() { | |||||
QueryWrapper<TauvQuestionOptions> queryWrapper = new QueryWrapper<>(); | |||||
queryWrapper.eq("status", 1); | |||||
queryWrapper.eq("mark", 1); | |||||
queryWrapper.orderByAsc("sort"); | |||||
List<TauvQuestionOptions> optionsList = questionOptionsMapper.selectList(queryWrapper); | |||||
return response.success(optionsList); | |||||
} | |||||
} | } |