wangsixiang
9 months ago
13 changed files with 483 additions and 10 deletions
@ -0,0 +1,104 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
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 com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.zc.business.domain.DcVehicles; |
|||
import com.zc.business.service.IDcVehiclesService; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 车辆信息Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-03-05 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/business/vehicles") |
|||
public class DcVehiclesController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcVehiclesService dcVehiclesService; |
|||
|
|||
/** |
|||
* 查询车辆信息列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcVehicles dcVehicles) |
|||
{ |
|||
startPage(); |
|||
List<DcVehicles> list = dcVehiclesService.selectDcVehiclesList(dcVehicles); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出车辆信息列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:export')") |
|||
@Log(title = "车辆信息", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcVehicles dcVehicles) |
|||
{ |
|||
List<DcVehicles> list = dcVehiclesService.selectDcVehiclesList(dcVehicles); |
|||
ExcelUtil<DcVehicles> util = new ExcelUtil<>(DcVehicles.class); |
|||
util.exportExcel(response, list, "车辆信息数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取车辆信息详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(dcVehiclesService.selectDcVehiclesById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增车辆信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:add')") |
|||
@Log(title = "车辆信息", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcVehicles dcVehicles) |
|||
{ |
|||
return toAjax(dcVehiclesService.insertDcVehicles(dcVehicles)); |
|||
} |
|||
|
|||
/** |
|||
* 修改车辆信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:edit')") |
|||
@Log(title = "车辆信息", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcVehicles dcVehicles) |
|||
{ |
|||
return toAjax(dcVehiclesService.updateDcVehicles(dcVehicles)); |
|||
} |
|||
|
|||
/** |
|||
* 删除车辆信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:vehicles:remove')") |
|||
@Log(title = "车辆信息", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcVehiclesService.deleteDcVehiclesByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,108 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 车辆信息对象 dc_vehicles |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-03-05 |
|||
*/ |
|||
public class DcVehicles extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 机构id */ |
|||
|
|||
private Long organizationId; |
|||
|
|||
/** 车牌号 */ |
|||
@Excel(name = "车牌号") |
|||
private String vehiclePlate; |
|||
|
|||
/** 车辆类型 */ |
|||
@Excel(name = "车辆类型") |
|||
private Integer vehicleType; |
|||
|
|||
/** 1-可用2-使用中 */ |
|||
@Excel(name = "状态",readConverterExp = "1=可用,2=使用中") |
|||
private Integer vehicleStatus; |
|||
|
|||
/** 机构 */ |
|||
@Excel(name = "机构") |
|||
private String organizationName; |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getOrganizationName() { |
|||
return organizationName; |
|||
} |
|||
|
|||
public void setOrganizationName(String organizationName) { |
|||
this.organizationName = organizationName; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setOrganizationId(Long organizationId) |
|||
{ |
|||
this.organizationId = organizationId; |
|||
} |
|||
|
|||
public Long getOrganizationId() |
|||
{ |
|||
return organizationId; |
|||
} |
|||
public void setVehiclePlate(String vehiclePlate) |
|||
{ |
|||
this.vehiclePlate = vehiclePlate; |
|||
} |
|||
|
|||
public String getVehiclePlate() |
|||
{ |
|||
return vehiclePlate; |
|||
} |
|||
public void setVehicleType(Integer vehicleType) |
|||
{ |
|||
this.vehicleType = vehicleType; |
|||
} |
|||
|
|||
public Integer getVehicleType() |
|||
{ |
|||
return vehicleType; |
|||
} |
|||
public void setVehicleStatus(Integer vehicleStatus) |
|||
{ |
|||
this.vehicleStatus = vehicleStatus; |
|||
} |
|||
|
|||
public Integer getVehicleStatus() |
|||
{ |
|||
return vehicleStatus; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("organizationId", getOrganizationId()) |
|||
.append("vehiclePlate", getVehiclePlate()) |
|||
.append("vehicleType", getVehicleType()) |
|||
.append("vehicleStatus", getVehicleStatus()) |
|||
.append("remark", getRemark()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import java.util.List; |
|||
import com.zc.business.domain.DcVehicles; |
|||
|
|||
/** |
|||
* 车辆信息Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-03-05 |
|||
*/ |
|||
public interface IDcVehiclesService |
|||
{ |
|||
/** |
|||
* 查询车辆信息 |
|||
* |
|||
* @param id 车辆信息主键 |
|||
* @return 车辆信息 |
|||
*/ |
|||
public DcVehicles selectDcVehiclesById(Long id); |
|||
|
|||
/** |
|||
* 查询车辆信息列表 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 车辆信息集合 |
|||
*/ |
|||
List<DcVehicles> selectDcVehiclesList(DcVehicles dcVehicles); |
|||
|
|||
/** |
|||
* 新增车辆信息 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcVehicles(DcVehicles dcVehicles); |
|||
|
|||
/** |
|||
* 修改车辆信息 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcVehicles(DcVehicles dcVehicles); |
|||
|
|||
/** |
|||
* 批量删除车辆信息 |
|||
* |
|||
* @param ids 需要删除的车辆信息主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVehiclesByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除车辆信息信息 |
|||
* |
|||
* @param id 车辆信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcVehiclesById(Long id); |
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zc.business.mapper.DcVehiclesMapper; |
|||
import com.zc.business.domain.DcVehicles; |
|||
import com.zc.business.service.IDcVehiclesService; |
|||
|
|||
/** |
|||
* 车辆信息Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-03-05 |
|||
*/ |
|||
@Service |
|||
public class DcVehiclesServiceImpl implements IDcVehiclesService |
|||
{ |
|||
@Autowired |
|||
private DcVehiclesMapper dcVehiclesMapper; |
|||
|
|||
/** |
|||
* 查询车辆信息 |
|||
* |
|||
* @param id 车辆信息主键 |
|||
* @return 车辆信息 |
|||
*/ |
|||
@Override |
|||
public DcVehicles selectDcVehiclesById(Long id) |
|||
{ |
|||
return dcVehiclesMapper.selectDcVehiclesById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询车辆信息列表 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 车辆信息 |
|||
*/ |
|||
@Override |
|||
public List<DcVehicles> selectDcVehiclesList(DcVehicles dcVehicles) |
|||
{ |
|||
return dcVehiclesMapper.selectDcVehiclesList(dcVehicles); |
|||
} |
|||
|
|||
/** |
|||
* 新增车辆信息 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcVehicles(DcVehicles dcVehicles) |
|||
{ |
|||
dcVehicles.setCreateTime(DateUtils.getNowDate()); |
|||
return dcVehiclesMapper.insertDcVehicles(dcVehicles); |
|||
} |
|||
|
|||
/** |
|||
* 修改车辆信息 |
|||
* |
|||
* @param dcVehicles 车辆信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcVehicles(DcVehicles dcVehicles) |
|||
{ |
|||
dcVehicles.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcVehiclesMapper.updateDcVehicles(dcVehicles); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除车辆信息 |
|||
* |
|||
* @param ids 需要删除的车辆信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcVehiclesByIds(Long[] ids) |
|||
{ |
|||
return dcVehiclesMapper.deleteDcVehiclesByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除车辆信息信息 |
|||
* |
|||
* @param id 车辆信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcVehiclesById(Long id) |
|||
{ |
|||
return dcVehiclesMapper.deleteDcVehiclesById(id); |
|||
} |
|||
} |
@ -0,0 +1,90 @@ |
|||
<?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.zc.business.mapper.DcVehiclesMapper"> |
|||
|
|||
<resultMap type="DcVehicles" id="DcVehiclesResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="organizationId" column="organization_id" /> |
|||
<result property="vehiclePlate" column="vehicle_plate" /> |
|||
<result property="vehicleType" column="vehicle_type" /> |
|||
<result property="vehicleStatus" column="vehicle_status" /> |
|||
<result property="remark" column="remark" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
<result property="organizationName" column="organization_name" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcVehiclesVo"> |
|||
select v.id, v.organization_id, v.vehicle_plate, |
|||
organization.organization_name, |
|||
v.vehicle_type, v.vehicle_status, |
|||
v.remark, v.create_time, v.update_time from dc_vehicles as v |
|||
left join dc_organization as organization on organization.id=v.organization_id |
|||
</sql> |
|||
|
|||
<select id="selectDcVehiclesList" parameterType="DcVehicles" resultMap="DcVehiclesResult"> |
|||
<include refid="selectDcVehiclesVo"/> |
|||
<where> |
|||
<if test="organizationId != null "> and organization_id = #{organizationId}</if> |
|||
<if test="vehiclePlate != null and vehiclePlate != ''"> and vehicle_plate = #{vehiclePlate}</if> |
|||
<if test="vehicleType != null "> and vehicle_type = #{vehicleType}</if> |
|||
<if test="vehicleStatus != null "> and vehicle_status = #{vehicleStatus}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcVehiclesById" parameterType="Long" resultMap="DcVehiclesResult"> |
|||
<include refid="selectDcVehiclesVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcVehicles" parameterType="DcVehicles"> |
|||
insert into dc_vehicles |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null">id,</if> |
|||
<if test="organizationId != null">organization_id,</if> |
|||
<if test="vehiclePlate != null and vehiclePlate != ''">vehicle_plate,</if> |
|||
<if test="vehicleType != null">vehicle_type,</if> |
|||
<if test="vehicleStatus != null">vehicle_status,</if> |
|||
<if test="remark != null">remark,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="id != null">#{id},</if> |
|||
<if test="organizationId != null">#{organizationId},</if> |
|||
<if test="vehiclePlate != null and vehiclePlate != ''">#{vehiclePlate},</if> |
|||
<if test="vehicleType != null">#{vehicleType},</if> |
|||
<if test="vehicleStatus != null">#{vehicleStatus},</if> |
|||
<if test="remark != null">#{remark},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcVehicles" parameterType="DcVehicles"> |
|||
update dc_vehicles |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="organizationId != null">organization_id = #{organizationId},</if> |
|||
<if test="vehiclePlate != null and vehiclePlate != ''">vehicle_plate = #{vehiclePlate},</if> |
|||
<if test="vehicleType != null">vehicle_type = #{vehicleType},</if> |
|||
<if test="vehicleStatus != null">vehicle_status = #{vehicleStatus},</if> |
|||
<if test="remark != null">remark = #{remark},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcVehiclesById" parameterType="Long"> |
|||
delete from dc_vehicles where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcVehiclesByIds" parameterType="String"> |
|||
delete from dc_vehicles where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue