Browse Source

添加司机和车辆

loovi 1 year ago
parent
commit
7b3533062b

+ 191 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriver.java

@@ -0,0 +1,191 @@
+package com.pj.project.tb_driver;
+
+import java.io.Serializable;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_driver -- 司机
+ * @author loovi 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbDriver.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbDriver extends Model<TbDriver> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_driver";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-driver";
+	public static final String PERMISSION_CODE_ADD = "tb-driver-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-driver-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-driver-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 姓名 
+	 */
+	private String name;	
+
+	/**
+	 * 年龄 
+	 */
+	private Integer age;	
+
+	/**
+	 * 性别性别(1=男,2=女) 
+	 */
+	private String sex;	
+
+	/**
+	 * 手机号 
+	 */
+	private String phone;	
+
+	/**
+	 * 联系地址 
+	 */
+	private String address;	
+
+	/**
+	 * 银行卡号 
+	 */
+	private String bankCode;	
+
+	/**
+	 * 银行名称 
+	 */
+	private String bankName;	
+
+	/**
+	 * 身份证号 
+	 */
+	private String idCard;	
+
+	/**
+	 * 身份证照片 
+	 */
+	private String idCardImg;	
+
+	/**
+	 * 驾驶证号 
+	 */
+	private String drivingLicenseId;	
+
+	/**
+	 * 驾驶证照片 
+	 */
+	private String drivingLicenseImg;	
+
+	/**
+	 * 车辆行驶证号 
+	 */
+	private String vehicleDrivingId;	
+
+	/**
+	 * 车辆行驶证照片 
+	 */
+	private String vehicleDrivingImg;	
+
+	/**
+	 * 车辆前脸照 
+	 */
+	private String vehicleImg;	
+
+	/**
+	 * 注册时间 
+	 */
+	private String registerTime;	
+
+	/**
+	 * 是否被锁定 
+	 */
+	private String isLock;	
+
+	/**
+	 * 创建者id 
+	 */
+	private String createBy;	
+
+	/**
+	 * 创建者名称 
+	 */
+	private String createName;	
+
+	/**
+	 * 创建时间 
+	 */
+	private Date createTime;	
+
+	/**
+	 * 更新者id 
+	 */
+	private String updateBy;	
+
+	/**
+	 * 更新者名称 
+	 */
+	private String updateName;	
+
+	/**
+	 * 更新时间 
+	 */
+	private Date updateTime;	
+
+	/**
+	 * 删除状态 
+	 */
+	private String deleteStatus;	
+
+	/**
+	 * 审核状态(0=待审核,1=已通过,2=不通过) 
+	 */
+	private Integer auditStatus;	
+
+	/**
+	 * 审核人 
+	 */
+	private String auditBy;	
+
+	/**
+	 * 审核时间 
+	 */
+	private String auditTime;	
+
+	/**
+	 * 审核不通过原因 
+	 */
+	private String nopassReason;	
+
+
+
+
+
+	
+
+
+}

+ 88 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverController.java

@@ -0,0 +1,88 @@
+package com.pj.project.tb_driver;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_driver -- 司机
+ * @author loovi 
+ */
+@RestController
+@RequestMapping("/TbDriver/")
+public class TbDriverController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbDriverService tbDriverService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbDriver.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbDriver t){
+		tbDriverService.add(t);
+		t = tbDriverService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbDriver.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbDriverService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbDriver.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbDriver.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbDriver.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbDriver t){
+		tbDriverService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbDriver.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		TbDriver t = tbDriverService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(TbDriver.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		so.set("deleteStatus", 1);
+		List<TbDriver> list = tbDriverService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+
+	
+	
+	
+
+}

+ 30 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverMapper.java

@@ -0,0 +1,30 @@
+package com.pj.project.tb_driver;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_driver -- 司机
+ * @author loovi 
+ */
+
+@Mapper
+@Repository
+public interface TbDriverMapper extends BaseMapper <TbDriver> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbDriver> getList(SoMap so);
+
+
+}

+ 86 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverMapper.xml

