提交代码

This commit is contained in:
keivn 2021-12-12 09:12:39 +08:00
parent 009beeb89c
commit 9a12f02fa3
24 changed files with 585 additions and 20 deletions

View File

@ -0,0 +1,49 @@
package com.ruoyi.carpool.controller;
import com.ruoyi.carpool.domain.CommonVO;
import com.ruoyi.carpool.service.IPCommonService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/carpool/common")
public class PCommonController {
@Autowired
private IPCommonService ipCommonService;
/**
* 乘客或者司机关闭订单
* @param commonVO
* @return
*/
@PostMapping(value = "/cancelOrder")
public AjaxResult getDriverInfo(@RequestBody CommonVO commonVO)
{
return ipCommonService.cancelOrder(commonVO);
}
/**
* 乘客申请加入拼单
* @param commonVO
* @return
*/
@PostMapping(value = "/joinOrderList")
public AjaxResult joinOrderList(@RequestBody CommonVO commonVO)
{
return ipCommonService.joinOrderList(commonVO);
}
}

View File

@ -72,6 +72,17 @@ public class PDriverController extends BaseController
return AjaxResult.success(pDriverService.selectPDriverById(id));
}
/**
* 获取司机信息详细信息
*/
@PreAuthorize("@ss.hasPermi('carpool:driver:query')")
@PostMapping(value = "/queryUserInfo")
public AjaxResult getDriverInfo(@RequestBody PDriver pDriver)
{
return AjaxResult.success(pDriverService.getDriverInfo(pDriver));
}
/**
* 新增司机信息
*/
@ -80,10 +91,22 @@ public class PDriverController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody PDriver pDriver)
{
pDriver.setDriverId(IdUtils.randomUUID());
return toAjax(pDriverService.insertPDriver(pDriver));
}
/**
* 通过审核
* @param pDriver
* @return
*/
@PostMapping("/agree")
public AjaxResult agree(@RequestBody PDriver pDriver)
{
return toAjax(pDriverService.agreePDriver(pDriver));
}
/**
* 修改司机信息
*/

View File

@ -79,8 +79,6 @@ public class POrderController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody POrder pOrder)
{
String orderNum = DateUtils.dateTimeNow();
pOrder.setOrderNum("carpool_"+orderNum);
return toAjax(pOrderService.insertPOrder(pOrder));
}
/**

View File

@ -6,14 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -79,7 +72,7 @@ public class PPassengerController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody PPassenger pPassenger)
{
pPassenger.setCustId(IdUtils.randomUUID());
pPassenger.setCustId("passenger_"+IdUtils.randomUUID());
return toAjax(pPassengerService.insertPPassenger(pPassenger));
}
@ -104,4 +97,17 @@ public class PPassengerController extends BaseController
{
return toAjax(pPassengerService.deletePPassengerByIds(ids));
}
/**
* 获取乘客信息详细信息
*/
@PreAuthorize("@ss.hasPermi('carpool:passenger:query')")
@PostMapping(value = "/queryUserInfo")
public AjaxResult queryUserInfo(@RequestBody PPassenger pPassenger)
{
return AjaxResult.success(pPassengerService.queryUserInfo(pPassenger));
}
}

View File

@ -0,0 +1,57 @@
package com.ruoyi.carpool.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class CommonVO {
/**
* 订单流水号
*/
private String orderNum ;
/**
* 平台用户唯一ID
*/
private String userID;
/**
* 申请拼单的人数
*/
private Integer num;
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("orderNum", getOrderNum())
.append("userID", getUserID())
.append("num", getNum())
.toString();
}
}

View File

@ -58,6 +58,10 @@ public class PDriver extends BaseEntity
@Excel(name = "是否黑名单用户0否1是")
private String isBlacklist;
/** 当前状态 */
@Excel(name = "用户当前的状态0审核中1审核通过2禁用")
private Integer state ;
public void setId(Long id)
{
this.id = id;
@ -158,6 +162,14 @@ public class PDriver extends BaseEntity
return isBlacklist;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -174,6 +186,7 @@ public class PDriver extends BaseEntity
.append("isBlacklist", getIsBlacklist())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("state", getState())
.toString();
}
}

