运营商管理功能实现
This commit is contained in:
parent
4e36ecb023
commit
2bd7afe3b1
@ -8,12 +8,16 @@ import com.cdzy.staff.model.entity.EbikeOperator;
|
|||||||
import com.cdzy.staff.model.vo.EbikeOperatorVo;
|
import com.cdzy.staff.model.vo.EbikeOperatorVo;
|
||||||
import com.cdzy.staff.service.EbikeOperatorService;
|
import com.cdzy.staff.service.EbikeOperatorService;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.core.util.StringUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.cdzy.staff.model.entity.table.EbikeOperatorTableDef.EBIKE_OPERATOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营商信息表 控制层。
|
* 运营商信息表 控制层。
|
||||||
*
|
*
|
||||||
@ -36,7 +40,7 @@ public class EbikeOperatorController {
|
|||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
public JsonResult<?> save(@Validated @RequestBody EbikeOperatorVo ebikeOperator) {
|
public JsonResult<?> save(@Validated @RequestBody EbikeOperatorVo ebikeOperator) {
|
||||||
EbikeOperator operator = EbikeOperator.builder()
|
EbikeOperator operator = EbikeOperator.builder()
|
||||||
.name(ebikeOperator.getName())
|
.operatorName(ebikeOperator.getOperatorName())
|
||||||
.address(ebikeOperator.getAddress())
|
.address(ebikeOperator.getAddress())
|
||||||
.contactPhone(ebikeOperator.getContactPhone())
|
.contactPhone(ebikeOperator.getContactPhone())
|
||||||
.createBy((Long) StpUtil.getLoginId())
|
.createBy((Long) StpUtil.getLoginId())
|
||||||
@ -75,8 +79,9 @@ public class EbikeOperatorController {
|
|||||||
* @return 所有数据
|
* @return 所有数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public List<EbikeOperator> list() {
|
public JsonResult<?> list() {
|
||||||
return ebikeOperatorService.list();
|
List<EbikeOperator> list = ebikeOperatorService.list();
|
||||||
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,7 +89,7 @@ public class EbikeOperatorController {
|
|||||||
*
|
*
|
||||||
* @return 运营商信息表详情
|
* @return 运营商信息表详情
|
||||||
*/
|
*/
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfoByToken")
|
||||||
public JsonResult<?> getInfo() {
|
public JsonResult<?> getInfo() {
|
||||||
String loginId = (String) StpUtil.getLoginId();
|
String loginId = (String) StpUtil.getLoginId();
|
||||||
StaffInfo staffInfo = (StaffInfo) StpUtil.getSession().get(loginId);
|
StaffInfo staffInfo = (StaffInfo) StpUtil.getSession().get(loginId);
|
||||||
@ -112,8 +117,9 @@ public class EbikeOperatorController {
|
|||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
public JsonResult<?> page(PageParam page) {
|
public JsonResult<?> page(PageParam page,String operatorName) {
|
||||||
Page<EbikeOperator> operatorPage = ebikeOperatorService.page(page.getPage());
|
QueryWrapper queryWrapper = QueryWrapper.create().where(EBIKE_OPERATOR.OPERATOR_NAME.like(operatorName, StringUtil.hasText(operatorName)));
|
||||||
|
Page<EbikeOperator> operatorPage = ebikeOperatorService.page(page.getPage(),queryWrapper);
|
||||||
return JsonResult.success(operatorPage);
|
return JsonResult.success(operatorPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import net.postgis.jdbc.PGgeography;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -33,14 +32,12 @@ public class EbikeOperator implements Serializable {
|
|||||||
@Column(tenantId = true)
|
@Column(tenantId = true)
|
||||||
private Long operatorId;
|
private Long operatorId;
|
||||||
|
|
||||||
private String name;
|
private String operatorName;
|
||||||
|
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
private String contactPhone;
|
private String contactPhone;
|
||||||
|
|
||||||
private PGgeography location;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人ID(ebike_operator_staff.staff_id)
|
* 创建人ID(ebike_operator_staff.staff_id)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -21,12 +21,21 @@ public class EbikeOperatorVo implements Serializable {
|
|||||||
|
|
||||||
private Long operatorId;
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商名称
|
||||||
|
*/
|
||||||
@NotBlank(message = "运营商名称不能为空")
|
@NotBlank(message = "运营商名称不能为空")
|
||||||
private String name;
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商地址
|
||||||
|
*/
|
||||||
@NotBlank(message = "运营商地址不能为空")
|
@NotBlank(message = "运营商地址不能为空")
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系手机号
|
||||||
|
*/
|
||||||
@NotBlank(message = "运营商联系手机号不能为空")
|
@NotBlank(message = "运营商联系手机号不能为空")
|
||||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系手机号格式错误")
|
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系手机号格式错误")
|
||||||
private String contactPhone;
|
private String contactPhone;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class EbikeOperatorServiceImpl extends ServiceImpl<EbikeOperatorMapper, E
|
|||||||
throw new EbikeException("该运营商不存在");
|
throw new EbikeException("该运营商不存在");
|
||||||
}else {
|
}else {
|
||||||
EbikeOperator operator = EbikeOperator.builder()
|
EbikeOperator operator = EbikeOperator.builder()
|
||||||
.name(ebikeOperator.getName())
|
.operatorName(ebikeOperator.getOperatorName())
|
||||||
.address(ebikeOperator.getAddress())
|
.address(ebikeOperator.getAddress())
|
||||||
.contactPhone(ebikeOperator.getContactPhone())
|
.contactPhone(ebikeOperator.getContactPhone())
|
||||||
.createBy((Long) StpUtil.getLoginId())
|
.createBy((Long) StpUtil.getLoginId())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user