@@ -0,0 +1,86 @@
+<?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.pj.project.tb_driver.TbDriverMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, name, age, sex, phone, address, bank_code, bank_name, id_card, id_card_img, driving_license_id, driving_license_img, vehicle_driving_id, vehicle_driving_img, vehicle_img, register_time, is_lock, create_by, create_name, create_time, update_by, update_name, update_time, delete_status, audit_status, audit_by, audit_time, nopass_reason from tb_driver  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.project.tb_driver.TbDriver"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_driver 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("name") '> and name = #{name} </if>
+			<if test=' this.has("age") '> and age = #{age} </if>
+			<if test=' this.has("sex") '> and sex = #{sex} </if>
+			<if test=' this.has("phone") '> and phone = #{phone} </if>
+			<if test=' this.has("address") '> and address = #{address} </if>
+			<if test=' this.has("bankCode") '> and bank_code = #{bankCode} </if>
+			<if test=' this.has("bankName") '> and bank_name = #{bankName} </if>
+			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>
+			<if test=' this.has("drivingLicenseId") '> and driving_license_id = #{drivingLicenseId} </if>
+			<if test=' this.has("vehicleDrivingId") '> and vehicle_driving_id = #{vehicleDrivingId} </if>
+			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>
+			<if test=' this.has("isLock") '> and is_lock = #{isLock} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
+			<if test=' this.has("auditStatus") '> and audit_status = #{auditStatus} </if>
+			<if test=' this.has("auditBy") '> and audit_by = #{auditBy} </if>
+			<if test=' this.has("auditTime") '> and audit_time = #{auditTime} </if>
+			<if test=' this.has("nopassReason") '> and nopass_reason = #{nopassReason} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> name desc </when>
+			<when test='sortType == 3'> age desc </when>
+			<when test='sortType == 4'> sex desc </when>
+			<when test='sortType == 5'> phone desc </when>
+			<when test='sortType == 6'> address desc </when>
+			<when test='sortType == 7'> bank_code desc </when>
+			<when test='sortType == 8'> bank_name desc </when>
+			<when test='sortType == 9'> id_card desc </when>
+			<when test='sortType == 10'> driving_license_id desc </when>
+			<when test='sortType == 11'> vehicle_driving_id desc </when>
+			<when test='sortType == 12'> register_time desc </when>
+			<when test='sortType == 13'> is_lock desc </when>
+			<when test='sortType == 14'> create_by desc </when>
+			<when test='sortType == 15'> create_name desc </when>
+			<when test='sortType == 16'> create_time desc </when>
+			<when test='sortType == 17'> update_by desc </when>
+			<when test='sortType == 18'> update_name desc </when>
+			<when test='sortType == 19'> update_time desc </when>
+			<when test='sortType == 20'> audit_status desc </when>
+			<when test='sortType == 21'> audit_by desc </when>
+			<when test='sortType == 22'> audit_time desc </when>
+			<when test='sortType == 23'> nopass_reason desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 51 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverService.java