View File

@ -45,6 +45,10 @@ public class PPassenger extends BaseEntity
@Excel(name = "性别1男性0女性")
private String sex;
/** 身份证号码 */
@Excel(name = "身份证号码")
private String idCard;
/** 生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
@ -174,6 +178,14 @@ public class PPassenger extends BaseEntity
this.age = age;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -191,6 +203,7 @@ public class PPassenger extends BaseEntity
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("age", getAge())
.append("idCard", getIdCard())
.toString();
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.carpool.mapper;
import com.ruoyi.carpool.domain.CommonVO;
import com.ruoyi.carpool.domain.PDriver;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public interface PCommonMapper {
/**
* 查询订单是有司机接单
* @param orderNum
* @return
*/
public String queryIsTake(String orderNum);
/**
* 查询乘客下单的状态
* @param commonVO
* @return
*/
public Map queryOrderMemberState(CommonVO commonVO);
/**
* 乘客取消订单
* @param commonVO
* @return
*/
public int updateOrderMenber(CommonVO commonVO);
/**
* 查询订单乘客详情
* @param orderNum
* @return
*/
public int queryOrderMemberCount(String orderNum);
/**
* 司机取消订单-取消拼单
* @param orderNum
* @return
*/
public int updateOrderState(String orderNum);
/**
* 司机取消订单-取消拼单
* @param orderNum
* @return
*/
public int updateOrderIsTake(String orderNum);
/**
* 添加一条拼单记录
* @param orderNum
* @return
*/
public int insertOrderMemberInfo(Map<String,Object> orderMember);
}

View File

@ -58,4 +58,21 @@ public interface PDriverMapper
* @return 结果
*/
public int deletePDriverByIds(Long[] ids);
/**
* 通过电话号码和用户名查询司机的详情
* @param pDriver
* @return
*/
public PDriver getDriverInfo(PDriver pDriver);
/**
* 修改司机信息
*
* @param pDriver 司机信息
* @return 结果
*/
public int agreePDriver(PDriver pDriver);
}

View File

@ -66,4 +66,21 @@ public interface POrderMapper
* @return 结果
*/
public int takeOrderById (POrder pOrder);
/**
* 通过orderNum查询订单信息
* @param orderNum
* @return
*/
public POrder selectPOrderByOrderNum(String orderNum);
/**
* 更新订单当前的人数
* @param pOrder
* @return
*/
public int updateOrderMemberNum(POrder pOrder);
}

View File

@ -58,4 +58,11 @@ public interface PPassengerMapper
* @return 结果
*/
public int deletePPassengerByIds(Long[] ids);
/**
* 查询乘客详情
* @param pPassenger
* @return
*/
public PPassenger queryUserInfo(PPassenger pPassenger);
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.carpool.service;
import com.ruoyi.carpool.domain.CommonVO;
import com.ruoyi.common.core.domain.AjaxResult;
public interface IPCommonService {
/**
* 取消订单
* @param orderNum
* @return
*/
public AjaxResult cancelOrder(CommonVO commonVO);
/**
* 审查拼单
* @param commonVO
* @return
*/
public AjaxResult joinOrderList(CommonVO commonVO);
}

View File

@ -58,4 +58,20 @@ public interface IPDriverService
* @return 结果
*/
public int deletePDriverById(Long id);
/**
* 查询司机信息
* @return 司机信息
*/
public PDriver getDriverInfo(PDriver pDriver);
/**
* 同意审核
* @param pDriver
* @return
*/
public int agreePDriver(PDriver pDriver);
}

View File

@ -58,4 +58,12 @@ public interface IPPassengerService
* @return 结果
*/
public int deletePPassengerById(Long id);
/**
* 查询乘客详细信息
* @param pPassenger
* @return
*/
public PPassenger queryUserInfo(PPassenger pPassenger);
}

View File

