创建刷卡记录表

This commit is contained in:
童丽然 2024-12-30 15:42:15 +08:00
parent d7cd539478
commit 470154356d
6 changed files with 513 additions and 0 deletions

View File

@ -0,0 +1,110 @@
package com.fastbee.data.controller.cardSwipeRecords;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.iot.domain.NgCardSwipeRecords;
import com.fastbee.iot.service.INgCardSwipeRecordsService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;
/**
* 刷卡记录Controller
*
* @author kerwincui
* @date 2024-12-30
*/
@RestController
@RequestMapping("/iot/swipe/records")
@Api(tags = "刷卡记录")
public class NgCardSwipeRecordsController extends BaseController
{
@Autowired
private INgCardSwipeRecordsService ngCardSwipeRecordsService;
/**
* 查询刷卡记录列表
*/
@PreAuthorize("@ss.hasPermi('iot:records:list')")
@GetMapping("/list")
@ApiOperation("查询刷卡记录列表")
public TableDataInfo list(NgCardSwipeRecords ngCardSwipeRecords)
{
startPage();
List<NgCardSwipeRecords> list = ngCardSwipeRecordsService.selectNgCardSwipeRecordsList(ngCardSwipeRecords);
return getDataTable(list);
}
/**
* 导出刷卡记录列表
*/
@ApiOperation("导出刷卡记录列表")
@PreAuthorize("@ss.hasPermi('iot:records:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, NgCardSwipeRecords ngCardSwipeRecords)
{
List<NgCardSwipeRecords> list = ngCardSwipeRecordsService.selectNgCardSwipeRecordsList(ngCardSwipeRecords);
ExcelUtil<NgCardSwipeRecords> util = new ExcelUtil<NgCardSwipeRecords>(NgCardSwipeRecords.class);
util.exportExcel(response, list, "刷卡记录数据");
}
/**
* 获取刷卡记录详细信息
*/
@PreAuthorize("@ss.hasPermi('iot:records:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取刷卡记录详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(ngCardSwipeRecordsService.selectNgCardSwipeRecordsById(id));
}
/**
* 新增刷卡记录
*/
@PreAuthorize("@ss.hasPermi('iot:records:add')")
@PostMapping
@ApiOperation("新增刷卡记录")
public AjaxResult add(@RequestBody NgCardSwipeRecords ngCardSwipeRecords)
{
return toAjax(ngCardSwipeRecordsService.insertNgCardSwipeRecords(ngCardSwipeRecords));
}
/**
* 修改刷卡记录
*/
@PreAuthorize("@ss.hasPermi('iot:records:edit')")
@PutMapping
@ApiOperation("修改刷卡记录")
public AjaxResult edit(@RequestBody NgCardSwipeRecords ngCardSwipeRecords)
{
return toAjax(ngCardSwipeRecordsService.updateNgCardSwipeRecords(ngCardSwipeRecords));
}
/**
* 删除刷卡记录
*/
@PreAuthorize("@ss.hasPermi('iot:records:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除刷卡记录")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(ngCardSwipeRecordsService.deleteNgCardSwipeRecordsByIds(ids));
}
}

View File

@ -0,0 +1,72 @@
package com.fastbee.iot.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 刷卡记录对象 ng_card_swipe_records
*
* @author kerwincui
* @date 2024-12-30
*/
@ApiModel(value = "NgCardSwipeRecords",description = "刷卡记录 ng_card_swipe_records")
@Data
@EqualsAndHashCode(callSuper = true)
public class NgCardSwipeRecords extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键自增 */
private Long id;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty("用户id")
private Long userId;
/** 设备编码 */
@Excel(name = "设备编码")
@ApiModelProperty("设备编码")
private String deviceNumber;
/** 0=开阀1=关阀 */
@Excel(name = "0=开阀1=关阀")
@ApiModelProperty("0=开阀1=关阀")
private Integer cardSwipeType;
/** 购水卡卡号 */
@Excel(name = "购水卡卡号")
@ApiModelProperty("购水卡卡号")
private String cardNumber;
/** 机构id */
@Excel(name = "机构id")
@ApiModelProperty("机构id")
private Long deptId;
/** 刷卡时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
@Excel(name = "刷卡时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("刷卡时间")
private Date cardSwipeTime;
/** 此次开关阀消费金额(只在关阀时填写) */
@Excel(name = "此次开关阀消费金额", readConverterExp = "只=在关阀时填写")
@ApiModelProperty("此次开关阀消费金额")
private BigDecimal amountDue;
/** 区域码 */
@Excel(name = "区域码")
@ApiModelProperty("区域码")
private String areaCode;
}