@@ -0,0 +1,51 @@
+package com.pj.project.tb_driver;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_driver -- 司机
+ * @author loovi 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> implements IService<TbDriver>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbDriverMapper tbDriverMapper;
+
+	/** 增 */
+	void add(TbDriver t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbDriver t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbDriver getById(Long id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbDriver> getList(SoMap so) { 
+		return tbDriverMapper.getList(so);	
+	}
+	
+
+}

+ 98 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverUtil.java

@@ -0,0 +1,98 @@
+package com.pj.project.tb_driver;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.pj.utils.sg.*;
+import java.util.*;
+
+/**
+ * 工具类:tb_driver -- 司机
+ * @author loovi 
+ *
+ */
+@Component
+public class TbDriverUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbDriverMapper tbDriverMapper;
+	@Autowired
+	private void setTbDriverMapper(TbDriverMapper tbDriverMapper) {
+		TbDriverUtil.tbDriverMapper = tbDriverMapper;
+	}
+	
+	
+	/** 
+	 * 将一个 TbDriver 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G] 
+	 */
+	static void check(TbDriver t) {
+		AjaxError.throwByIsNull(t.getId(), "[主键] 不能为空");		// 验证: 主键 
+		AjaxError.throwByIsNull(t.getName(), "[姓名] 不能为空");		// 验证: 姓名 
+		AjaxError.throwByIsNull(t.getAge(), "[年龄] 不能为空");		// 验证: 年龄 
+		AjaxError.throwByIsNull(t.getSex(), "[性别性别] 不能为空");		// 验证: 性别性别(1=男,2=女) 
+		AjaxError.throwByIsNull(t.getPhone(), "[手机号] 不能为空");		// 验证: 手机号 
+		AjaxError.throwByIsNull(t.getAddress(), "[联系地址] 不能为空");		// 验证: 联系地址 
+		AjaxError.throwByIsNull(t.getBankCode(), "[银行卡号] 不能为空");		// 验证: 银行卡号 
+		AjaxError.throwByIsNull(t.getBankName(), "[银行名称] 不能为空");		// 验证: 银行名称 
+		AjaxError.throwByIsNull(t.getIdCard(), "[身份证号] 不能为空");		// 验证: 身份证号 
+		AjaxError.throwByIsNull(t.getIdCardImg(), "[身份证照片] 不能为空");		// 验证: 身份证照片 
+		AjaxError.throwByIsNull(t.getDrivingLicenseId(), "[驾驶证号] 不能为空");		// 验证: 驾驶证号 
+		AjaxError.throwByIsNull(t.getDrivingLicenseImg(), "[驾驶证照片] 不能为空");		// 验证: 驾驶证照片 
+		AjaxError.throwByIsNull(t.getVehicleDrivingId(), "[车辆行驶证号] 不能为空");		// 验证: 车辆行驶证号 
+		AjaxError.throwByIsNull(t.getVehicleDrivingImg(), "[车辆行驶证照片] 不能为空");		// 验证: 车辆行驶证照片 
+		AjaxError.throwByIsNull(t.getVehicleImg(), "[车辆前脸照] 不能为空");		// 验证: 车辆前脸照 
+		AjaxError.throwByIsNull(t.getRegisterTime(), "[注册时间] 不能为空");		// 验证: 注册时间 
+		AjaxError.throwByIsNull(t.getIsLock(), "[是否被锁定] 不能为空");		// 验证: 是否被锁定 
+		AjaxError.throwByIsNull(t.getCreateBy(), "[创建者id] 不能为空");		// 验证: 创建者id 
+		AjaxError.throwByIsNull(t.getCreateName(), "[创建者名称] 不能为空");		// 验证: 创建者名称 
+		AjaxError.throwByIsNull(t.getCreateTime(), "[创建时间] 不能为空");		// 验证: 创建时间 
+		AjaxError.throwByIsNull(t.getUpdateBy(), "[更新者id] 不能为空");		// 验证: 更新者id 
+		AjaxError.throwByIsNull(t.getUpdateName(), "[更新者名称] 不能为空");		// 验证: 更新者名称 
+		AjaxError.throwByIsNull(t.getUpdateTime(), "[更新时间] 不能为空");		// 验证: 更新时间 
+		AjaxError.throwByIsNull(t.getAuditStatus(), "[审核状态] 不能为空");		// 验证: 审核状态(0=待审核,1=已通过,2=不通过) 
+		AjaxError.throwByIsNull(t.getAuditBy(), "[审核人] 不能为空");		// 验证: 审核人 
+		AjaxError.throwByIsNull(t.getAuditTime(), "[审核时间] 不能为空");		// 验证: 审核时间 
+		AjaxError.throwByIsNull(t.getNopassReason(), "[审核不通过原因] 不能为空");		// 验证: 审核不通过原因 
+	}
+
+	/** 
+	 * 获取一个TbDriver (方便复制代码用) [G] 
+	 */ 
+	static TbDriver getTbDriver() {
+		TbDriver t = new TbDriver();	// 声明对象 
+		t.setId(0L);		// 主键 
+		t.setName("");		// 姓名 
+		t.setAge(0);		// 年龄 
+		t.setSex("");		// 性别性别(1=男,2=女) 
+		t.setPhone("");		// 手机号 
+		t.setAddress("");		// 联系地址 
+		t.setBankCode("");		// 银行卡号 
+		t.setBankName("");		// 银行名称 
+		t.setIdCard("");		// 身份证号 
+		t.setIdCardImg("");		// 身份证照片 
+		t.setDrivingLicenseId("");		// 驾驶证号 
+		t.setDrivingLicenseImg("");		// 驾驶证照片 
+		t.setVehicleDrivingId("");		// 车辆行驶证号 
+		t.setVehicleDrivingImg("");		// 车辆行驶证照片 
+		t.setVehicleImg("");		// 车辆前脸照 
+		t.setRegisterTime("");		// 注册时间 
+		t.setIsLock("");		// 是否被锁定 
+		t.setCreateBy("");		// 创建者id 
+		t.setCreateName("");		// 创建者名称 
+		t.setCreateTime(new Date());		// 创建时间 
+		t.setUpdateBy("");		// 更新者id 
+		t.setUpdateName("");		// 更新者名称 
+		t.setUpdateTime(new Date());		// 更新时间 
+		t.setAuditStatus(0);		// 审核状态(0=待审核,1=已通过,2=不通过) 
+		t.setAuditBy("");		// 审核人 
+		t.setAuditTime("");		// 审核时间 
+		t.setNopassReason("");		// 审核不通过原因 
+		return t;
+	}
+	
+	
+	
+	
+	
+}