@ -0,0 +1,104 @@
package com.ruoyi.carpool.service.impl;
import com.ruoyi.carpool.domain.CommonVO;
import com.ruoyi.carpool.domain.POrder;
import com.ruoyi.carpool.mapper.PCommonMapper;
import com.ruoyi.carpool.mapper.PDriverMapper;
import com.ruoyi.carpool.mapper.POrderMapper;
import com.ruoyi.carpool.service.IPCommonService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import jdk.nashorn.api.scripting.AbstractJSObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class IPCommonServiceImpl implements IPCommonService {
private static Logger logger = LoggerFactory.getLogger(IPCommonServiceImpl.class);
@Autowired
private PCommonMapper pCommonMapper;
@Autowired
private POrderMapper pOrderMapper;
@Override
public AjaxResult cancelOrder(CommonVO commonVO) {
String orderNum = commonVO.getOrderNum();
String userId = commonVO.getUserID();
if (StringUtils.isEmpty(orderNum) && StringUtils.isEmpty(userId) ){
return AjaxResult.error("请求参数错误!");
}
/*乘客取消订单*/
if(userId.contains("passenger_")){
/*是否接单1已接单0未接单*/
String state = pCommonMapper.queryIsTake(orderNum);
if("1".equals(state)){
logger.info("订单:" + orderNum+" 已经有司机接单,请联系司机。");
return AjaxResult.error("订单已经有司机接单,请联系司机。");
}else {
/*校验是否可以取消*/
Map<String , Integer> info = pCommonMapper.queryOrderMemberState(commonVO);
if(info.isEmpty() && info.get("state") == 0){
/*查询订单详情*/
POrder pOrder = pOrderMapper.selectPOrderByOrderNum(orderNum);
Integer currnt = pOrder.getMember()-info.get("num");
pOrder.setMember(currnt);
/*更新当前人数表*/
pOrderMapper.updateOrderMemberNum(pOrder);
/*更新订单成员信息表*/
pCommonMapper.updateOrderMenber(commonVO);
return AjaxResult.success();
}
return AjaxResult.error();
}
}
/*司机取消订单*/
if(userId.contains("driver_")){
Integer count = pCommonMapper.queryOrderMemberCount(orderNum);
if( count > 0 ){
logger.info("订单:" + orderNum+" 已经有乘客,请联系乘客。");
pCommonMapper.updateOrderIsTake(orderNum);
return AjaxResult.success("订单已经取消,请及时联系乘客。");
}else {
pCommonMapper.updateOrderState(orderNum);
return AjaxResult.success();
}
}
return AjaxResult.error();
}
@Override
public AjaxResult joinOrderList(CommonVO commonVO) {
String orderNum = commonVO.getOrderNum();
String userId = commonVO.getUserID();
Integer num = commonVO.getNum();
if (StringUtils.isEmpty(orderNum) && StringUtils.isEmpty(userId) ){
return AjaxResult.error("请求参数错误!");
}
Integer count = pCommonMapper.queryOrderMemberCount(orderNum);
Integer menberNum = count + num;
if(menberNum >= 4){
return AjaxResult.error("订单人数大于4人");
}
Map<String , Object> data = new HashMap<>();
data.put("orderNum",orderNum);
data.put("custId" ,userId);
data.put("num" ,num);
data.put("state" ,0);
data.put("createTime" , DateUtils.dateTimeNow());
pCommonMapper.insertOrderMemberInfo(data);
return AjaxResult.success();
}
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.carpool.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.carpool.mapper.PDriverMapper;
@ -54,6 +56,9 @@ public class PDriverServiceImpl implements IPDriverService
public int insertPDriver(PDriver pDriver)
{
pDriver.setCreateTime(DateUtils.getNowDate());
pDriver.setDriverId("driver_"+ IdUtils.randomUUID());
pDriver.setState(0);
pDriver.setIsBlacklist("0");
return pDriverMapper.insertPDriver(pDriver);
}
@ -93,4 +98,14 @@ public class PDriverServiceImpl implements IPDriverService
{
return pDriverMapper.deletePDriverById(id);
}
@Override
public PDriver getDriverInfo(PDriver pDriver) {
return pDriverMapper.getDriverInfo(pDriver);
}
@Override
public int agreePDriver(PDriver pDriver) {
return pDriverMapper.agreePDriver(pDriver);
}
}

