luojian 2024-12-18 17:13:07 +08:00
parent 7ae48b8da0
commit 507c6ca6bf
7 changed files with 83 additions and 15 deletions

View File

@ -2,16 +2,13 @@ package com.cpxt.web.controller.biz;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.BizCarModel;
import com.cpxt.common.constant.HttpStatus;
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.cpxt.common.annotation.Log;
import com.cpxt.common.core.controller.BaseController;
import com.cpxt.common.core.domain.AjaxResult;
@ -35,15 +32,31 @@ public class BizCustomerController extends BaseController
private IBizCustomerService bizCustomerService;
/**
*
*
*/
@PreAuthorize("@ss.hasPermi('biz:customer:list')")
@GetMapping("/list")
public TableDataInfo list(BizCustomer bizCustomer)
public TableDataInfo list(BizCustomer bizCustomer,
@RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize)
{
startPage();
List<BizCustomer> list = bizCustomerService.selectBizCustomerList(bizCustomer);
return getDataTable(list);
Page<BizCustomer> recordPage = bizCustomerService.selectBizCustomerPage(bizCustomer,pageNum,pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(recordPage.getRecords());
rspData.setTotal(recordPage.getTotal());
return rspData;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('biz:customer:list')")
@GetMapping("/list2")
public AjaxResult list(BizCustomer bizCustomer)
{
return AjaxResult.success(bizCustomerService.selectBizCustomerList(bizCustomer));
}
/**

View File

@ -17,7 +17,7 @@ import com.cpxt.common.core.domain.BaseEntity;
* @date 2024-12-16
*/
@Data
public class BizCustomerWarehouse extends BaseEntity
public class BizCustomerWarehouse
{
private static final long serialVersionUID = 1L;

View File

@ -2,8 +2,11 @@ package com.cpxt.biz.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cpxt.biz.domain.BizCar;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**
* Mapper
@ -14,6 +17,9 @@ import org.apache.ibatis.annotations.Select;
@Mapper
public interface BizCarMapper extends BaseMapper<BizCar>
{
@Update("create table ${tableName} as select * from track_temp")
void createTable(String tableName);
@Select("select * from biz_car where car_no = #{carNo}")
BizCar selectByCarNo(String carNo);
}

View File

@ -1,6 +1,8 @@
package com.cpxt.biz.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.BizCustomer;
/**
@ -19,6 +21,8 @@ public interface IBizCustomerService
*/
public BizCustomer selectBizCustomerById(Long id);
Page<BizCustomer> selectBizCustomerPage(BizCustomer bizCustomer, int pageNum, int pageSize);
/**
*
*
@ -58,4 +62,6 @@ public interface IBizCustomerService
* @return
*/
public int deleteBizCustomerById(Long id);
}

View File

@ -93,7 +93,14 @@ public class BizCarServiceImpl implements IBizCarService
@Override
public int insertBizCar(BizCar bizCar)
{
return bizCarMapper.insert(bizCar);
int i = bizCarMapper.insert(bizCar);
// 新增完车辆后,创建该车辆的行驶轨迹表
if (i > 0){
Long id = bizCar.getId();
String tableName = "track_" + id;
bizCarMapper.createTable(tableName);
}
return i;
}
/**

View File

@ -5,9 +5,11 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpxt.biz.domain.BizCarModel;
import com.cpxt.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import com.cpxt.biz.mapper.BizCustomerMapper;
import com.cpxt.biz.domain.BizCustomer;
@ -37,6 +39,20 @@ public class BizCustomerServiceImpl implements IBizCustomerService
return bizCustomerMapper.selectById(id);
}
/**
*
*
* @param bizCustomer
* @return
*/
@Override
public Page<BizCustomer> selectBizCustomerPage(BizCustomer bizCustomer, int pageNum, int pageSize) {
LambdaQueryWrapper<BizCustomer> queryWrapper= new LambdaQueryWrapper<>();
return bizCustomerMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper);
}
/**
*
*

View File

@ -0,0 +1,20 @@
<?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.cpxt.biz.mapper.BizCarMapper">
<resultMap type="BizCar" id="BizCarResult">
<result property="id" column="id" />
<result property="modelId" column="model_id" />
<result property="modelName" column="model_name" />
<result property="carType" column="car_type" />
<result property="carNo" column="car_no" />
<result property="vin" column="vin" />
<result property="serialNo" column="serial_no" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
</mapper>