+ 151 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicle.java

@@ -0,0 +1,151 @@
+package com.pj.project.tb_vehicle;
+
+import java.io.Serializable;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_vehicle -- 车辆
+ * @author loovi 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbVehicle.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbVehicle extends Model<TbVehicle> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_vehicle";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-vehicle";
+	public static final String PERMISSION_CODE_ADD = "tb-vehicle-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-vehicle-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-vehicle-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 车牌 
+	 */
+	private String vehiclePlate;	
+
+	/**
+	 * 所有人 
+	 */
+	private String owner;	
+
+	/**
+	 * 车辆类型 
+	 */
+	private Integer vehicleType;	
+
+	/**
+	 * 类型父id 
+	 */
+	private Integer parentId;	
+
+	/**
+	 * 车辆尺寸 
+	 */
+	private String vehicleSize;	
+
+	/**
+	 * 车辆品牌型号 
+	 */
+	private String vehicleModel;	
+
+	/**
+	 * 核定载质量 
+	 */
+	private String vehicleLoad;	
+
+	/**
+	 * 车辆自重 
+	 */
+	private String vehicleWeight;	
+
+	/**
+	 * 创建者id 
+	 */
+	private String createBy;	
+
+	/**
+	 * 创建者姓名 
+	 */
+	private String createName;	
+
+	/**
+	 * 创建时间 
+	 */
+	private Date createTime;	
+
+	/**
+	 * 更新者id 
+	 */
+	private String updateBy;	
+
+	/**
+	 * 更新者名称 
+	 */
+	private String updateName;	
+
+	/**
+	 * 更新时间 
+	 */
+	private Date updateTime;	
+
+	/**
+	 * 删除状态 
+	 */
+	private String deleteStatus;	
+
+	/**
+	 * 审核状态(0=待审核,1=已通过,2=不通过) 
+	 */
+	private Integer auditStatus;	
+
+	/**
+	 * 审核人 
+	 */
+	private String auditBy;	
+
+	/**
+	 * 审核不通过原因 
+	 */
+	private String nopassReason;	
+
+	/**
+	 * 审核时间 
+	 */
+	private String auditTime;	
+
+
+
+
+
+	
+
+
+}

+ 88 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleController.java

@@ -0,0 +1,88 @@
+package com.pj.project.tb_vehicle;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_vehicle -- 车辆
+ * @author loovi 
+ */
+@RestController
+@RequestMapping("/TbVehicle/")
+public class TbVehicleController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbVehicleService tbVehicleService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbVehicle.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbVehicle t){
+		tbVehicleService.add(t);
+		t = tbVehicleService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbVehicle.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbVehicleService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbVehicle.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbVehicle.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbVehicle.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbVehicle t){
+		tbVehicleService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbVehicle.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		TbVehicle t = tbVehicleService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(TbVehicle.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		so.set("deleteStatus", 1);
+		List<TbVehicle> list = tbVehicleService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+
+	
+	
+	
+
+}

+ 30 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleMapper.java

@@ -0,0 +1,30 @@
+package com.pj.project.tb_vehicle;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_vehicle -- 车辆
+ * @author loovi 
+ */
+
+@Mapper
+@Repository
+public interface TbVehicleMapper extends BaseMapper <TbVehicle> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbVehicle> getList(SoMap so);
+
+
+}

