1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package service
- import (
- "dhcp/code"
- "dhcp/internal/dao"
- "dhcp/model"
- "dhcp/result"
- )
- func AddDHCPInfo(dhcpInfo model.DHCP) result.Result {
- err := dao.AddDHCP(dhcpInfo)
- return result.Result{
- Status: err == nil,
- Code: code.SUCCESS,
- Msg: "添加成功",
- }
- }
- func GetDHCPInfoByMac(mac string) result.Result {
- dhcpInfo, err := dao.GetDHCPByMac(mac)
- return result.Result{
- Status: err == nil,
- Code: code.SUCCESS,
- Data: dhcpInfo,
- }
- }
- func GetDHCPInfo() result.Result {
- dhcpInfo, err := dao.GetDHCP()
- return result.Result{
- Status: err == nil,
- Code: code.SUCCESS,
- Data: dhcpInfo,
- }
- }
- func UpdateDHCPInfo(dhcpInfo model.DHCP) result.Result {
- err := dao.UpdateDHCP(dhcpInfo)
- return result.Result{
- Status: err == nil,
- Code: code.SUCCESS,
- Msg: "更新成功",
- }
- }
- func DeleteDHCPInfo(mac string) result.Result {
- err := dao.DeleteDHCP(mac)
- return result.Result{
- Status: err == nil,
- Code: code.SUCCESS,
- Msg: "删除成功",
- }
- }
|