边代设备绑定

This commit is contained in:
syruan 2024-09-14 09:33:51 +08:00
parent 4a56064d64
commit 1d6e0d4324
14 changed files with 58 additions and 13 deletions

View File

@ -1,5 +1,6 @@
package com.bonus.base.controller; package com.bonus.base.controller;
import com.bonus.base.domain.TbBdDeviceRecord; import com.bonus.base.domain.TbBdDeviceRecord;
import com.bonus.base.domain.TbBdRecord;
import com.bonus.base.domain.TbDevice; import com.bonus.base.domain.TbDevice;
import com.bonus.base.service.TbBdDeviceRecordService; import com.bonus.base.service.TbBdDeviceRecordService;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
@ -8,11 +9,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
* 边带记录设备表(tb_bd_device_record)表控制层 * 边带记录设备表(tb_bd_device_record)表控制层
* * @author syruan
*/ */
@RestController @RestController
@RequestMapping("/tbBdDeviceRecord") @RequestMapping("/tbBdDeviceRecord")
@ -27,7 +30,7 @@ public class TbBdDeviceRecordController extends BaseController {
* 通过主键查询单条数据 * 通过主键查询单条数据
*/ */
@GetMapping("{/id}") @GetMapping("{/id}")
public AjaxResult selectOne(@PathVariable("id") Long id) { public AjaxResult getById(@PathVariable("id") Long id) {
return success(tbBdDeviceRecordService.selectByPrimaryKey(id)); return success(tbBdDeviceRecordService.selectByPrimaryKey(id));
} }
@ -38,4 +41,40 @@ public class TbBdDeviceRecordController extends BaseController {
return AjaxResult.success(getDataTable(list)); return AjaxResult.success(getDataTable(list));
} }
/**
* 新增数据
*
* @param record 实体
* @return 新增结果
*/
@PostMapping
public AjaxResult add(@RequestBody @NotNull(message = "参数不能为空") @Valid TbBdDeviceRecord record) {
return toAjax(tbBdDeviceRecordService.insertSelective(record));
}
/**
* 编辑数据
*
* @param record 实体
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody @NotNull(message = "参数不能为空") @Valid TbBdDeviceRecord record) {
return toAjax(tbBdDeviceRecordService.updateByPrimaryKeySelective(record));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping("/{id}")
public AjaxResult deleteById(@PathVariable("id") Long id) {
return toAjax(tbBdDeviceRecordService.deleteByPrimaryKey(id));
}
} }

View File

@ -16,7 +16,7 @@ import java.util.List;
* @author syruan * @author syruan
*/ */
@RestController @RestController
@RequestMapping("/tb_bd_record") @RequestMapping("/tbBdRecord")
public class TbBdRecordController extends BaseController { public class TbBdRecordController extends BaseController {
/** /**

View File

@ -25,7 +25,6 @@ public class TbBdRecord implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value="主键") @ApiModelProperty(value="主键")
@NotNull(message = "主键不能为null")
private Long id; private Long id;
/** /**

View File

@ -47,9 +47,15 @@ public class TbDevice implements Serializable {
/** /**
* 所属边带 * 所属边带
*/ */
@ApiModelProperty(value="所属边带") @ApiModelProperty(value="所属边带ID")
private Long bdId; private Long bdId;
/**
* 所属边带名称
*/
@ApiModelProperty(value="所属边带NAME")
private String bdName;
/** /**
* 配置id * 配置id
*/ */

View File

@ -187,10 +187,9 @@
</foreach> </foreach>
</delete> </delete>
<!--by syruan on 2024-09-11-->
<select id="getAll" resultMap="BaseResultMap"> <select id="getAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tb_bd_device_record from tb_bd_device_record
</select> </select>
</mapper> </mapper>

View File

@ -33,11 +33,12 @@
from tb_bd_record from tb_bd_record
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated--> update tb_bd_record set del_flag = 1
delete from tb_bd_record
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" parameterType="com.bonus.base.domain.TbBdRecord"> <insert id="insert" parameterType="com.bonus.base.domain.TbBdRecord">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into tb_bd_record (id, depart_id, depart_name, insert into tb_bd_record (id, depart_id, depart_name,
@ -48,7 +49,7 @@
audit_time) audit_time)
values (#{id,jdbcType=BIGINT}, #{departId,jdbcType=BIGINT}, #{departName,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{departId,jdbcType=BIGINT}, #{departName,jdbcType=VARCHAR},
#{proId,jdbcType=BIGINT}, #{proName,jdbcType=VARCHAR}, #{relUser,jdbcType=VARCHAR}, #{proId,jdbcType=BIGINT}, #{proName,jdbcType=VARCHAR}, #{relUser,jdbcType=VARCHAR},
#{relPhone,jdbcType=VARCHAR}, #{delFlag,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER}, #{relPhone,jdbcType=VARCHAR}, 0, #{auditStatus,jdbcType=INTEGER},
#{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=BIGINT}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=BIGINT},
#{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=BIGINT}, #{auditUser,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=BIGINT}, #{auditUser,jdbcType=BIGINT},
#{auditTime,jdbcType=TIMESTAMP}) #{auditTime,jdbcType=TIMESTAMP})
@ -129,7 +130,7 @@
#{relPhone,jdbcType=VARCHAR}, #{relPhone,jdbcType=VARCHAR},
</if> </if>
<if test="delFlag != null"> <if test="delFlag != null">
#{delFlag,jdbcType=INTEGER}, 0,
</if> </if>
<if test="auditStatus != null"> <if test="auditStatus != null">
#{auditStatus,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER},
@ -327,5 +328,6 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tb_bd_record from tb_bd_record
where del_flag = 0 or del_flag is null
</select> </select>
</mapper> </mapper>