Эх сурвалжийг харах

开发了告警工单相关的接口

jinshihui 15 цаг өмнө
parent
commit
22df7ea1f3

+ 161 - 0
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/AlarmController.java

@@ -0,0 +1,161 @@
+package com.ylx.web.controller.massage;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ylx.common.annotation.Log;
+import com.ylx.common.core.domain.R;
+import com.ylx.common.enums.BusinessType;
+import com.ylx.common.exception.ServiceException;
+import com.ylx.common.utils.SecurityUtils;
+import com.ylx.common.utils.StringUtils;
+import com.ylx.massage.domain.Alarm;
+import com.ylx.massage.service.AlarmService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+/**
+ * 告警工单表控制层
+ *
+ * @author makejava
+ * @since 2024-04-28 09:19:04
+ */
+@RestController
+@RequestMapping("alarm")
+@Api(tags = {"告警工单"})
+public class AlarmController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private AlarmService alarmService;
+
+    /**
+     * 分页查询告警记录
+     *
+     * @param page 分页对象
+     * @param alarm 筛选条件
+     * @return R 查询结果
+     */
+    @GetMapping("getAlarmList")
+    @ApiOperation("分页查询告警记录")
+    public R queryByPage(Page<Alarm> page, Alarm alarm) {
+        try {
+            LambdaQueryWrapper<Alarm> alarmLambdaQueryWrapper = buildAlarmQueryWrapper(alarm);
+            Page<Alarm> pageSelect = alarmService.page(page, alarmLambdaQueryWrapper);
+            return R.ok(pageSelect);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 构建告警记录查询条件
+     * @param alarm
+     * @return LambdaQueryWrapper<Alarm>
+     */
+    private LambdaQueryWrapper<Alarm> buildAlarmQueryWrapper(Alarm alarm) {
+        LambdaQueryWrapper<Alarm> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(null != alarm.getAlarmStatus(), Alarm::getAlarmStatus, alarm.getAlarmStatus())
+                .like(StringUtils.isNotBlank(alarm.getMerchantName()), Alarm::getMerchantName, alarm.getMerchantName())
+                .like(StringUtils.isNotBlank(alarm.getMerchantNickName()), Alarm::getMerchantNickName, alarm.getMerchantNickName())
+                .eq(null != alarm.getMerchantSex(), Alarm::getMerchantSex, alarm.getMerchantSex())
+                .like(StringUtils.isNotBlank(alarm.getMerchantPhone()), Alarm::getMerchantPhone, alarm.getMerchantPhone())
+                .ge(StringUtils.isNotBlank(alarm.getBeginTime()), Alarm::getCreateTime, normalizeBeginTime(alarm.getBeginTime()))
+                .le(StringUtils.isNotBlank(alarm.getEndTime()), Alarm::getCreateTime, normalizeEndTime(alarm.getEndTime()))
+                .orderByDesc(Alarm::getCreateTime);
+        return wrapper;
+    }
+
+    /**
+     * 格式化开始时间
+     * @param beginTime
+     * @return String 格式化后的开始时间
+     */
+    private String normalizeBeginTime(String beginTime) {
+        if (StringUtils.isBlank(beginTime)) {
+            return null;
+        }
+        String value = beginTime.trim();
+        return value.length() == 10 ? value + " 00:00:00" : value;
+    }
+
+    /**
+     * 格式化结束时间
+     * @param endTime
+     * @return String 格式化后的结束时间
+     */
+    private String normalizeEndTime(String endTime) {
+        if (StringUtils.isBlank(endTime)) {
+            return null;
+        }
+        String value = endTime.trim();
+        return value.length() == 10 ? value + " 23:59:59" : value;
+    }
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("{id}")
+    public ResponseEntity<Alarm> queryById(@PathVariable("id") String id) {
+        return ResponseEntity.ok(this.alarmService.queryById(id));
+    }
+
+
+    /**
+     * 处理告警工单
+     * @param alarm
+     * @return R
+     */
+    @PostMapping("/handleAlarm")
+    @ApiOperation("已处理")
+    @Log(title = "处理告警工单", businessType = BusinessType.UPDATE)
+    public R handleAlarm(@RequestBody Alarm alarm) {
+        try {
+            if (StringUtils.isBlank(alarm.getId())) {
+                throw new ServiceException("id不能为空");
+            }
+            if (StringUtils.isBlank(alarm.getNote())) {
+                throw new ServiceException("处理过程及结果不能为空");
+            }
+
+            String handleResult = alarm.getNote().trim();
+            if (handleResult.length() > 128) {
+                throw new ServiceException("处理过程及结果不能超过128个字符");
+            }
+
+            Alarm existAlarm = alarmService.getById(alarm.getId());
+            if (existAlarm == null) {
+                throw new ServiceException("告警工单不存在");
+            }
+            if (Integer.valueOf(1).equals(existAlarm.getAlarmStatus())) {
+                throw new ServiceException("告警工单已处理,请勿重复处理");
+            }
+
+            Alarm updateAlarm = new Alarm()
+                    .setId(alarm.getId())
+                    .setAlarmStatus(1)
+                    .setNote(handleResult)
+                    .setUpdateBy(SecurityUtils.getUsername())
+                    .setUpdateTime(new Date());
+            boolean updateResult = alarmService.updateById(updateAlarm);
+            if (!updateResult) {
+                throw new ServiceException("处理告警工单失败");
+            }
+            return R.ok();
+        } catch (ServiceException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+}
+

+ 0 - 127
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/YlxAlarmController.java

@@ -1,127 +0,0 @@
-package com.ylx.web.controller.massage;
-
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ylx.common.annotation.Log;
-import com.ylx.common.core.domain.R;
-import com.ylx.common.enums.BusinessType;
-import com.ylx.common.exception.ServiceException;
-import com.ylx.common.utils.StringUtils;
-import com.ylx.massage.domain.YlxAlarm;
-import com.ylx.massage.service.YlxAlarmService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-
-/**
- * 报警记录表(YlxAlarm)表控制层
- *
- * @author makejava
- * @since 2024-04-28 09:19:04
- */
-@RestController
-@RequestMapping("ylxAlarm")
-@Api(tags = {"报警记录"})
-public class YlxAlarmController {
-    /**
-     * 服务对象
-     */
-    @Resource
-    private YlxAlarmService ylxAlarmService;
-
-    /**
-     * 分页查询
-     *
-     * @param ylxAlarm    筛选条件
-     * @param pageRequest 分页对象
-     * @return 查询结果
-     */
-    @GetMapping("getAlarmList")
-    @ApiOperation("Pc报警列表")
-    public R queryByPage(Page<YlxAlarm> page, YlxAlarm ylxAlarm) {
-        LambdaQueryWrapper<YlxAlarm> alarmLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        alarmLambdaQueryWrapper.eq(StringUtils.isNotBlank(ylxAlarm.getJsId()), YlxAlarm::getJsId, ylxAlarm.getJsId()).
-                eq(StringUtils.isNotBlank(ylxAlarm.getOpenId()), YlxAlarm::getOpenId, ylxAlarm.getOpenId()).
-                eq(null != ylxAlarm.getAlarmStatus(), YlxAlarm::getAlarmStatus, ylxAlarm.getAlarmStatus()).
-                like(StringUtils.isNotBlank(ylxAlarm.getJsName()), YlxAlarm::getJsName, ylxAlarm.getJsName()).
-                like(StringUtils.isNotBlank(ylxAlarm.getJsPhone()), YlxAlarm::getJsPhone, ylxAlarm.getJsPhone()).
-                like(StringUtils.isNotBlank(ylxAlarm.getUserPhone()), YlxAlarm::getUserPhone, ylxAlarm.getUserPhone()).
-                like(StringUtils.isNotBlank(ylxAlarm.getUserName()), YlxAlarm::getUserName, ylxAlarm.getUserName()).orderByDesc(YlxAlarm::getCreateTime);
-        // 获取查询返回结果
-        Page<YlxAlarm> pageSelect = ylxAlarmService.page(page, alarmLambdaQueryWrapper);
-        return R.ok(pageSelect);
-    }
-
-    /**
-     * 通过主键查询单条数据
-     *
-     * @param id 主键
-     * @return 单条数据
-     */
-    @GetMapping("{id}")
-    public ResponseEntity<YlxAlarm> queryById(@PathVariable("id") String id) {
-        return ResponseEntity.ok(this.ylxAlarmService.queryById(id));
-    }
-
-    /**
-     * 新增数据
-     *
-     * @param ylxAlarm 实体
-     * @return 新增结果
-     */
-    @PostMapping("/addAlarm")
-    @ApiOperation("添加报警记录")
-    @Log(title = "添加报警记录", businessType = BusinessType.INSERT)
-    public R<YlxAlarm> addAlarm(@RequestBody YlxAlarm ylxAlarm) {
-        return R.ok(this.ylxAlarmService.addAlarm(ylxAlarm));
-    }
-
-
-
-    @PostMapping("/handleAlarm")
-    @ApiOperation("已处理")
-    @Log(title = "处理报警记录", businessType = BusinessType.UPDATE)
-    public R handleAlarm(@RequestBody YlxAlarm ylxAlarm) {
-        if(StringUtils.isBlank(ylxAlarm.getId())){
-            throw new ServiceException("id不能为空");
-        }
-        ylxAlarm.setAlarmStatus(1);
-        return R.ok(ylxAlarmService.updateById(ylxAlarm));
-    }
-
-
-    @PostMapping("/deleteAlarm")
-    @ApiOperation("删除")
-    @Log(title = "处理报警记录", businessType = BusinessType.UPDATE)
-    public R deleteAlarm(@RequestBody YlxAlarm ylxAlarm) {
-        return R.ok(ylxAlarmService.removeById(ylxAlarm.getId()));
-    }
-
-    /**
-     * 编辑数据
-     *
-     * @param ylxAlarm 实体
-     * @return 编辑结果
-     */
-    @PutMapping
-    public ResponseEntity<YlxAlarm> edit(YlxAlarm ylxAlarm) {
-        return ResponseEntity.ok(this.ylxAlarmService.update(ylxAlarm));
-    }
-
-    /**
-     * 删除数据
-     *
-     * @param id 主键
-     * @return 删除是否成功
-     */
-    @DeleteMapping
-    public ResponseEntity<Boolean> deleteById(String id) {
-        return ResponseEntity.ok(this.ylxAlarmService.deleteById(id));
-    }
-
-}
-

+ 140 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/domain/Alarm.java

@@ -0,0 +1,140 @@
+package com.ylx.massage.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 告警工单表实体类
+ *
+ * @author makejava
+ * @since 2024-04-28 09:19:05
+ */
+@Data
+@Accessors(chain = true)
+@TableName(value = "t_alarm", autoResultMap = true)
+@ApiModel(value = "Alarm", description = "告警工单")
+public class Alarm implements Serializable {
+
+    private static final long serialVersionUID = -78310583967774907L;
+
+    /**
+     * 主键ID。
+     */
+    @TableId("id")
+    @ApiModelProperty("id")
+    private String id;
+
+    /**
+     * 关联订单编号。
+     */
+    @ApiModelProperty("订单编号")
+    private String orderNo;
+
+    /**
+     * 发起告警的商户ID。
+     */
+    @ApiModelProperty("商户id")
+    private String merchantId;
+
+    /**
+     * 发起告警的商户姓名。
+     */
+    @ApiModelProperty("商户姓名")
+    private String merchantName;
+
+    /**
+     * 发起告警的商户昵称。
+     */
+    @ApiModelProperty("商户昵称")
+    private String merchantNickName;
+
+    /**
+     * 商户性别,0表示女,1表示男。
+     */
+    @ApiModelProperty("商户性别:0女 1男")
+    private Integer merchantSex;
+
+    /**
+     * 商户形象照地址。
+     */
+    @ApiModelProperty("商户形象照")
+    private String merchantAvatar;
+
+    /**
+     * 商户联系电话。
+     */
+    @ApiModelProperty("商户电话")
+    private String merchantPhone;
+
+    /**
+     * 告警发生地点。
+     */
+    @ApiModelProperty("地点")
+    private String address;
+
+    /**
+     * 告警处理状态,0表示待处理,1表示已处理。
+     */
+    @ApiModelProperty("告警状态:0待处理 1已处理")
+    private Integer alarmStatus;
+
+    /**
+     * 告警备注或处理说明。
+     */
+    @ApiModelProperty("备注")
+    private String note;
+
+    /**
+     * 创建者。
+     */
+    @ApiModelProperty("创建者")
+    private String createBy;
+
+    /**
+     * 系统创建时间。
+     */
+    @ApiModelProperty("系统创建时间")
+    private Date createTime;
+
+    /**
+     * 更新者。
+     */
+    @ApiModelProperty("更新者")
+    private String updateBy;
+
+    /**
+     * 系统修改时间。
+     */
+    @ApiModelProperty("系统修改时间")
+    private Date updateTime;
+
+    /**
+     * 逻辑删除标识,0表示否,1表示是。
+     */
+    @TableLogic
+    @ApiModelProperty("是否删除:0否 1是")
+    private Integer isDelete;
+
+    /**
+     * 查询用申请开始时间,不对应数据库字段。
+     */
+    @TableField(exist = false)
+    @ApiModelProperty("申请开始时间")
+    private String beginTime;
+
+    /**
+     * 查询用申请结束时间,不对应数据库字段。
+     */
+    @TableField(exist = false)
+    @ApiModelProperty("申请结束时间")
+    private String endTime;
+}

+ 0 - 206
nightFragrance-massage/src/main/java/com/ylx/massage/domain/YlxAlarm.java

@@ -1,206 +0,0 @@
-package com.ylx.massage.domain;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.experimental.Accessors;
-
-import java.util.Date;
-import java.io.Serializable;
-
-/**
- * 报警记录表(YlxAlarm)实体类
- *
- * @author makejava
- * @since 2024-04-28 09:19:05
- */
-@Getter
-@Setter
-@Accessors(chain = true)
-@TableName(value = "ylx_alarm",autoResultMap = true)
-@ApiModel(value = "YlxAlarm", description = "报警记录")
-public class YlxAlarm implements Serializable {
-    private static final long serialVersionUID = -78310583967774907L;
-    /**
-     * id
-     */
-    @TableId("id")
-    @ApiModelProperty("id")
-    private String id;
-    /**
-     * 客户姓名
-     */
-    @ApiModelProperty("客户姓名")
-    private String userName;
-
-
-    @ApiModelProperty("订单号")
-    private String orderNo;
-    /**
-     * 客户电话
-     */
-    @ApiModelProperty("客户电话")
-    private String userPhone;
-    /**
-     * 地点
-     */
-    @ApiModelProperty("地点")
-    private String address;
-    /**
-     * 技师姓名
-     */
-    @ApiModelProperty("技师姓名")
-    private String jsName;
-    /**
-     * 技师电话
-     */
-    @ApiModelProperty("技师电话")
-    private String jsPhone;
-    /**
-     * 技师id
-     */
-    @ApiModelProperty("技师id")
-    private String jsId;
-    /**
-     * 用户openId
-     */
-    @ApiModelProperty("用户openId")
-    private String openId;
-    /**
-     * 0待处理;1已处理
-     */
-    @ApiModelProperty("0待处理;1已处理")
-    private Integer alarmStatus;
-    /**
-     * 备注
-     */
-    @ApiModelProperty("备注")
-    private String note;
-    /**
-     * 系统创建时间
-     */
-    @ApiModelProperty("系统创建时间")
-    private Date createTime;
-    /**
-     * 系统修改时间
-     */
-    @ApiModelProperty("系统修改时间")
-    private Date updateTime;
-    /**
-     * 是否删除0否1是
-     */
-    @ApiModelProperty("是否删除0否1是")
-    @TableLogic
-    private Integer isDelete;
-
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getUserPhone() {
-        return userPhone;
-    }
-
-    public void setUserPhone(String userPhone) {
-        this.userPhone = userPhone;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public void setAddress(String address) {
-        this.address = address;
-    }
-
-    public String getJsName() {
-        return jsName;
-    }
-
-    public void setJsName(String jsName) {
-        this.jsName = jsName;
-    }
-
-    public String getJsPhone() {
-        return jsPhone;
-    }
-
-    public void setJsPhone(String jsPhone) {
-        this.jsPhone = jsPhone;
-    }
-
-    public String getJsId() {
-        return jsId;
-    }
-
-    public void setJsId(String jsId) {
-        this.jsId = jsId;
-    }
-
-    public String getOpenId() {
-        return openId;
-    }
-
-    public void setOpenId(String openId) {
-        this.openId = openId;
-    }
-
-    public Integer getAlarmStatus() {
-        return alarmStatus;
-    }
-
-    public void setAlarmStatus(Integer alarmStatus) {
-        this.alarmStatus = alarmStatus;
-    }
-
-    public String getNote() {
-        return note;
-    }
-
-    public void setNote(String note) {
-        this.note = note;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Integer getIsDelete() {
-        return isDelete;
-    }
-
-    public void setIsDelete(Integer isDelete) {
-        this.isDelete = isDelete;
-    }
-
-}
-

+ 11 - 11
nightFragrance-massage/src/main/java/com/ylx/massage/mapper/YlxAlarmMapper.java → nightFragrance-massage/src/main/java/com/ylx/massage/mapper/AlarmMapper.java

@@ -2,7 +2,7 @@ package com.ylx.massage.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ylx.massage.domain.YlxAlarm;
+import com.ylx.massage.domain.Alarm;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.data.domain.Pageable;
 
@@ -14,7 +14,7 @@ import java.util.List;
  * @author makejava
  * @since 2024-04-28 09:19:04
  */
-public interface YlxAlarmMapper extends BaseMapper<YlxAlarm> {
+public interface AlarmMapper extends BaseMapper<Alarm> {
 
     /**
      * 通过ID查询单条数据
@@ -22,24 +22,24 @@ public interface YlxAlarmMapper extends BaseMapper<YlxAlarm> {
      * @param id 主键
      * @return 实例对象
      */
-    YlxAlarm queryById(String id);
+    Alarm queryById(String id);
 
     /**
      * 查询指定行数据
      *
-     * @param ylxAlarm 查询条件
+     * @param alarm 查询条件
      * @param pageable 分页对象
      * @return 对象列表
      */
-    List<YlxAlarm> queryAllByLimit(YlxAlarm ylxAlarm, @Param("pageable") Pageable pageable);
+    List<Alarm> queryAllByLimit(Alarm alarm, @Param("pageable") Pageable pageable);
 
     /**
      * 统计总行数
      *
-     * @param ylxAlarm 查询条件
+     * @param alarm 查询条件
      * @return 总行数
      */
-    long count(YlxAlarm ylxAlarm);
+    long count(Alarm alarm);
 
 
     /**
@@ -48,7 +48,7 @@ public interface YlxAlarmMapper extends BaseMapper<YlxAlarm> {
      * @param entities List<YlxAlarm> 实例对象列表
      * @return 影响行数
      */
-    int insertBatch(@Param("entities") List<YlxAlarm> entities);
+    int insertBatch(@Param("entities") List<Alarm> entities);
 
     /**
      * 批量新增或按主键更新数据(MyBatis原生foreach方法)
@@ -57,15 +57,15 @@ public interface YlxAlarmMapper extends BaseMapper<YlxAlarm> {
      * @return 影响行数
      * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
      */
-    int insertOrUpdateBatch(@Param("entities") List<YlxAlarm> entities);
+    int insertOrUpdateBatch(@Param("entities") List<Alarm> entities);
 
     /**
      * 修改数据
      *
-     * @param ylxAlarm 实例对象
+     * @param alarm 实例对象
      * @return 影响行数
      */
-    int update(YlxAlarm ylxAlarm);
+    int update(Alarm alarm);
 
     /**
      * 通过主键删除数据

+ 9 - 9
nightFragrance-massage/src/main/java/com/ylx/massage/service/YlxAlarmService.java → nightFragrance-massage/src/main/java/com/ylx/massage/service/AlarmService.java

@@ -2,7 +2,7 @@ package com.ylx.massage.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.ylx.massage.domain.YlxAlarm;
+import com.ylx.massage.domain.Alarm;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 
@@ -12,7 +12,7 @@ import org.springframework.data.domain.PageRequest;
  * @author makejava
  * @since 2024-04-28 09:19:05
  */
-public interface YlxAlarmService extends IService<YlxAlarm> {
+public interface AlarmService extends IService<Alarm> {
 
     /**
      * 通过ID查询单条数据
@@ -20,16 +20,16 @@ public interface YlxAlarmService extends IService<YlxAlarm> {
      * @param id 主键
      * @return 实例对象
      */
-    YlxAlarm queryById(String id);
+    Alarm queryById(String id);
 
     /**
      * 分页查询
      *
-     * @param ylxAlarm    筛选条件
+     * @param alarm    筛选条件
      * @param pageRequest 分页对象
      * @return 查询结果
      */
-    Page<YlxAlarm> queryByPage(YlxAlarm ylxAlarm, PageRequest pageRequest);
+    Page<Alarm> queryByPage(Alarm alarm, PageRequest pageRequest);
 
     /**
      * 新增数据
@@ -41,10 +41,10 @@ public interface YlxAlarmService extends IService<YlxAlarm> {
     /**
      * 修改数据
      *
-     * @param ylxAlarm 实例对象
+     * @param alarm 实例对象
      * @return 实例对象
      */
-    YlxAlarm update(YlxAlarm ylxAlarm);
+    Alarm update(Alarm alarm);
 
     /**
      * 通过主键删除数据
@@ -56,8 +56,8 @@ public interface YlxAlarmService extends IService<YlxAlarm> {
 
     /**
      * 添加报警记录
-     * @param ylxAlarm
+     * @param alarm
      * @return
      */
-    YlxAlarm addAlarm(YlxAlarm ylxAlarm);
+    Alarm addAlarm(Alarm alarm);
 }

+ 8 - 8
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/YlxAlarmServiceImpl.java → nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/AlarmServiceImpl.java

@@ -2,9 +2,9 @@ package com.ylx.massage.service.impl;
 
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ylx.massage.domain.YlxAlarm;
-import com.ylx.massage.mapper.YlxAlarmMapper;
-import com.ylx.massage.service.YlxAlarmService;
+import com.ylx.massage.domain.Alarm;
+import com.ylx.massage.mapper.AlarmMapper;
+import com.ylx.massage.service.AlarmService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -18,20 +18,20 @@ import org.springframework.stereotype.Service;
  */
 @Slf4j
 @Service("ylxAlarmService")
-public class YlxAlarmServiceImpl extends ServiceImpl<YlxAlarmMapper, YlxAlarm> implements YlxAlarmService {
+public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements AlarmService {
 
     @Override
-    public YlxAlarm queryById(String id) {
+    public Alarm queryById(String id) {
         return null;
     }
 
     @Override
-    public Page<YlxAlarm> queryByPage(YlxAlarm ylxAlarm, PageRequest pageRequest) {
+    public Page<Alarm> queryByPage(Alarm alarm, PageRequest pageRequest) {
         return null;
     }
 
     @Override
-    public YlxAlarm update(YlxAlarm ylxAlarm) {
+    public Alarm update(Alarm alarm) {
         return null;
     }
 
@@ -41,7 +41,7 @@ public class YlxAlarmServiceImpl extends ServiceImpl<YlxAlarmMapper, YlxAlarm> i
     }
 
     @Override
-    public YlxAlarm addAlarm(YlxAlarm ylxAlarm) {
+    public Alarm addAlarm(Alarm alarm) {
         return null;
     }
 }

+ 219 - 0
nightFragrance-massage/src/main/resources/mapper/massage/AlarmMapper.xml

@@ -0,0 +1,219 @@
+<?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.ylx.massage.mapper.AlarmMapper">
+
+    <sql id="AlarmColumns">
+        id, order_no, merchant_id, merchant_name, merchant_nick_name, merchant_sex, merchant_avatar,
+        merchant_phone, address, alarm_status, note, create_by, create_time, update_by, update_time, is_delete
+    </sql>
+
+    <resultMap type="com.ylx.massage.domain.Alarm" id="YlxAlarmMap">
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
+        <result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
+        <result property="merchantName" column="merchant_name" jdbcType="VARCHAR"/>
+        <result property="merchantNickName" column="merchant_nick_name" jdbcType="VARCHAR"/>
+        <result property="merchantSex" column="merchant_sex" jdbcType="INTEGER"/>
+        <result property="merchantAvatar" column="merchant_avatar" jdbcType="VARCHAR"/>
+        <result property="merchantPhone" column="merchant_phone" jdbcType="VARCHAR"/>
+        <result property="address" column="address" jdbcType="VARCHAR"/>
+        <result property="alarmStatus" column="alarm_status" jdbcType="INTEGER"/>
+        <result property="note" column="note" jdbcType="VARCHAR"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="YlxAlarmMap">
+        select <include refid="AlarmColumns"/>
+        from t_alarm
+        where id = #{id}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="YlxAlarmMap">
+        select <include refid="AlarmColumns"/>
+        from t_alarm
+        <where>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                and order_no = #{orderNo}
+            </if>
+            <if test="merchantId != null and merchantId != ''">
+                and merchant_id = #{merchantId}
+            </if>
+            <if test="merchantName != null and merchantName != ''">
+                and merchant_name = #{merchantName}
+            </if>
+            <if test="merchantNickName != null and merchantNickName != ''">
+                and merchant_nick_name = #{merchantNickName}
+            </if>
+            <if test="merchantSex != null">
+                and merchant_sex = #{merchantSex}
+            </if>
+            <if test="merchantPhone != null and merchantPhone != ''">
+                and merchant_phone = #{merchantPhone}
+            </if>
+            <if test="address != null and address != ''">
+                and address = #{address}
+            </if>
+            <if test="alarmStatus != null">
+                and alarm_status = #{alarmStatus}
+            </if>
+            <if test="isDelete != null">
+                and is_delete = #{isDelete}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from t_alarm
+        <where>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                and order_no = #{orderNo}
+            </if>
+            <if test="merchantId != null and merchantId != ''">
+                and merchant_id = #{merchantId}
+            </if>
+            <if test="merchantName != null and merchantName != ''">
+                and merchant_name = #{merchantName}
+            </if>
+            <if test="merchantNickName != null and merchantNickName != ''">
+                and merchant_nick_name = #{merchantNickName}
+            </if>
+            <if test="merchantSex != null">
+                and merchant_sex = #{merchantSex}
+            </if>
+            <if test="merchantPhone != null and merchantPhone != ''">
+                and merchant_phone = #{merchantPhone}
+            </if>
+            <if test="address != null and address != ''">
+                and address = #{address}
+            </if>
+            <if test="alarmStatus != null">
+                and alarm_status = #{alarmStatus}
+            </if>
+            <if test="isDelete != null">
+                and is_delete = #{isDelete}
+            </if>
+        </where>
+    </select>
+
+    <!--批量新增-->
+    <insert id="insertBatch">
+        insert into t_alarm
+        (<include refid="AlarmColumns"/>)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (
+            #{entity.id}, #{entity.orderNo}, #{entity.merchantId}, #{entity.merchantName},
+            #{entity.merchantNickName}, #{entity.merchantSex}, #{entity.merchantAvatar},
+            #{entity.merchantPhone}, #{entity.address}, #{entity.alarmStatus}, #{entity.note},
+            #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDelete}
+            )
+        </foreach>
+    </insert>
+
+    <!--批量新增或按主键更新-->
+    <insert id="insertOrUpdateBatch">
+        insert into t_alarm
+        (<include refid="AlarmColumns"/>)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (
+            #{entity.id}, #{entity.orderNo}, #{entity.merchantId}, #{entity.merchantName},
+            #{entity.merchantNickName}, #{entity.merchantSex}, #{entity.merchantAvatar},
+            #{entity.merchantPhone}, #{entity.address}, #{entity.alarmStatus}, #{entity.note},
+            #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDelete}
+            )
+        </foreach>
+        on duplicate key update
+            order_no = values(order_no),
+            merchant_id = values(merchant_id),
+            merchant_name = values(merchant_name),
+            merchant_nick_name = values(merchant_nick_name),
+            merchant_sex = values(merchant_sex),
+            merchant_avatar = values(merchant_avatar),
+            merchant_phone = values(merchant_phone),
+            address = values(address),
+            alarm_status = values(alarm_status),
+            note = values(note),
+            create_by = values(create_by),
+            create_time = values(create_time),
+            update_by = values(update_by),
+            update_time = values(update_time),
+            is_delete = values(is_delete)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update t_alarm
+        <set>
+            <if test="orderNo != null and orderNo != ''">
+                order_no = #{orderNo},
+            </if>
+            <if test="merchantId != null and merchantId != ''">
+                merchant_id = #{merchantId},
+            </if>
+            <if test="merchantName != null and merchantName != ''">
+                merchant_name = #{merchantName},
+            </if>
+            <if test="merchantNickName != null and merchantNickName != ''">
+                merchant_nick_name = #{merchantNickName},
+            </if>
+            <if test="merchantSex != null">
+                merchant_sex = #{merchantSex},
+            </if>
+            <if test="merchantAvatar != null and merchantAvatar != ''">
+                merchant_avatar = #{merchantAvatar},
+            </if>
+            <if test="merchantPhone != null and merchantPhone != ''">
+                merchant_phone = #{merchantPhone},
+            </if>
+            <if test="address != null and address != ''">
+                address = #{address},
+            </if>
+            <if test="alarmStatus != null">
+                alarm_status = #{alarmStatus},
+            </if>
+            <if test="note != null and note != ''">
+                note = #{note},
+            </if>
+            <if test="createBy != null and createBy != ''">
+                create_by = #{createBy},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                update_by = #{updateBy},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+            <if test="isDelete != null">
+                is_delete = #{isDelete},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from t_alarm
+        where id = #{id}
+    </delete>
+
+</mapper>

+ 0 - 201
nightFragrance-massage/src/main/resources/mapper/massage/YlxAlarmMapper.xml

@@ -1,201 +0,0 @@
-<?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.ylx.massage.mapper.YlxAlarmMapper">
-
-    <resultMap type="com.ylx.massage.domain.YlxAlarm" id="YlxAlarmMap">
-        <result property="id" column="id" jdbcType="VARCHAR"/>
-        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
-        <result property="userPhone" column="user_phone" jdbcType="VARCHAR"/>
-        <result property="address" column="address" jdbcType="VARCHAR"/>
-        <result property="jsName" column="js_name" jdbcType="VARCHAR"/>
-        <result property="jsPhone" column="js_phone" jdbcType="VARCHAR"/>
-        <result property="jsId" column="js_id" jdbcType="VARCHAR"/>
-        <result property="openId" column="open_id" jdbcType="VARCHAR"/>
-        <result property="alarmStatus" column="alarm_status" jdbcType="INTEGER"/>
-        <result property="note" column="note" jdbcType="VARCHAR"/>
-        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
-        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
-    </resultMap>
-
-    <!--查询单个-->
-    <select id="queryById" resultMap="YlxAlarmMap">
-        select id,user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete
-        from ylx_alarm
-        where id = #{id}
-    </select>
-
-    <!--查询指定行数据-->
-    <select id="queryAllByLimit" resultMap="YlxAlarmMap">
-        select
-        id,user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete
-        from ylx_alarm
-        <where>
-            <if test="id != null and id != ''">
-                and id = #{id}
-            </if>
-            <if test="userName != null and userName != ''">
-                and user_name = #{userName}
-            </if>
-            <if test="userPhone != null and userPhone != ''">
-                and user_phone = #{userPhone}
-            </if>
-            <if test="address != null and address != ''">
-                and address = #{address}
-            </if>
-            <if test="jsName != null and jsName != ''">
-                and js_name = #{jsName}
-            </if>
-            <if test="jsPhone != null and jsPhone != ''">
-                and js_phone = #{jsPhone}
-            </if>
-            <if test="jsId != null and jsId != ''">
-                and js_id = #{jsId}
-            </if>
-            <if test="openId != null and openId != ''">
-                and open_id = #{openId}
-            </if>
-            <if test="alarmStatus != null">
-                and alarm_status = #{alarmStatus}
-            </if>
-            <if test="note != null and note != ''">
-                and note = #{note}
-            </if>
-            <if test="createTime != null">
-                and create_time = #{createTime}
-            </if>
-            <if test="updateTime != null">
-                and update_time = #{updateTime}
-            </if>
-            <if test="isDelete != null">
-                and is_delete = #{isDelete}
-            </if>
-        </where>
-        limit #{pageable.offset}, #{pageable.pageSize}
-    </select>
-
-    <!--统计总行数-->
-    <select id="count" resultType="java.lang.Long">
-        select count(1)
-        from ylx_alarm
-        <where>
-            <if test="id != null and id != ''">
-                and id = #{id}
-            </if>
-            <if test="userName != null and userName != ''">
-                and user_name = #{userName}
-            </if>
-            <if test="userPhone != null and userPhone != ''">
-                and user_phone = #{userPhone}
-            </if>
-            <if test="address != null and address != ''">
-                and address = #{address}
-            </if>
-            <if test="jsName != null and jsName != ''">
-                and js_name = #{jsName}
-            </if>
-            <if test="jsPhone != null and jsPhone != ''">
-                and js_phone = #{jsPhone}
-            </if>
-            <if test="jsId != null and jsId != ''">
-                and js_id = #{jsId}
-            </if>
-            <if test="openId != null and openId != ''">
-                and open_id = #{openId}
-            </if>
-            <if test="alarmStatus != null">
-                and alarm_status = #{alarmStatus}
-            </if>
-            <if test="note != null and note != ''">
-                and note = #{note}
-            </if>
-            <if test="createTime != null">
-                and create_time = #{createTime}
-            </if>
-            <if test="updateTime != null">
-                and update_time = #{updateTime}
-            </if>
-            <if test="isDelete != null">
-                and is_delete = #{isDelete}
-            </if>
-        </where>
-    </select>
-
-    <!--新增所有列-->
-
-    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into
-        ylx_alarm(user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-            (#{entity.userName}#{entity.userPhone}#{entity.address}#{entity.jsName}#{entity.jsPhone}#{entity.jsId}#{entity.openId}#{entity.alarmStatus}#{entity.note}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
-        </foreach>
-    </insert>
-
-    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into
-        ylx_alarm(user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-            (#{entity.userName}#{entity.userPhone}#{entity.address}#{entity.jsName}#{entity.jsPhone}#{entity.jsId}#{entity.openId}#{entity.alarmStatus}#{entity.note}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
-        </foreach>
-        on duplicate key update
-        user_name = values(user_name)user_phone = values(user_phone)address = values(address)js_name =
-        values(js_name)js_phone = values(js_phone)js_id = values(js_id)open_id = values(open_id)alarm_status =
-        values(alarm_status)note = values(note)create_time = values(create_time)update_time =
-        values(update_time)is_delete = values(is_delete)
-    </insert>
-
-    <!--通过主键修改数据-->
-    <update id="update">
-        update ylx_alarm
-        <set>
-            <if test="userName != null and userName != ''">
-                user_name = #{userName},
-            </if>
-            <if test="userPhone != null and userPhone != ''">
-                user_phone = #{userPhone},
-            </if>
-            <if test="address != null and address != ''">
-                address = #{address},
-            </if>
-            <if test="jsName != null and jsName != ''">
-                js_name = #{jsName},
-            </if>
-            <if test="jsPhone != null and jsPhone != ''">
-                js_phone = #{jsPhone},
-            </if>
-            <if test="jsId != null and jsId != ''">
-                js_id = #{jsId},
-            </if>
-            <if test="openId != null and openId != ''">
-                open_id = #{openId},
-            </if>
-            <if test="alarmStatus != null">
-                alarm_status = #{alarmStatus},
-            </if>
-            <if test="note != null and note != ''">
-                note = #{note},
-            </if>
-            <if test="createTime != null">
-                create_time = #{createTime},
-            </if>
-            <if test="updateTime != null">
-                update_time = #{updateTime},
-            </if>
-            <if test="isDelete != null">
-                is_delete = #{isDelete},
-            </if>
-        </set>
-        where id = #{id}
-    </update>
-
-    <!--通过主键删除-->
-    <delete id="deleteById">
-        delete
-        from ylx_alarm
-        where id = #{id}
-    </delete>
-
-</mapper>
-