边带调试

This commit is contained in:
mashuai 2024-09-19 15:12:32 +08:00
parent 33c2058d2c
commit f28814f128
4 changed files with 52 additions and 15 deletions

View File

@ -11,14 +11,39 @@ import com.bonus.common.core.web.domain.AjaxResult;
*/
public interface TbDeviceService{
/**
* 根据主键删除数据
* @param id
* @return
*/
AjaxResult deleteByPrimaryKey(Long id);
/**
* 插入数据
* @param record
* @return
*/
AjaxResult insertSelective(TbDevice record);
/**
* 根据主键查询数据
* @param id
* @return
*/
TbDevice selectByPrimaryKey(Long id);
/**
* 根据主键更新数据
* @param record
* @return
*/
AjaxResult updateByPrimaryKeySelective(TbDevice record);
/**
* 查询所有数据
* @param record
* @return
*/
List<TbDevice> getAll(TbDevice record);
}

View File

@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Objects;
import com.bonus.base.mapper.TbDeviceMapper;
import com.bonus.base.domain.TbDevice;
@ -24,6 +23,11 @@ public class TbDeviceServiceImpl implements TbDeviceService{
@Autowired
private TbDeviceMapper tbDeviceMapper;
/**
* 删除数据
* @param id
* @return
*/
@Override
public AjaxResult deleteByPrimaryKey(Long id) {
int result = tbDeviceMapper.deleteByPrimaryKey(id);
@ -33,6 +37,11 @@ public class TbDeviceServiceImpl implements TbDeviceService{
return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
}
/**
* 新增数据
* @param record
* @return
*/
@Override
public AjaxResult insertSelective(TbDevice record) {
//根据传入的名称和编码判重确保唯一性同类型下名称或编码均不得重复
@ -47,11 +56,21 @@ public class TbDeviceServiceImpl implements TbDeviceService{
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
}
/**
* 根据主键查询数据
* @param id
* @return
*/
@Override
public TbDevice selectByPrimaryKey(Long id) {
return tbDeviceMapper.selectByPrimaryKey(id);
}
/**
* 更新数据
* @param record
* @return
*/
@Override
public AjaxResult updateByPrimaryKeySelective(TbDevice record) {
//根据传入的名称和编码判重确保唯一性,同类型下名称或编码均不得重复
@ -68,6 +87,11 @@ public class TbDeviceServiceImpl implements TbDeviceService{
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
}
/**
* 查询所有数据
* @param record
* @return
*/
@Override
public List<TbDevice> getAll(TbDevice record) {
return tbDeviceMapper.getAll(record);

View File

@ -46,13 +46,11 @@
#{devStatus,jdbcType=INTEGER}, #{devWarn,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER},
#{logoUrl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbDevice">
<!--@mbg.generated-->
insert into tb_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="devType != null and devType != ''">
dev_type,
</if>
@ -68,9 +66,7 @@
<if test="configId != null">
config_id,
</if>
<if test="devStatus != null">
dev_status,
</if>
<if test="devWarn != null">
dev_warn,
</if>
@ -80,9 +76,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="devType != null and devType != ''">
#{devType,jdbcType=VARCHAR},
</if>
@ -98,9 +91,7 @@
<if test="configId != null">
#{configId,jdbcType=BIGINT},
</if>
<if test="devStatus != null">
#{devStatus,jdbcType=INTEGER},
</if>
1,
<if test="devWarn != null">
#{devWarn,jdbcType=INTEGER},
</if>

View File

@ -94,9 +94,6 @@
<if test="proName != null and proName != ''">
and tb.pro_name = #{proName}
</if>
<if test="departId != null and departId != ''">
and tb.depart_id = #{departId}
</if>
</select>
<insert id="insert">