diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/controller/cardSwipeRecords/NgCardSwipeRecordsController.java b/fastbee-open-api/src/main/java/com/fastbee/data/controller/cardSwipeRecords/NgCardSwipeRecordsController.java new file mode 100644 index 0000000..fdb33b3 --- /dev/null +++ b/fastbee-open-api/src/main/java/com/fastbee/data/controller/cardSwipeRecords/NgCardSwipeRecordsController.java @@ -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 list = ngCardSwipeRecordsService.selectNgCardSwipeRecordsList(ngCardSwipeRecords); + return getDataTable(list); + } + + /** + * 导出刷卡记录列表 + */ + @ApiOperation("导出刷卡记录列表") + @PreAuthorize("@ss.hasPermi('iot:records:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, NgCardSwipeRecords ngCardSwipeRecords) + { + List list = ngCardSwipeRecordsService.selectNgCardSwipeRecordsList(ngCardSwipeRecords); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/NgCardSwipeRecords.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/NgCardSwipeRecords.java new file mode 100644 index 0000000..b1daaaa --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/domain/NgCardSwipeRecords.java @@ -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; + +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/NgCardSwipeRecordsMapper.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/NgCardSwipeRecordsMapper.java new file mode 100644 index 0000000..a54768c --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/mapper/NgCardSwipeRecordsMapper.java @@ -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 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); +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/INgCardSwipeRecordsService.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/INgCardSwipeRecordsService.java new file mode 100644 index 0000000..34ce87d --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/INgCardSwipeRecordsService.java @@ -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 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); +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/NgCardSwipeRecordsServiceImpl.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/NgCardSwipeRecordsServiceImpl.java new file mode 100644 index 0000000..7860d1e --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/NgCardSwipeRecordsServiceImpl.java @@ -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 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); + } +} diff --git a/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/NgCardSwipeRecordsMapper.xml b/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/NgCardSwipeRecordsMapper.xml new file mode 100644 index 0000000..a47fe40 --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/resources/mapper/iot/NgCardSwipeRecordsMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into ng_card_swipe_records + + 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, + + + #{userId}, + #{deviceNumber}, + #{cardSwipeType}, + #{cardNumber}, + #{deptId}, + #{cardSwipeTime}, + #{amountDue}, + #{areaCode}, + #{remark}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + + + + + update ng_card_swipe_records + + user_id = #{userId}, + device_number = #{deviceNumber}, + card_swipe_type = #{cardSwipeType}, + card_number = #{cardNumber}, + dept_id = #{deptId}, + card_swipe_time = #{cardSwipeTime}, + amount_due = #{amountDue}, + area_code = #{areaCode}, + remark = #{remark}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + + where id = #{id} + + + + delete from ng_card_swipe_records where id = #{id} + + + + delete from ng_card_swipe_records where id in + + #{id} + + + \ No newline at end of file