diff --git a/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorController.java b/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorController.java index 7c39fdc..f589fb7 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorController.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorController.java @@ -8,12 +8,16 @@ import com.cdzy.staff.model.entity.EbikeOperator; import com.cdzy.staff.model.vo.EbikeOperatorVo; import com.cdzy.staff.service.EbikeOperatorService; import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.core.util.StringUtil; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import static com.cdzy.staff.model.entity.table.EbikeOperatorTableDef.EBIKE_OPERATOR; + /** * 运营商信息表 控制层。 * @@ -36,7 +40,7 @@ public class EbikeOperatorController { @PostMapping("save") public JsonResult save(@Validated @RequestBody EbikeOperatorVo ebikeOperator) { EbikeOperator operator = EbikeOperator.builder() - .name(ebikeOperator.getName()) + .operatorName(ebikeOperator.getOperatorName()) .address(ebikeOperator.getAddress()) .contactPhone(ebikeOperator.getContactPhone()) .createBy((Long) StpUtil.getLoginId()) @@ -75,8 +79,9 @@ public class EbikeOperatorController { * @return 所有数据 */ @GetMapping("list") - public List list() { - return ebikeOperatorService.list(); + public JsonResult list() { + List list = ebikeOperatorService.list(); + return JsonResult.success(list); } /** @@ -84,7 +89,7 @@ public class EbikeOperatorController { * * @return 运营商信息表详情 */ - @GetMapping("getInfo") + @GetMapping("getInfoByToken") public JsonResult getInfo() { String loginId = (String) StpUtil.getLoginId(); StaffInfo staffInfo = (StaffInfo) StpUtil.getSession().get(loginId); @@ -112,8 +117,9 @@ public class EbikeOperatorController { * @return 分页对象 */ @GetMapping("page") - public JsonResult page(PageParam page) { - Page operatorPage = ebikeOperatorService.page(page.getPage()); + public JsonResult page(PageParam page,String operatorName) { + QueryWrapper queryWrapper = QueryWrapper.create().where(EBIKE_OPERATOR.OPERATOR_NAME.like(operatorName, StringUtil.hasText(operatorName))); + Page operatorPage = ebikeOperatorService.page(page.getPage(),queryWrapper); return JsonResult.success(operatorPage); } diff --git a/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperator.java b/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperator.java index 9a4fc19..7a8d917 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperator.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperator.java @@ -7,7 +7,6 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import net.postgis.jdbc.PGgeography; import java.io.Serial; import java.io.Serializable; @@ -33,14 +32,12 @@ public class EbikeOperator implements Serializable { @Column(tenantId = true) private Long operatorId; - private String name; + private String operatorName; private String address; private String contactPhone; - private PGgeography location; - /** * 创建人ID(ebike_operator_staff.staff_id) */ diff --git a/ebike-staff/src/main/java/com/cdzy/staff/model/vo/EbikeOperatorVo.java b/ebike-staff/src/main/java/com/cdzy/staff/model/vo/EbikeOperatorVo.java index 180d165..31d86e9 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/model/vo/EbikeOperatorVo.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/model/vo/EbikeOperatorVo.java @@ -21,12 +21,21 @@ public class EbikeOperatorVo implements Serializable { private Long operatorId; + /** + * 运营商名称 + */ @NotBlank(message = "运营商名称不能为空") - private String name; + private String operatorName; + /** + * 运营商地址 + */ @NotBlank(message = "运营商地址不能为空") private String address; + /** + * 联系手机号 + */ @NotBlank(message = "运营商联系手机号不能为空") @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系手机号格式错误") private String contactPhone; diff --git a/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorServiceImpl.java b/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorServiceImpl.java index ddc6f16..7db54a7 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorServiceImpl.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorServiceImpl.java @@ -33,7 +33,7 @@ public class EbikeOperatorServiceImpl extends ServiceImpl