+ 78 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleMapper.xml

@@ -0,0 +1,78 @@
+<?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.pj.project.tb_vehicle.TbVehicleMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, vehicle_plate, owner, vehicle_type, parent_id, vehicle_size, vehicle_model, vehicle_load, vehicle_weight, create_by, create_name, create_time, update_by, update_name, update_time, delete_status, audit_status, audit_by, nopass_reason, audit_time from tb_vehicle  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.project.tb_vehicle.TbVehicle"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_vehicle 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("vehiclePlate") '> and vehicle_plate = #{vehiclePlate} </if>
+			<if test=' this.has("owner") '> and owner = #{owner} </if>
+			<if test=' this.has("vehicleType") '> and vehicle_type = #{vehicleType} </if>
+			<if test=' this.has("parentId") '> and parent_id = #{parentId} </if>
+			<if test=' this.has("vehicleSize") '> and vehicle_size = #{vehicleSize} </if>
+			<if test=' this.has("vehicleModel") '> and vehicle_model = #{vehicleModel} </if>
+			<if test=' this.has("vehicleLoad") '> and vehicle_load = #{vehicleLoad} </if>
+			<if test=' this.has("vehicleWeight") '> and vehicle_weight = #{vehicleWeight} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
+			<if test=' this.has("auditStatus") '> and audit_status = #{auditStatus} </if>
+			<if test=' this.has("auditBy") '> and audit_by = #{auditBy} </if>
+			<if test=' this.has("nopassReason") '> and nopass_reason = #{nopassReason} </if>
+			<if test=' this.has("auditTime") '> and audit_time = #{auditTime} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> vehicle_plate desc </when>
+			<when test='sortType == 3'> owner desc </when>
+			<when test='sortType == 4'> vehicle_type desc </when>
+			<when test='sortType == 5'> parent_id desc </when>
+			<when test='sortType == 6'> vehicle_size desc </when>
+			<when test='sortType == 7'> vehicle_model desc </when>
+			<when test='sortType == 8'> vehicle_load desc </when>
+			<when test='sortType == 9'> vehicle_weight desc </when>
+			<when test='sortType == 10'> create_by desc </when>
+			<when test='sortType == 11'> create_name desc </when>
+			<when test='sortType == 12'> create_time desc </when>
+			<when test='sortType == 13'> update_by desc </when>
+			<when test='sortType == 14'> update_name desc </when>
+			<when test='sortType == 15'> update_time desc </when>
+			<when test='sortType == 16'> audit_status desc </when>
+			<when test='sortType == 17'> audit_by desc </when>
+			<when test='sortType == 18'> nopass_reason desc </when>
+			<when test='sortType == 19'> audit_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 51 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleService.java