View File

@ -0,0 +1,63 @@
package com.fastbee.iot.mapper;
import java.util.List;
import com.fastbee.iot.domain.NgCardSwipeRecords;
import org.springframework.stereotype.Repository;
/**
* 刷卡记录Mapper接口
*
* @author kerwincui
* @date 2024-12-30
*/
@Repository
public interface NgCardSwipeRecordsMapper
{
/**
* 查询刷卡记录
*
* @param id 刷卡记录主键
* @return 刷卡记录
*/
public NgCardSwipeRecords selectNgCardSwipeRecordsById(Long id);
/**
* 查询刷卡记录列表
*
* @param ngCardSwipeRecords 刷卡记录
* @return 刷卡记录集合
*/
public List<NgCardSwipeRecords> selectNgCardSwipeRecordsList(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 新增刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
public int insertNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 修改刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
public int updateNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 删除刷卡记录
*
* @param id 刷卡记录主键
* @return 结果
*/
public int deleteNgCardSwipeRecordsById(Long id);
/**
* 批量删除刷卡记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNgCardSwipeRecordsByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.iot.service;
import java.util.List;
import com.fastbee.iot.domain.NgCardSwipeRecords;
/**
* 刷卡记录Service接口
*
* @author kerwincui
* @date 2024-12-30
*/
public interface INgCardSwipeRecordsService
{
/**
* 查询刷卡记录
*
* @param id 刷卡记录主键
* @return 刷卡记录
*/
public NgCardSwipeRecords selectNgCardSwipeRecordsById(Long id);
/**
* 查询刷卡记录列表
*
* @param ngCardSwipeRecords 刷卡记录
* @return 刷卡记录集合
*/
public List<NgCardSwipeRecords> selectNgCardSwipeRecordsList(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 新增刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
public int insertNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 修改刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
public int updateNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords);
/**
* 批量删除刷卡记录
*
* @param ids 需要删除的刷卡记录主键集合
* @return 结果
*/
public int deleteNgCardSwipeRecordsByIds(Long[] ids);
/**
* 删除刷卡记录信息
*
* @param id 刷卡记录主键
* @return 结果
*/
public int deleteNgCardSwipeRecordsById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.fastbee.iot.service.impl;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.iot.mapper.NgCardSwipeRecordsMapper;
import com.fastbee.iot.domain.NgCardSwipeRecords;
import com.fastbee.iot.service.INgCardSwipeRecordsService;
/**
* 刷卡记录Service业务层处理
*
* @author kerwincui
* @date 2024-12-30
*/
@Service
public class NgCardSwipeRecordsServiceImpl implements INgCardSwipeRecordsService
{
@Autowired
private NgCardSwipeRecordsMapper ngCardSwipeRecordsMapper;
/**
* 查询刷卡记录
*
* @param id 刷卡记录主键
* @return 刷卡记录
*/
@Override
public NgCardSwipeRecords selectNgCardSwipeRecordsById(Long id)
{
return ngCardSwipeRecordsMapper.selectNgCardSwipeRecordsById(id);
}
/**
* 查询刷卡记录列表
*
* @param ngCardSwipeRecords 刷卡记录
* @return 刷卡记录
*/
@Override
public List<NgCardSwipeRecords> selectNgCardSwipeRecordsList(NgCardSwipeRecords ngCardSwipeRecords)
{
return ngCardSwipeRecordsMapper.selectNgCardSwipeRecordsList(ngCardSwipeRecords);
}
/**
* 新增刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
@Override
public int insertNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords)
{
ngCardSwipeRecords.setCreateTime(DateUtils.getNowDate());
return ngCardSwipeRecordsMapper.insertNgCardSwipeRecords(ngCardSwipeRecords);
}
/**
* 修改刷卡记录
*
* @param ngCardSwipeRecords 刷卡记录
* @return 结果
*/
@Override
public int updateNgCardSwipeRecords(NgCardSwipeRecords ngCardSwipeRecords)
{
ngCardSwipeRecords.setUpdateTime(DateUtils.getNowDate());
return ngCardSwipeRecordsMapper.updateNgCardSwipeRecords(ngCardSwipeRecords);
}
/**
* 批量删除刷卡记录
*
* @param ids 需要删除的刷卡记录主键
* @return 结果
*/
@Override
public int deleteNgCardSwipeRecordsByIds(Long[] ids)
{
return ngCardSwipeRecordsMapper.deleteNgCardSwipeRecordsByIds(ids);
}
/**
* 删除刷卡记录信息
*
* @param id 刷卡记录主键
* @return 结果
*/
@Override
public int deleteNgCardSwipeRecordsById(Long id)
{
return ngCardSwipeRecordsMapper.deleteNgCardSwipeRecordsById(id);
}
}

View File

@ -0,0 +1,111 @@
<?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.fastbee.iot.mapper.NgCardSwipeRecordsMapper">
<resultMap type="NgCardSwipeRecords" id="NgCardSwipeRecordsResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="deviceNumber" column="device_number" />
<result property="cardSwipeType" column="card_swipe_type" />
<result property="cardNumber" column="card_number" />
<result property="deptId" column="dept_id" />
<result property="cardSwipeTime" column="card_swipe_time" />
<result property="amountDue" column="amount_due" />
<result property="areaCode" column="area_code" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectNgCardSwipeRecordsVo">
select id, user_id, device_number, card_swipe_type, card_number, dept_id, card_swipe_time, amount_due, area_code, remark, create_time, update_time, create_by, update_by from ng_card_swipe_records
</sql>
<select id="selectNgCardSwipeRecordsList" parameterType="NgCardSwipeRecords" resultMap="NgCardSwipeRecordsResult">
<include refid="selectNgCardSwipeRecordsVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
<if test="cardSwipeType != null "> and card_swipe_type = #{cardSwipeType}</if>
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="cardSwipeTime != null "> and card_swipe_time = #{cardSwipeTime}</if>
<if test="amountDue != null "> and amount_due = #{amountDue}</if>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
</where>
</select>
<select id="selectNgCardSwipeRecordsById" parameterType="Long" resultMap="NgCardSwipeRecordsResult">
<include refid="selectNgCardSwipeRecordsVo"/>
where id = #{id}
</select>
<insert id="insertNgCardSwipeRecords" parameterType="NgCardSwipeRecords" useGeneratedKeys="true" keyProperty="id">
insert into ng_card_swipe_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="deviceNumber != null">device_number,</if>
<if test="cardSwipeType != null">card_swipe_type,</if>
<if test="cardNumber != null">card_number,</if>
<if test="deptId != null">dept_id,</if>
<if test="cardSwipeTime != null">card_swipe_time,</if>
<if test="amountDue != null">amount_due,</if>
<if test="areaCode != null">area_code,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="deviceNumber != null">#{deviceNumber},</if>
<if test="cardSwipeType != null">#{cardSwipeType},</if>
<if test="cardNumber != null">#{cardNumber},</if>
<if test="deptId != null">#{deptId},</if>
<if test="cardSwipeTime != null">#{cardSwipeTime},</if>
<if test="amountDue != null">#{amountDue},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateNgCardSwipeRecords" parameterType="NgCardSwipeRecords">
update ng_card_swipe_records
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="deviceNumber != null">device_number = #{deviceNumber},</if>
<if test="cardSwipeType != null">card_swipe_type = #{cardSwipeType},</if>
<if test="cardNumber != null">card_number = #{cardNumber},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="cardSwipeTime != null">card_swipe_time = #{cardSwipeTime},</if>
<if test="amountDue != null">amount_due = #{amountDue},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNgCardSwipeRecordsById" parameterType="Long">
delete from ng_card_swipe_records where id = #{id}
</delete>
<delete id="deleteNgCardSwipeRecordsByIds" parameterType="String">
delete from ng_card_swipe_records where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>