Commit 68e17bb9 authored by 耿迪迪's avatar 耿迪迪

气瓶追溯

parent d06cb8f3
package com.zehong.web.controller.gasBottleTrack;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.TGasBottleTrackRecord;
import com.zehong.system.service.ITGasBottleTrackRecordService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 气瓶追溯Controller
*
* @author zehong
* @date 2023-08-18
*/
@RestController
@RequestMapping("/track/record")
public class TGasBottleTrackRecordController extends BaseController
{
@Autowired
private ITGasBottleTrackRecordService tGasBottleTrackRecordService;
/**
* 查询气瓶追溯列表
*/
@PreAuthorize("@ss.hasPermi('track:record:list')")
@PostMapping("/list")
public TableDataInfo list(@RequestBody TGasBottleTrackRecord tGasBottleTrackRecord)
{
startPage();
List<TGasBottleTrackRecord> list = tGasBottleTrackRecordService.selectTGasBottleTrackRecordList(tGasBottleTrackRecord);
return getDataTable(list);
}
@PostMapping("/bottleTrackRecordList")
public AjaxResult bottleTrackRecordList(@RequestBody TGasBottleTrackRecord tGasBottleTrackRecord)
{
List<TGasBottleTrackRecord> list = tGasBottleTrackRecordService.selectTGasBottleTrackRecordList(tGasBottleTrackRecord);
return AjaxResult.success(list);
}
/**
* 导出气瓶追溯列表
*/
@PreAuthorize("@ss.hasPermi('track:record:export')")
@Log(title = "气瓶追溯", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public AjaxResult export(@RequestBody TGasBottleTrackRecord tGasBottleTrackRecord)
{
List<TGasBottleTrackRecord> list = tGasBottleTrackRecordService.selectTGasBottleTrackRecordList(tGasBottleTrackRecord);
ExcelUtil<TGasBottleTrackRecord> util = new ExcelUtil<TGasBottleTrackRecord>(TGasBottleTrackRecord.class);
return util.exportExcel(list, "气瓶追溯数据");
}
/**
* 获取气瓶追溯详细信息
*/
@PreAuthorize("@ss.hasPermi('track:record:query')")
@GetMapping(value = "/{trackRecordId}")
public AjaxResult getInfo(@PathVariable("trackRecordId") Long trackRecordId)
{
return AjaxResult.success(tGasBottleTrackRecordService.selectTGasBottleTrackRecordById(trackRecordId));
}
/**
* 新增气瓶追溯
*/
@PreAuthorize("@ss.hasPermi('track:record:add')")
@Log(title = "气瓶追溯", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TGasBottleTrackRecord tGasBottleTrackRecord)
{
return toAjax(tGasBottleTrackRecordService.insertTGasBottleTrackRecord(tGasBottleTrackRecord));
}
/**
* 修改气瓶追溯
*/
@PreAuthorize("@ss.hasPermi('track:record:edit')")
@Log(title = "气瓶追溯", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TGasBottleTrackRecord tGasBottleTrackRecord)
{
return toAjax(tGasBottleTrackRecordService.updateTGasBottleTrackRecord(tGasBottleTrackRecord));
}
/**
* 删除气瓶追溯
*/
@PreAuthorize("@ss.hasPermi('track:record:remove')")
@Log(title = "气瓶追溯", businessType = BusinessType.DELETE)
@DeleteMapping("/{trackRecordIds}")
public AjaxResult remove(@PathVariable Long[] trackRecordIds)
{
return toAjax(tGasBottleTrackRecordService.deleteTGasBottleTrackRecordByIds(trackRecordIds));
}
}
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_gas_bottle_track_record
*
* @author zehong
* @date 2023-08-18
*/
public class TGasBottleTrackRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 追溯主键 */
private Long trackRecordId;
/** 储配站主键 */
private Long stationId;
/**储配站*/
@Excel(name="储配站")
private String stationName;
/** 气瓶主键 */
private Long bottleId;
/**气瓶编号*/
@Excel(name = "气瓶条码")
private String bottleCode;
/**规格*/
@Excel(name = "气瓶规格/L")
private String bottleCapacity;
/** 工序名称:0.气瓶充装 1.气瓶配送 2.气瓶回收 */
@Excel(name = "工序名称:0.气瓶充装 1.气瓶配送 2.气瓶回收")
private String processesName;
/** 工序关联主键用于查看 */
private Long processesRelationId;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operateDate;
/** 操作人 */
private Long operator;
@Excel(name = "操作人")
private String operatorName;
/** 发送方 */
@Excel(name = "发送方")
private String sender;
/** 接收方 */
@Excel(name = "接收方")
private String recipient;
/** 删除状态:0.否 1.是 */
private String isDel;
public void setTrackRecordId(Long trackRecordId)
{
this.trackRecordId = trackRecordId;
}
public Long getTrackRecordId()
{
return trackRecordId;
}
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 getBottleCode() {
return bottleCode;
}
public void setBottleCode(String bottleCode) {
this.bottleCode = bottleCode;
}
public String getBottleCapacity() {
return bottleCapacity;
}
public void setBottleCapacity(String bottleCapacity) {
this.bottleCapacity = bottleCapacity;
}
public void setProcessesName(String processesName)
{
this.processesName = processesName;
}
public String getProcessesName()
{
return processesName;
}
public void setProcessesRelationId(Long processesRelationId)
{
this.processesRelationId = processesRelationId;
}
public Long getProcessesRelationId()
{
return processesRelationId;
}
public void setOperateDate(Date operateDate)
{
this.operateDate = operateDate;
}
public Date getOperateDate()
{
return operateDate;
}
public void setOperator(Long operator)
{
this.operator = operator;
}
public Long getOperator()
{
return operator;
}
public String getOperatorName() {
return operatorName;
}
public void setOperatorName(String operatorName) {
this.operatorName = operatorName;
}
public void setSender(String sender)
{
this.sender = sender;
}
public String getSender()
{
return sender;
}
public void setRecipient(String recipient)
{
this.recipient = recipient;
}
public String getRecipient()
{
return recipient;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("trackRecordId", getTrackRecordId())
.append("stationId", getStationId())
.append("bottleId", getBottleId())
.append("processesName", getProcessesName())
.append("processesRelationId", getProcessesRelationId())
.append("operateDate", getOperateDate())
.append("operator", getOperator())
.append("sender", getSender())
.append("recipient", getRecipient())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TGasBottleTrackRecord;
/**
* 气瓶追溯Mapper接口
*
* @author zehong
* @date 2023-08-18
*/
public interface TGasBottleTrackRecordMapper
{
/**
* 查询气瓶追溯
*
* @param trackRecordId 气瓶追溯ID
* @return 气瓶追溯
*/
public TGasBottleTrackRecord selectTGasBottleTrackRecordById(Long trackRecordId);
/**
* 查询气瓶追溯列表
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 气瓶追溯集合
*/
public List<TGasBottleTrackRecord> selectTGasBottleTrackRecordList(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 新增气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
public int insertTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 修改气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
public int updateTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 删除气瓶追溯
*
* @param trackRecordId 气瓶追溯ID
* @return 结果
*/
public int deleteTGasBottleTrackRecordById(Long trackRecordId);
/**
* 批量删除气瓶追溯
*
* @param trackRecordIds 需要删除的数据ID
* @return 结果
*/
public int deleteTGasBottleTrackRecordByIds(Long[] trackRecordIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TGasBottleTrackRecord;
/**
* 气瓶追溯Service接口
*
* @author zehong
* @date 2023-08-18
*/
public interface ITGasBottleTrackRecordService
{
/**
* 查询气瓶追溯
*
* @param trackRecordId 气瓶追溯ID
* @return 气瓶追溯
*/
public TGasBottleTrackRecord selectTGasBottleTrackRecordById(Long trackRecordId);
/**
* 查询气瓶追溯列表
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 气瓶追溯集合
*/
public List<TGasBottleTrackRecord> selectTGasBottleTrackRecordList(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 新增气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
public int insertTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 修改气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
public int updateTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord);
/**
* 批量删除气瓶追溯
*
* @param trackRecordIds 需要删除的气瓶追溯ID
* @return 结果
*/
public int deleteTGasBottleTrackRecordByIds(Long[] trackRecordIds);
/**
* 删除气瓶追溯信息
*
* @param trackRecordId 气瓶追溯ID
* @return 结果
*/
public int deleteTGasBottleTrackRecordById(Long trackRecordId);
}
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.TGasBottleTrackRecordMapper;
import com.zehong.system.domain.TGasBottleTrackRecord;
import com.zehong.system.service.ITGasBottleTrackRecordService;
/**
* 气瓶追溯Service业务层处理
*
* @author zehong
* @date 2023-08-18
*/
@Service
public class TGasBottleTrackRecordServiceImpl implements ITGasBottleTrackRecordService
{
@Autowired
private TGasBottleTrackRecordMapper tGasBottleTrackRecordMapper;
/**
* 查询气瓶追溯
*
* @param trackRecordId 气瓶追溯ID
* @return 气瓶追溯
*/
@Override
public TGasBottleTrackRecord selectTGasBottleTrackRecordById(Long trackRecordId)
{
return tGasBottleTrackRecordMapper.selectTGasBottleTrackRecordById(trackRecordId);
}
/**
* 查询气瓶追溯列表
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 气瓶追溯
*/
@Override
public List<TGasBottleTrackRecord> selectTGasBottleTrackRecordList(TGasBottleTrackRecord tGasBottleTrackRecord)
{
return tGasBottleTrackRecordMapper.selectTGasBottleTrackRecordList(tGasBottleTrackRecord);
}
/**
* 新增气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
@Override
public int insertTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord)
{
tGasBottleTrackRecord.setCreateTime(DateUtils.getNowDate());
return tGasBottleTrackRecordMapper.insertTGasBottleTrackRecord(tGasBottleTrackRecord);
}
/**
* 修改气瓶追溯
*
* @param tGasBottleTrackRecord 气瓶追溯
* @return 结果
*/
@Override
public int updateTGasBottleTrackRecord(TGasBottleTrackRecord tGasBottleTrackRecord)
{
tGasBottleTrackRecord.setUpdateTime(DateUtils.getNowDate());
return tGasBottleTrackRecordMapper.updateTGasBottleTrackRecord(tGasBottleTrackRecord);
}
/**
* 批量删除气瓶追溯
*
* @param trackRecordIds 需要删除的气瓶追溯ID
* @return 结果
*/
@Override
public int deleteTGasBottleTrackRecordByIds(Long[] trackRecordIds)
{
return tGasBottleTrackRecordMapper.deleteTGasBottleTrackRecordByIds(trackRecordIds);
}
/**
* 删除气瓶追溯信息
*
* @param trackRecordId 气瓶追溯ID
* @return 结果
*/
@Override
public int deleteTGasBottleTrackRecordById(Long trackRecordId)
{
return tGasBottleTrackRecordMapper.deleteTGasBottleTrackRecordById(trackRecordId);
}
}
<?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.TGasBottleTrackRecordMapper">
<resultMap type="TGasBottleTrackRecord" id="TGasBottleTrackRecordResult">
<result property="trackRecordId" column="track_record_id" />
<result property="stationId" column="station_id" />
<result property="bottleId" column="bottle_id" />
<result property="processesName" column="processes_name" />
<result property="processesRelationId" column="processes_relation_id" />
<result property="operateDate" column="operate_date" />
<result property="operator" column="operator" />
<result property="sender" column="sender" />
<result property="recipient" column="recipient" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="stationName" column="station_name"/>
<result property="bottleCode" column="bottle_code" />
<result property="bottleCapacity" column="bottle_capacity" />
<result property="operatorName" column="operator_name"/>
</resultMap>
<sql id="selectTGasBottleTrackRecordVo">
SELECT
record.track_record_id,
record.station_id,
record.bottle_id,
record.processes_name,
record.processes_relation_id,
record.operate_date,
record.operator,
record.sender,
recipient,
record.create_time,
record.update_time,
record.is_del,
record.remark,
station.station_name,
bottle.bottle_code,
bottle.bottle_capacity,
(select us.gas_user_name from t_gas_user_info us where us.gas_user_id = record.operator) as operator_name
FROM
t_gas_bottle_track_record record
LEFT JOIN t_gas_storage_station_info station ON station.station_id = record.station_id
LEFT JOIN t_gas_bottle_info bottle ON bottle.bottle_id = record.bottle_id
</sql>
<select id="selectTGasBottleTrackRecordList" parameterType="TGasBottleTrackRecord" resultMap="TGasBottleTrackRecordResult">
<include refid="selectTGasBottleTrackRecordVo"/>
<where>
<if test="stationId != null "> and record.station_id = #{stationId}</if>
<if test="bottleId != null "> and record.bottle_id = #{bottleId}</if>
<if test="processesName != null and processesName != ''"> and record.processes_name like concat('%', #{processesName}, '%')</if>
<if test="processesRelationId != null "> and record.processes_relation_id = #{processesRelationId}</if>
<if test="operateDate != null "> and record.operate_date = #{operateDate}</if>
<if test="operator != null "> and record.operator = #{operator}</if>
<if test="sender != null and sender != ''"> and record.sender = #{sender}</if>
<if test="recipient != null and recipient != ''"> and record.recipient = #{recipient}</if>
<if test="isDel != null and isDel != ''"> and record.is_del = #{isDel}</if>
<if test="bottleCode != null"> and bottle.bottle_code like concat('%', #{ bottleCode }, '%')</if>
</where>
ORDER BY record.operate_date DESC
</select>
<select id="selectTGasBottleTrackRecordById" parameterType="Long" resultMap="TGasBottleTrackRecordResult">
<include refid="selectTGasBottleTrackRecordVo"/>
where record.track_record_id = #{trackRecordId}
</select>
<insert id="insertTGasBottleTrackRecord" parameterType="TGasBottleTrackRecord" useGeneratedKeys="true" keyProperty="trackRecordId">
insert into t_gas_bottle_track_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationId != null">station_id,</if>
<if test="bottleId != null">bottle_id,</if>
<if test="processesName != null">processes_name,</if>
<if test="processesRelationId != null">processes_relation_id,</if>
<if test="operateDate != null">operate_date,</if>
<if test="operator != null">operator,</if>
<if test="sender != null">sender,</if>
<if test="recipient != null">recipient,</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="processesName != null">#{processesName},</if>
<if test="processesRelationId != null">#{processesRelationId},</if>
<if test="operateDate != null">#{operateDate},</if>
<if test="operator != null">#{operator},</if>
<if test="sender != null">#{sender},</if>
<if test="recipient != null">#{recipient},</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="updateTGasBottleTrackRecord" parameterType="TGasBottleTrackRecord">
update t_gas_bottle_track_record
<trim prefix="SET" suffixOverrides=",">
<if test="stationId != null">station_id = #{stationId},</if>
<if test="bottleId != null">bottle_id = #{bottleId},</if>
<if test="processesName != null">processes_name = #{processesName},</if>
<if test="processesRelationId != null">processes_relation_id = #{processesRelationId},</if>
<if test="operateDate != null">operate_date = #{operateDate},</if>
<if test="operator != null">operator = #{operator},</if>
<if test="sender != null">sender = #{sender},</if>
<if test="recipient != null">recipient = #{recipient},</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 track_record_id = #{trackRecordId}
</update>
<delete id="deleteTGasBottleTrackRecordById" parameterType="Long">
delete from t_gas_bottle_track_record where track_record_id = #{trackRecordId}
</delete>
<delete id="deleteTGasBottleTrackRecordByIds" parameterType="String">
delete from t_gas_bottle_track_record where track_record_id in
<foreach item="trackRecordId" collection="array" open="(" separator="," close=")">
#{trackRecordId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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