@@ -0,0 +1,51 @@
+package com.pj.project.tb_vehicle;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_vehicle -- 车辆
+ * @author loovi 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> implements IService<TbVehicle>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbVehicleMapper tbVehicleMapper;
+
+	/** 增 */
+	void add(TbVehicle t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbVehicle t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbVehicle getById(Long id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbVehicle> getList(SoMap so) { 
+		return tbVehicleMapper.getList(so);	
+	}
+	
+
+}

+ 82 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleUtil.java

@@ -0,0 +1,82 @@
+package com.pj.project.tb_vehicle;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.pj.utils.sg.*;
+import java.util.*;
+
+/**
+ * 工具类:tb_vehicle -- 车辆
+ * @author loovi 
+ *
+ */
+@Component
+public class TbVehicleUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbVehicleMapper tbVehicleMapper;
+	@Autowired
+	private void setTbVehicleMapper(TbVehicleMapper tbVehicleMapper) {
+		TbVehicleUtil.tbVehicleMapper = tbVehicleMapper;
+	}
+	
+	
+	/** 
+	 * 将一个 TbVehicle 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G] 
+	 */
+	static void check(TbVehicle t) {
+		AjaxError.throwByIsNull(t.getId(), "[主键] 不能为空");		// 验证: 主键 
+		AjaxError.throwByIsNull(t.getVehiclePlate(), "[车牌] 不能为空");		// 验证: 车牌 
+		AjaxError.throwByIsNull(t.getOwner(), "[所有人] 不能为空");		// 验证: 所有人 
+		AjaxError.throwByIsNull(t.getVehicleType(), "[车辆类型] 不能为空");		// 验证: 车辆类型 
+		AjaxError.throwByIsNull(t.getParentId(), "[类型父id] 不能为空");		// 验证: 类型父id 
+		AjaxError.throwByIsNull(t.getVehicleSize(), "[车辆尺寸] 不能为空");		// 验证: 车辆尺寸 
+		AjaxError.throwByIsNull(t.getVehicleModel(), "[车辆品牌型号] 不能为空");		// 验证: 车辆品牌型号 
+		AjaxError.throwByIsNull(t.getVehicleLoad(), "[核定载质量] 不能为空");		// 验证: 核定载质量 
+		AjaxError.throwByIsNull(t.getVehicleWeight(), "[车辆自重] 不能为空");		// 验证: 车辆自重 
+		AjaxError.throwByIsNull(t.getCreateBy(), "[创建者id] 不能为空");		// 验证: 创建者id 
+		AjaxError.throwByIsNull(t.getCreateName(), "[创建者姓名] 不能为空");		// 验证: 创建者姓名 
+		AjaxError.throwByIsNull(t.getCreateTime(), "[创建时间] 不能为空");		// 验证: 创建时间 
+		AjaxError.throwByIsNull(t.getUpdateBy(), "[更新者id] 不能为空");		// 验证: 更新者id 
+		AjaxError.throwByIsNull(t.getUpdateName(), "[更新者名称] 不能为空");		// 验证: 更新者名称 
+		AjaxError.throwByIsNull(t.getUpdateTime(), "[更新时间] 不能为空");		// 验证: 更新时间 
+		AjaxError.throwByIsNull(t.getAuditStatus(), "[审核状态] 不能为空");		// 验证: 审核状态(0=待审核,1=已通过,2=不通过) 
+		AjaxError.throwByIsNull(t.getAuditBy(), "[审核人] 不能为空");		// 验证: 审核人 
+		AjaxError.throwByIsNull(t.getNopassReason(), "[审核不通过原因] 不能为空");		// 验证: 审核不通过原因 
+		AjaxError.throwByIsNull(t.getAuditTime(), "[审核时间] 不能为空");		// 验证: 审核时间 
+	}
+
+	/** 
+	 * 获取一个TbVehicle (方便复制代码用) [G] 
+	 */ 
+	static TbVehicle getTbVehicle() {
+		TbVehicle t = new TbVehicle();	// 声明对象 
+		t.setId(0L);		// 主键 
+		t.setVehiclePlate("");		// 车牌 
+		t.setOwner("");		// 所有人 
+		t.setVehicleType(0);		// 车辆类型 
+		t.setParentId(0);		// 类型父id 
+		t.setVehicleSize("");		// 车辆尺寸 
+		t.setVehicleModel("");		// 车辆品牌型号 
+		t.setVehicleLoad("");		// 核定载质量 
+		t.setVehicleWeight("");		// 车辆自重 
+		t.setCreateBy("");		// 创建者id 
+		t.setCreateName("");		// 创建者姓名 
+		t.setCreateTime(new Date());		// 创建时间 
+		t.setUpdateBy("");		// 更新者id 
+		t.setUpdateName("");		// 更新者名称 
+		t.setUpdateTime(new Date());		// 更新时间 
+		t.setAuditStatus(0);		// 审核状态(0=待审核,1=已通过,2=不通过) 
+		t.setAuditBy("");		// 审核人 
+		t.setNopassReason("");		// 审核不通过原因 
+		t.setAuditTime("");		// 审核时间 
+		return t;
+	}
+	
+	
+	
+	
+	
+}