View File

@ -53,6 +53,11 @@ public class POrderServiceImpl implements IPOrderService
@Override
public int insertPOrder(POrder pOrder)
{
String orderNum = DateUtils.dateTimeNow();
pOrder.setOrderNum("carpool_"+orderNum);
pOrder.setIsTake("0");
pOrder.setState("0");
pOrder.setMember(0);
pOrder.setCreateTime(DateUtils.getNowDate());
return pOrderMapper.insertPOrder(pOrder);
}

View File

@ -93,4 +93,9 @@ public class PPassengerServiceImpl implements IPPassengerService
{
return pPassengerMapper.deletePPassengerById(id);
}
@Override
public PPassenger queryUserInfo(PPassenger pPassenger) {
return pPassengerMapper.queryUserInfo(pPassenger);
}
}

View File

@ -0,0 +1,55 @@
<?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.ruoyi.carpool.mapper.PCommonMapper">
<select id="queryIsTake" parameterType="String" resultType="String">
SELECT is_take FROM p_order WHERE order_num = #{orderNum}
</select>
<select id="queryOrderMemberState" parameterType="CommonVO" resultType="hashmap" >
SELECT state,num FROM p_order_member WHERE order_num = #{orderNum} AND cust_id = #{userID}
</select>
<update id="updateOrderMenber" parameterType="CommonVO" >
UPDATE p_order_member SET state = 1 WHERE order_num = #{orderNum} AND cust_id = #{userID}
</update>
<select id="queryOrderMemberCount" parameterType="String" resultType="integer" >
SELECT COUNT(1) as count FROM p_order_member WHERE order_num = #{orderNum} AND state = 0
</select>
<update id="updateOrderState" parameterType="String" >
UPDATE p_order SET state = '2' WHERE order_num = #{orderNum}
</update>
<update id="updateOrderIsTake" parameterType="String" >
UPDATE p_order SET is_take = '0' , driver_id = '' WHERE order_num = #{orderNum}
</update>
<insert id="insertOrderMemberInfo" parameterType="hashmap" >
insert into p_order_member
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNum != null">order_num,</if>
<if test="custId != null">cust_id,</if>
<if test="num != null">num,</if>
<if test="state != null">state,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNum != null">#{orderNum},</if>
<if test="custId != null">#{custId},</if>
<if test="num != null">#{num},</if>
<if test="state != null">#{state},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
</mapper>

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sex" column="sex" />
<result property="idCard" column="id_card" />
<result property="age" column="age" />
<result property="state" column="state" />
<result property="phone" column="phone" />
<result property="city" column="city" />
<result property="province" column="province" />
@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPDriverVo">
select id, driver_id, name, sex, id_card, age, phone, city, province, country, is_blacklist, create_time, update_time from p_driver
select id, driver_id, name, sex, id_card, age, phone, city,state, province, country, is_blacklist, create_time, update_time from p_driver
</sql>
<select id="selectPDriverList" parameterType="PDriver" resultMap="PDriverResult">
@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="driverId != null and driverId != ''"> and driver_id = #{driverId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="state != null "> and state = #{state}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="age != null "> and age = #{age}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
@ -54,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sex != null">sex,</if>
<if test="idCard != null">id_card,</if>
<if test="age != null">age,</if>
<if test="state != null">state,</if>
<if test="phone != null">phone,</if>
<if test="city != null">city,</if>
<if test="province != null">province,</if>
@ -67,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="driverId != null">#{driverId},</if>
<if test="name != null">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="state != null">#{state},</if>
<if test="idCard != null">#{idCard},</if>
<if test="age != null">#{age},</if>
<if test="phone != null">#{phone},</if>
@ -85,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="driverId != null">driver_id = #{driverId},</if>
<if test="name != null">name = #{name},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="state != null">state = #{state},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="age != null">age = #{age},</if>
<if test="phone != null">phone = #{phone},</if>
@ -108,4 +113,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getDriverInfo" parameterType="PDriver" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
<where>
<if test="driverId != null and driverId != ''"> and driver_id = #{driverId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="state != null "> and state = #{state}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="age != null "> and age = #{age}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="country != null and country != ''"> and country = #{country}</if>
<if test="isBlacklist != null "> and is_blacklist = #{isBlacklist}</if>
</where>
</select>
<update id="agreePDriver" parameterType="PDriver">
update p_driver SET state = 1 where driver_id = #{driverId}
</update>
</mapper>

View File

@ -70,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="departureTime != null">departure_time,</if>
<if test="member != null">member,</if>
<if test="state != null">state,</if>
<if test="isTake != null ">is_take,</if>
<if test="isdelete != null">isDelete,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
@ -83,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="departureTime != null">#{departureTime},</if>
<if test="member != null">#{member},</if>
<if test="state != null">#{state},</if>
<if test="isTake != null ">#{isTake},</if>
<if test="isdelete != null">#{isdelete},</if>
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
@ -91,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updatePOrder" parameterType="POrder">
<update id="updatePOrder" parameterType="POrder" >
update p_order
<trim prefix="SET" suffixOverrides=",">
<if test="orderNum != null">order_num = #{orderNum},</if>
@ -127,7 +129,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isTake != null">is_take = #{isTake},</if>
<if test="driverId != null">driver_id = #{driverId},</if>
</trim>
where orderNum = #{orderNum}
where order_num = #{orderNum}
</update>
<select id="selectPOrderByOrderNum" parameterType="String" resultMap="POrderResult">
<include refid="selectPOrderVo"/>
where order_num = #{orderNum}
</select>
<update id="updateOrderMemberNum" parameterType="POrder" >
update p_order set member = #{member} where order_num = #{orderNum}
</update>
</mapper>

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="openId" column="open_id" />
<result property="custPhone" column="cust_phone" />
<result property="sex" column="sex" />
<result property="idCard" column="id_card" />
<result property="age" column="age" />
<result property="birthday" column="birthday" />
<result property="city" column="city" />
@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPPassengerVo">
select id, cust_id, cust_name, nick_name, open_id, cust_phone, sex, birthday, city, province, is_blacklist, create_time, update_time from p_passenger
select id, cust_id, cust_name, nick_name, open_id, cust_phone, sex, id_card, birthday, city, province, is_blacklist, create_time, update_time from p_passenger
</sql>
<select id="selectPPassengerList" parameterType="PPassenger" resultMap="PPassengerResult">
@ -34,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openId != null and openId != ''"> and open_id = #{openId}</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="idCard != null and idCard != '' "> and id_card = #{idCard}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
@ -56,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openId != null">open_id,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="sex != null">sex,</if>
<if test="idCard != null "> and id_card = #{idCard}</if>
<if test="birthday != null">birthday,</if>
<if test="city != null">city,</if>
<if test="province != null">province,</if>
@ -71,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openId != null">#{openId},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="sex != null">#{sex},</if>
<if test="idCard != null "> and id_card = #{idCard}</if>
<if test="birthday != null">#{birthday},</if>
<if test="city != null">#{city},</if>
<if test="province != null">#{province},</if>
@ -89,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openId != null">open_id = #{openId},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="idCard != null "> and id_card = #{idCard}</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="city != null">city = #{city},</if>
<if test="province != null">province = #{province},</if>
@ -109,4 +114,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="queryUserInfo" parameterType="PPassenger" resultMap="PPassengerResult">
<include refid="selectPPassengerVo"/>
<where>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="openId != null and openId != ''"> and open_id = #{openId}</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="idCard != null and idCard != '' "> and id_card = #{idCard}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="isBlacklist != null "> and is_blacklist = #{isBlacklist}</if>
</where>
</select>
</mapper>

View File

@ -45,8 +45,7 @@ public class SysLoginController
{
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}

View File

@ -69,8 +69,7 @@ public class SysLoginService
try
{
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager
.authenticate(new UsernamePasswordAuthenticationToken(username, password));
authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
}
catch (Exception e)
{