边带调试

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{ public interface TbDeviceService{
/**
* 根据主键删除数据
* @param id
* @return
*/
AjaxResult deleteByPrimaryKey(Long id); AjaxResult deleteByPrimaryKey(Long id);
/**
* 插入数据
* @param record
* @return
*/
AjaxResult insertSelective(TbDevice record); AjaxResult insertSelective(TbDevice record);
/**
* 根据主键查询数据
* @param id
* @return
*/
TbDevice selectByPrimaryKey(Long id); TbDevice selectByPrimaryKey(Long id);
/**
* 根据主键更新数据
* @param record
* @return
*/
AjaxResult updateByPrimaryKeySelective(TbDevice record); AjaxResult updateByPrimaryKeySelective(TbDevice record);
/**
* 查询所有数据
* @param record
* @return
*/
List<TbDevice> getAll(TbDevice record); List<TbDevice> getAll(TbDevice record);
} }

View File

@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.bonus.base.mapper.TbDeviceMapper; import com.bonus.base.mapper.TbDeviceMapper;
import com.bonus.base.domain.TbDevice; import com.bonus.base.domain.TbDevice;
@ -24,6 +23,11 @@ public class TbDeviceServiceImpl implements TbDeviceService{
@Autowired @Autowired
private TbDeviceMapper tbDeviceMapper; private TbDeviceMapper tbDeviceMapper;
/**
* 删除数据
* @param id
* @return
*/
@Override @Override
public AjaxResult deleteByPrimaryKey(Long id) { public AjaxResult deleteByPrimaryKey(Long id) {
int result = tbDeviceMapper.deleteByPrimaryKey(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()); return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
} }
/**
* 新增数据
* @param record
* @return
*/
@Override @Override
public AjaxResult insertSelective(TbDevice record) { 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()); return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
} }
/**
* 根据主键查询数据
* @param id
* @return
*/
@Override @Override
public TbDevice selectByPrimaryKey(Long id) { public TbDevice selectByPrimaryKey(Long id) {
return tbDeviceMapper.selectByPrimaryKey(id); return tbDeviceMapper.selectByPrimaryKey(id);
} }
/**
* 更新数据
* @param record
* @return
*/
@Override @Override
public AjaxResult updateByPrimaryKeySelective(TbDevice record) { 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()); return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
} }
/**
* 查询所有数据
* @param record
* @return
*/
@Override @Override
public List<TbDevice> getAll(TbDevice record) { public List<TbDevice> getAll(TbDevice record) {
return tbDeviceMapper.getAll(record); return tbDeviceMapper.getAll(record);

View File

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

View File

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