完成删除接口
修改刷卡系统查询卡授权设备列表接口,给返回列表增加返回id字段
This commit is contained in:
parent
5974bf6ee3
commit
1852958fcb
@ -6,10 +6,7 @@ import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
@ -43,5 +40,18 @@ public class XhpcCardController extends BaseController {
|
||||
return xhpcCardService.queryDeviceList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除指定的卡授权设备
|
||||
*
|
||||
* @author WH
|
||||
* @date 2022/1/26 10:37
|
||||
* @since version-1.0
|
||||
*/
|
||||
@DeleteMapping("/devices/{deviceId}")
|
||||
public R<Object> deleteDevice(@PathVariable("deviceId") Integer deviceId) {
|
||||
|
||||
return xhpcCardService.deleteDevice(deviceId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,11 @@ public class ListOfAuthorizedDevices {
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
|
||||
/**
|
||||
* deviceId
|
||||
*/
|
||||
@JsonProperty("deviceId")
|
||||
private Long deviceId;
|
||||
/**
|
||||
* deviceNumber
|
||||
*/
|
||||
@ -57,7 +62,7 @@ public class ListOfAuthorizedDevices {
|
||||
@JsonProperty("grantOperator")
|
||||
private String grantOperator;
|
||||
/**
|
||||
* 授权给谁的,0运营商,1平台
|
||||
* 授权给谁的,0表示运营商,1表示平台
|
||||
*/
|
||||
@JsonProperty("type")
|
||||
private Integer type;
|
||||
|
||||
@ -21,10 +21,32 @@ public interface TIccardDeviceMapper {
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回一个装着所有记录的集合
|
||||
* @author WH
|
||||
* @date 2022/1/25 17:07
|
||||
* @since version-1.0
|
||||
*/
|
||||
List<TIccardDevice> selectAll();
|
||||
|
||||
/**
|
||||
* 更新卡授权设备为删除状态
|
||||
*
|
||||
* @param deviceId the id of card grant device
|
||||
* @author WH
|
||||
* @date 2022/1/26 10:48
|
||||
* @since version-1.0
|
||||
*/
|
||||
void updateCardDeviceStatusIsDel(Integer deviceId);
|
||||
|
||||
/**
|
||||
* query specified card grant device delete status
|
||||
*
|
||||
* @param deviceId specified card grant device id
|
||||
* @return specified card grant device record
|
||||
* @author WH
|
||||
* @date 2022/1/26 11:03
|
||||
* @since version-1.0
|
||||
*/
|
||||
TIccardDevice selectDeletedStatusByDeviceId(Integer deviceId);
|
||||
|
||||
}
|
||||
@ -13,7 +13,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class TIccardDevice implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
|
||||
@ -28,4 +28,15 @@ public interface IXhpcCardService {
|
||||
*/
|
||||
R<ListOfAuthorizedDevices> queryDeviceList();
|
||||
|
||||
/**
|
||||
* 逻辑删除指定卡授权设备
|
||||
*
|
||||
* @param deviceId 卡授权设备id
|
||||
* @return 返回Result结果集对象
|
||||
* @author WH
|
||||
* @date 2022/1/26 10:39
|
||||
* @since version-1.0
|
||||
*/
|
||||
R<Object> deleteDevice(Integer deviceId);
|
||||
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
||||
}
|
||||
for (TIccardDevice tIccardDevice : tIccardDeviceList) {
|
||||
ListOfAuthorizedDevices.DataDTO dataDTO = new ListOfAuthorizedDevices.DataDTO();
|
||||
dataDTO.setDeviceId(tIccardDevice.getId());
|
||||
dataDTO.setDeviceName(tIccardDevice.getDevname());
|
||||
dataDTO.setDeviceType(tIccardDevice.getDevtype());
|
||||
dataDTO.setDeviceNumber(tIccardDevice.getSerialnumber());
|
||||
@ -102,4 +103,18 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
||||
return R.ok(listOfAuthorizedDevices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Object> deleteDevice(Integer deviceId) {
|
||||
|
||||
if (deviceId == null) {
|
||||
return R.fail("deviceId为null");
|
||||
}
|
||||
TIccardDevice tIccardDevice = tIccardDeviceMapper.selectDeletedStatusByDeviceId(deviceId);
|
||||
if (tIccardDevice != null) {
|
||||
return R.fail(404, "指定资源不存在");
|
||||
}
|
||||
tIccardDeviceMapper.updateCardDeviceStatusIsDel(deviceId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,6 +26,13 @@
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from t_iccard_device
|
||||
where del_flag = 0
|
||||
</select>
|
||||
<select id="selectDeletedStatusByDeviceId" resultType="com.xhpc.card.pojo.TIccardDevice">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from t_iccard_device
|
||||
where del_flag = 1 and id = #{deviceId}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete
|
||||
@ -117,4 +124,9 @@
|
||||
tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateCardDeviceStatusIsDel">
|
||||
update t_iccard_device
|
||||
set del_flag = 1
|
||||
where serialNumber = #{deviceId}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user