Commit 155c72ef authored by 耿迪迪's avatar 耿迪迪
parents 70b6ff1f 4d2ffb85
package com.zehong.web.controller.system;
import java.util.List;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeliveryRecord;
import com.zehong.system.service.ITDeliveryRecordService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 配送记录Controller
*
* @author zehong
* @date 2023-08-22
*/
@RestController
@RequestMapping("/system/recordn")
public class TDeliveryRecordController extends BaseController
{
@Autowired
private ITDeliveryRecordService tDeliveryRecordService;
/**
* 查询配送记录列表
*/
@PreAuthorize("@ss.hasPermi('system:record:list')")
@GetMapping("/list")
public TableDataInfo list(TDeliveryRecord tDeliveryRecord)
{
startPage();
List<TDeliveryRecord> list = tDeliveryRecordService.selectTDeliveryRecordList(tDeliveryRecord);
return getDataTable(list);
}
/**
* 导出配送记录列表
*/
@PreAuthorize("@ss.hasPermi('system:record:export')")
@Log(title = "配送记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDeliveryRecord tDeliveryRecord)
{
List<TDeliveryRecord> list = tDeliveryRecordService.selectTDeliveryRecordList(tDeliveryRecord);
ExcelUtil<TDeliveryRecord> util = new ExcelUtil<TDeliveryRecord>(TDeliveryRecord.class);
return util.exportExcel(list, "配送记录数据");
}
/**
* 获取配送记录详细信息
*/
@PreAuthorize("@ss.hasPermi('system:record:query')")
@GetMapping(value = "/{deliveryRecordId}")
public AjaxResult getInfo(@PathVariable("deliveryRecordId") Long deliveryRecordId)
{
return AjaxResult.success(tDeliveryRecordService.selectTDeliveryRecordById(deliveryRecordId));
}
/**
* 新增配送记录
*/
@PreAuthorize("@ss.hasPermi('system:record:add')")
@Log(title = "配送记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDeliveryRecord tDeliveryRecord)
{
return toAjax(tDeliveryRecordService.insertTDeliveryRecord(tDeliveryRecord));
}
/**
* 修改配送记录
*/
@PreAuthorize("@ss.hasPermi('system:record:edit')")
@Log(title = "配送记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDeliveryRecord tDeliveryRecord)
{
return toAjax(tDeliveryRecordService.updateTDeliveryRecord(tDeliveryRecord));
}
/**
* 删除配送记录
*/
@PreAuthorize("@ss.hasPermi('system:record:remove')")
@Log(title = "配送记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{deliveryRecordIds}")
public AjaxResult remove(@PathVariable Long[] deliveryRecordIds)
{
return toAjax(tDeliveryRecordService.deleteTDeliveryRecordByIds(deliveryRecordIds));
}
}
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 配送记录对象 t_delivery_record
*
* @author zehong
* @date 2023-08-22
*/
public class TDeliveryRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 配送记录主键 */
private Long deliveryRecordId;
/** 储配站主键 */
@Excel(name = "储配站主键")
private Long stationId;
/** 气瓶主键 */
@Excel(name = "气瓶主键")
private Long bottleId;
/** 配送人员 */
@Excel(name = "配送人员")
private String deliveryPerson;
/** 车辆代码 */
@Excel(name = "车辆代码")
private String vehicleCode;
/** 用户主键 */
@Excel(name = "用户主键")
private Long gasUserId;
/** 配送地址 */
@Excel(name = "配送地址")
private String deliveryAddress;
/** 配送时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "配送时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deliveryDate;
/** 删除状态:0.否 1.是 */
@Excel(name = "删除状态:0.否 1.是")
private String isDel;
/**
* 储配站名称
*/
private String stationName;
/**
* 气瓶条码
*/
private String bottleCode;
/**
* 气瓶规格
*/
private String bottleSpecs;
/**
* 气瓶状态 1正常 2逾期未检 3报废
*/
private Integer bottleStatus;
/**
* 用户名称
*/
private String gasUserName;
/**
* 用户类型 0居民 1非居民
*/
private String gasUserType;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getBottleCode() {
return bottleCode;
}
public void setBottleCode(String bottleCode) {
this.bottleCode = bottleCode;
}
public String getBottleSpecs() {
return bottleSpecs;
}
public void setBottleSpecs(String bottleSpecs) {
this.bottleSpecs = bottleSpecs;
}
public Integer getBottleStatus() {
return bottleStatus;
}
public void setBottleStatus(Integer bottleStatus) {
this.bottleStatus = bottleStatus;
}
public String getGasUserName() {
return gasUserName;
}
public void setGasUserName(String gasUserName) {
this.gasUserName = gasUserName;
}
public String getGasUserType() {
return gasUserType;
}
public void setGasUserType(String gasUserType) {
this.gasUserType = gasUserType;
}
public void setDeliveryRecordId(Long deliveryRecordId)
{
this.deliveryRecordId = deliveryRecordId;
}
public Long getDeliveryRecordId()
{
return deliveryRecordId;
}
public void setStationId(Long stationId)
{
this.stationId = stationId;
}
public Long getStationId()
{
return stationId;
}
public void setBottleId(Long bottleId)
{
this.bottleId = bottleId;
}
public Long getBottleId()
{
return bottleId;
}
public String getDeliveryPerson() {
return deliveryPerson;
}
public void setDeliveryPerson(String deliveryPerson) {
this.deliveryPerson = deliveryPerson;
}
public void setVehicleCode(String vehicleCode)
{
this.vehicleCode = vehicleCode;
}
public String getVehicleCode()
{
return vehicleCode;
}
public void setGasUserId(Long gasUserId)
{
this.gasUserId = gasUserId;
}
public Long getGasUserId()
{
return gasUserId;
}
public void setDeliveryAddress(String deliveryAddress)
{
this.deliveryAddress = deliveryAddress;
}
public String getDeliveryAddress()
{
return deliveryAddress;
}
public void setDeliveryDate(Date deliveryDate)
{
this.deliveryDate = deliveryDate;
}
public Date getDeliveryDate()
{
return deliveryDate;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return "TDeliveryRecord{" +
"deliveryRecordId=" + deliveryRecordId +
", stationId=" + stationId +
", bottleId=" + bottleId +
", deliveryPerson=" + deliveryPerson +
", vehicleCode='" + vehicleCode + '\'' +
", gasUserId=" + gasUserId +
", deliveryAddress='" + deliveryAddress + '\'' +
", deliveryDate=" + deliveryDate +
", isDel='" + isDel + '\'' +
", stationName='" + stationName + '\'' +
", bottleCode='" + bottleCode + '\'' +
", bottleSpecs='" + bottleSpecs + '\'' +
", bottleStatus=" + bottleStatus +
", gasUserName='" + gasUserName + '\'' +
", gasUserType='" + gasUserType + '\'' +
'}';
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeliveryRecord;
/**
* 配送记录Mapper接口
*
* @author zehong
* @date 2023-08-22
*/
public interface TDeliveryRecordMapper
{
/**
* 查询配送记录
*
* @param deliveryRecordId 配送记录ID
* @return 配送记录
*/
public TDeliveryRecord selectTDeliveryRecordById(Long deliveryRecordId);
/**
* 查询配送记录列表
*
* @param tDeliveryRecord 配送记录
* @return 配送记录集合
*/
public List<TDeliveryRecord> selectTDeliveryRecordList(TDeliveryRecord tDeliveryRecord);
/**
* 新增配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
public int insertTDeliveryRecord(TDeliveryRecord tDeliveryRecord);
/**
* 修改配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
public int updateTDeliveryRecord(TDeliveryRecord tDeliveryRecord);
/**
* 删除配送记录
*
* @param deliveryRecordId 配送记录ID
* @return 结果
*/
public int deleteTDeliveryRecordById(Long deliveryRecordId);
/**
* 批量删除配送记录
*
* @param deliveryRecordIds 需要删除的数据ID
* @return 结果
*/
public int deleteTDeliveryRecordByIds(Long[] deliveryRecordIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDeliveryRecord;
/**
* 配送记录Service接口
*
* @author zehong
* @date 2023-08-22
*/
public interface ITDeliveryRecordService
{
/**
* 查询配送记录
*
* @param deliveryRecordId 配送记录ID
* @return 配送记录
*/
public TDeliveryRecord selectTDeliveryRecordById(Long deliveryRecordId);
/**
* 查询配送记录列表
*
* @param tDeliveryRecord 配送记录
* @return 配送记录集合
*/
public List<TDeliveryRecord> selectTDeliveryRecordList(TDeliveryRecord tDeliveryRecord);
/**
* 新增配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
public int insertTDeliveryRecord(TDeliveryRecord tDeliveryRecord);
/**
* 修改配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
public int updateTDeliveryRecord(TDeliveryRecord tDeliveryRecord);
/**
* 批量删除配送记录
*
* @param deliveryRecordIds 需要删除的配送记录ID
* @return 结果
*/
public int deleteTDeliveryRecordByIds(Long[] deliveryRecordIds);
/**
* 删除配送记录信息
*
* @param deliveryRecordId 配送记录ID
* @return 结果
*/
public int deleteTDeliveryRecordById(Long deliveryRecordId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeliveryRecordMapper;
import com.zehong.system.domain.TDeliveryRecord;
import com.zehong.system.service.ITDeliveryRecordService;
/**
* 配送记录Service业务层处理
*
* @author zehong
* @date 2023-08-22
*/
@Service
public class TDeliveryRecordServiceImpl implements ITDeliveryRecordService
{
@Autowired
private TDeliveryRecordMapper tDeliveryRecordMapper;
/**
* 查询配送记录
*
* @param deliveryRecordId 配送记录ID
* @return 配送记录
*/
@Override
public TDeliveryRecord selectTDeliveryRecordById(Long deliveryRecordId)
{
return tDeliveryRecordMapper.selectTDeliveryRecordById(deliveryRecordId);
}
/**
* 查询配送记录列表
*
* @param tDeliveryRecord 配送记录
* @return 配送记录
*/
@Override
public List<TDeliveryRecord> selectTDeliveryRecordList(TDeliveryRecord tDeliveryRecord)
{
return tDeliveryRecordMapper.selectTDeliveryRecordList(tDeliveryRecord);
}
/**
* 新增配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
@Override
public int insertTDeliveryRecord(TDeliveryRecord tDeliveryRecord)
{
tDeliveryRecord.setCreateTime(DateUtils.getNowDate());
return tDeliveryRecordMapper.insertTDeliveryRecord(tDeliveryRecord);
}
/**
* 修改配送记录
*
* @param tDeliveryRecord 配送记录
* @return 结果
*/
@Override
public int updateTDeliveryRecord(TDeliveryRecord tDeliveryRecord)
{
tDeliveryRecord.setUpdateTime(DateUtils.getNowDate());
return tDeliveryRecordMapper.updateTDeliveryRecord(tDeliveryRecord);
}
/**
* 批量删除配送记录
*
* @param deliveryRecordIds 需要删除的配送记录ID
* @return 结果
*/
@Override
public int deleteTDeliveryRecordByIds(Long[] deliveryRecordIds)
{
return tDeliveryRecordMapper.deleteTDeliveryRecordByIds(deliveryRecordIds);
}
/**
* 删除配送记录信息
*
* @param deliveryRecordId 配送记录ID
* @return 结果
*/
@Override
public int deleteTDeliveryRecordById(Long deliveryRecordId)
{
return tDeliveryRecordMapper.deleteTDeliveryRecordById(deliveryRecordId);
}
}
<?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.zehong.system.mapper.TDeliveryRecordMapper">
<resultMap type="TDeliveryRecord" id="TDeliveryRecordResult">
<result property="deliveryRecordId" column="delivery_record_id" />
<result property="stationId" column="station_id" />
<result property="bottleId" column="bottle_id" />
<result property="deliveryPerson" column="delivery_person" />
<result property="vehicleCode" column="vehicle_code" />
<result property="gasUserId" column="gas_user_id" />
<result property="deliveryAddress" column="delivery_address" />
<result property="deliveryDate" column="delivery_date" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="stationName" column="station_name" />
<result property="bottleCode" column="bottle_code" />
<result property="bottleSpecs" column="bottle_specs" />
<result property="bottleStatus" column="bottle_status" />
<result property="gasUserName" column="gas_user_name" />
<result property="gasUserType" column="gas_user_type" />
</resultMap>
<sql id="selectTDeliveryRecordVo">
select delivery_record_id, station_id, bottle_id, delivery_person, vehicle_code, gas_user_id, delivery_address, delivery_date, create_time, update_time, is_del, remark from t_delivery_record
</sql>
<select id="selectTDeliveryRecordList" parameterType="TDeliveryRecord" resultMap="TDeliveryRecordResult">
select a.delivery_record_id, a.station_id, a.bottle_id, a.delivery_person, a.vehicle_code, a.gas_user_id, a.delivery_address, a.delivery_date, a.create_time, a.update_time, a.remark,
b.station_name,c.bottle_code,c.bottle_specs,c.bottle_status,a.delivery_address,a.delivery_date,d.gas_user_name,d.gas_user_type
from t_delivery_record a
left join t_gas_storage_station_info b on a.station_id=b.station_id
left join t_gas_bottle_info c on a.bottle_id=c.bottle_id
left join t_gas_user_info d on a.gas_user_id=d.gas_user_id
<where>
<if test="stationId != null "> and a.station_id = #{stationId}</if>
<if test="bottleId != null "> and a.bottle_id = #{bottleId}</if>
<if test="deliveryPerson != null "> and a.delivery_person = #{deliveryPerson}</if>
<if test="vehicleCode != null and vehicleCode != ''"> and a.vehicle_code = #{vehicleCode}</if>
<if test="gasUserId != null "> and a.gas_user_id = #{gasUserId}</if>
<if test="deliveryAddress != null and deliveryAddress != ''"> and a.delivery_address = #{deliveryAddress}</if>
<if test="deliveryDate != null "> and a.delivery_date = #{deliveryDate}</if>
</where>
</select>
<select id="selectTDeliveryRecordById" parameterType="Long" resultMap="TDeliveryRecordResult">
select a.delivery_record_id, a.station_id, a.bottle_id, a.delivery_person, a.vehicle_code, a.gas_user_id, a.delivery_address, a.delivery_date, a.create_time, a.update_time, a.remark,
b.station_name,c.bottle_code,c.bottle_specs,c.bottle_status,a.delivery_address,a.delivery_date,d.gas_user_name,d.gas_user_type
from t_delivery_record a
left join t_gas_storage_station_info b on a.station_id=b.station_id
left join t_gas_bottle_info c on a.bottle_id=c.bottle_id
left join t_gas_user_info d on a.gas_user_id=d.gas_user_id
where a.delivery_record_id = #{deliveryRecordId}
</select>
<insert id="insertTDeliveryRecord" parameterType="TDeliveryRecord" useGeneratedKeys="true" keyProperty="deliveryRecordId">
insert into t_delivery_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationId != null">station_id,</if>
<if test="bottleId != null">bottle_id,</if>
<if test="deliveryPerson != null">delivery_person,</if>
<if test="vehicleCode != null">vehicle_code,</if>
<if test="gasUserId != null">gas_user_id,</if>
<if test="deliveryAddress != null">delivery_address,</if>
<if test="deliveryDate != null">delivery_date,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationId != null">#{stationId},</if>
<if test="bottleId != null">#{bottleId},</if>
<if test="deliveryPerson != null">#{deliveryPerson},</if>
<if test="vehicleCode != null">#{vehicleCode},</if>
<if test="gasUserId != null">#{gasUserId},</if>
<if test="deliveryAddress != null">#{deliveryAddress},</if>
<if test="deliveryDate != null">#{deliveryDate},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTDeliveryRecord" parameterType="TDeliveryRecord">
update t_delivery_record
<trim prefix="SET" suffixOverrides=",">
<if test="stationId != null">station_id = #{stationId},</if>
<if test="bottleId != null">bottle_id = #{bottleId},</if>
<if test="deliveryPerson != null">delivery_person = #{deliveryPerson},</if>
<if test="vehicleCode != null">vehicle_code = #{vehicleCode},</if>
<if test="gasUserId != null">gas_user_id = #{gasUserId},</if>
<if test="deliveryAddress != null">delivery_address = #{deliveryAddress},</if>
<if test="deliveryDate != null">delivery_date = #{deliveryDate},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where delivery_record_id = #{deliveryRecordId}
</update>
<delete id="deleteTDeliveryRecordById" parameterType="Long">
delete from t_delivery_record where delivery_record_id = #{deliveryRecordId}
</delete>
<delete id="deleteTDeliveryRecordByIds" parameterType="String">
delete from t_delivery_record where delivery_record_id in
<foreach item="deliveryRecordId" collection="array" open="(" separator="," close=")">
#{deliveryRecordId}
</foreach>
</delete>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment