Forráskód Böngészése

新增运输单位模块

lingpeng.li 1 hónapja
szülő
commit
e4df1fccb8

+ 163 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/controller/CarUnitController.java

@@ -0,0 +1,163 @@
+package org.jeecg.modules.carUnit.controller;
+
+import java.util.Arrays;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.carUnit.entity.CarUnit;
+import org.jeecg.modules.carUnit.service.ICarUnitService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: 车辆单位管理
+ * @Author: jeecg-boot
+ * @Date:   2025-04-19
+ * @Version: V1.0
+ */
+@Api(tags="车辆单位管理")
+@RestController
+@RequestMapping("/carUnit/carUnit")
+@Slf4j
+public class CarUnitController extends JeecgController<CarUnit, ICarUnitService> {
+	@Autowired
+	private ICarUnitService carUnitService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param carUnit
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "车辆单位管理-分页列表查询")
+	@ApiOperation(value="车辆单位管理-分页列表查询", notes="车辆单位管理-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<CarUnit>> queryPageList(CarUnit carUnit,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<CarUnit> queryWrapper = QueryGenerator.initQueryWrapper(carUnit, req.getParameterMap());
+		Page<CarUnit> page = new Page<CarUnit>(pageNo, pageSize);
+		IPage<CarUnit> pageList = carUnitService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param carUnit
+	 * @return
+	 */
+	@AutoLog(value = "车辆单位管理-添加")
+	@ApiOperation(value="车辆单位管理-添加", notes="车辆单位管理-添加")
+	@RequiresPermissions("carUnit:car_unit:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody CarUnit carUnit) {
+		carUnitService.save(carUnit);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param carUnit
+	 * @return
+	 */
+	@AutoLog(value = "车辆单位管理-编辑")
+	@ApiOperation(value="车辆单位管理-编辑", notes="车辆单位管理-编辑")
+	@RequiresPermissions("carUnit:car_unit:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody CarUnit carUnit) {
+		carUnitService.updateById(carUnit);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "车辆单位管理-通过id删除")
+	@ApiOperation(value="车辆单位管理-通过id删除", notes="车辆单位管理-通过id删除")
+	@RequiresPermissions("carUnit:car_unit:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		carUnitService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "车辆单位管理-批量删除")
+	@ApiOperation(value="车辆单位管理-批量删除", notes="车辆单位管理-批量删除")
+	@RequiresPermissions("carUnit:car_unit:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.carUnitService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "车辆单位管理-通过id查询")
+	@ApiOperation(value="车辆单位管理-通过id查询", notes="车辆单位管理-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<CarUnit> queryById(@RequestParam(name="id",required=true) String id) {
+		CarUnit carUnit = carUnitService.getById(id);
+		if(carUnit==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(carUnit);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param carUnit
+    */
+    @RequiresPermissions("carUnit:car_unit:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, CarUnit carUnit) {
+        return super.exportXls(request, carUnit, CarUnit.class, "车辆单位管理");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("carUnit:car_unit:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, CarUnit.class);
+    }
+
+}

+ 67 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/CarUnit.java

@@ -0,0 +1,67 @@
+package org.jeecg.modules.carUnit.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 车辆单位管理
+ * @Author: jeecg-boot
+ * @Date:   2025-04-19
+ * @Version: V1.0
+ */
+@Data
+@TableName("car_unit")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="car_unit对象", description="车辆单位管理")
+public class CarUnit implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新日期")
+    private java.util.Date updateTime;
+	/**所属部门*/
+    @ApiModelProperty(value = "所属部门")
+    private String sysOrgCode;
+	/**单位*/
+	@Excel(name = "单位", width = 15)
+    @ApiModelProperty(value = "单位")
+    private String unit;
+	/**车辆信息*/
+	@Excel(name = "车辆信息", width = 15)
+    @ApiModelProperty(value = "车辆信息")
+    private String carNumer;
+	/**状态*/
+	@Excel(name = "状态", width = 15)
+    @ApiModelProperty(value = "状态")
+    private String status;
+}

+ 14 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/CarUnitMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.carUnit.mapper;
+
+import org.jeecg.modules.carUnit.entity.CarUnit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 车辆单位管理
+ * @Author: jeecg-boot
+ * @Date:   2025-04-19
+ * @Version: V1.0
+ */
+public interface CarUnitMapper extends BaseMapper<CarUnit> {
+
+}

+ 5 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/CarUnitMapper.xml

@@ -0,0 +1,5 @@
+<?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="org.jeecg.modules.carUnit.mapper.CarUnitMapper">
+
+</mapper>

+ 14 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ICarUnitService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.carUnit.service;
+
+import org.jeecg.modules.carUnit.entity.CarUnit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 车辆单位管理
+ * @Author: jeecg-boot
+ * @Date:   2025-04-19
+ * @Version: V1.0
+ */
+public interface ICarUnitService extends IService<CarUnit> {
+
+}

+ 19 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.carUnit.service.impl;
+
+import org.jeecg.modules.carUnit.entity.CarUnit;
+import org.jeecg.modules.carUnit.mapper.CarUnitMapper;
+import org.jeecg.modules.carUnit.service.ICarUnitService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 车辆单位管理
+ * @Author: jeecg-boot
+ * @Date:   2025-04-19
+ * @Version: V1.0
+ */
+@Service
+public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> implements ICarUnitService {
+
+}