yby 2 tháng trước cách đây
mục cha
commit
b44488d71c

+ 22 - 0
src/main/java/org/ajnb/controller/AdminController.java

@@ -0,0 +1,22 @@
+package org.ajnb.controller;
+
+import org.ajnb.service.AdminService;
+import org.ajnb.vo.AdminVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("Admin")
+public class AdminController {
+
+    @Autowired
+    private AdminService adminService;
+
+    @RequestMapping("QueryAdmin")
+    public List<AdminVO> QueryAdmin(){
+        return adminService.queryAdmin();
+    }
+}

+ 20 - 0
src/main/java/org/ajnb/controller/SuppliersController.java

@@ -0,0 +1,20 @@
+package org.ajnb.controller;
+
+import org.ajnb.service.SuppliersService;
+import org.ajnb.vo.SuppliersVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("Suppliers")
+public class SuppliersController {
+
+    @Autowired
+    SuppliersService suppliersService;
+
+    @RequestMapping("addSuppliers")
+    public void addSuppliers(SuppliersVO suppliersVO){
+        suppliersService.addSuppliers(suppliersVO);
+    }
+}

+ 11 - 0
src/main/java/org/ajnb/mapper/AdminMapper.java

@@ -0,0 +1,11 @@
+package org.ajnb.mapper;
+
+import org.ajnb.vo.AdminVO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface AdminMapper {
+    public List<AdminVO> queryAdmin();
+}

+ 10 - 0
src/main/java/org/ajnb/mapper/SuppliersMapper.java

@@ -0,0 +1,10 @@
+package org.ajnb.mapper;
+
+import org.ajnb.vo.SuppliersVO;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface SuppliersMapper {
+
+    public void addSuppliers(SuppliersVO suppliersVO);
+}

+ 10 - 0
src/main/java/org/ajnb/service/AdminService.java

@@ -0,0 +1,10 @@
+package org.ajnb.service;
+
+import org.ajnb.vo.AdminVO;
+
+import java.util.List;
+
+
+public interface AdminService {
+    public List<AdminVO> queryAdmin ();
+}

+ 21 - 0
src/main/java/org/ajnb/service/AdminServiceImpl.java

@@ -0,0 +1,21 @@
+package org.ajnb.service;
+
+import org.ajnb.mapper.AdminMapper;
+import org.ajnb.vo.AdminVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class AdminServiceImpl implements AdminService {
+
+    @Autowired
+    AdminMapper adminMapper;
+
+    @Override
+    public List<AdminVO> queryAdmin() {
+        return adminMapper.queryAdmin();
+    }
+
+}

+ 0 - 10
src/main/java/org/ajnb/service/LoginServiceIface.java

@@ -1,10 +0,0 @@
-package org.ajnb.service;
-
-
-import org.ajnb.vo.AdminVO;
-
-import java.util.List;
-
-public interface LoginServiceIface {
-    public List<AdminVO> queryAdmin (AdminVO adminVO);
-}

+ 0 - 4
src/main/java/org/ajnb/service/LoginServiceimpl.java

@@ -1,4 +0,0 @@
-package org.ajnb.service;
-
-public class LoginServiceimpl {
-}

+ 7 - 0
src/main/java/org/ajnb/service/SuppliersService.java

@@ -0,0 +1,7 @@
+package org.ajnb.service;
+
+import org.ajnb.vo.SuppliersVO;
+
+public interface SuppliersService {
+    public void addSuppliers(SuppliersVO suppliersVO);
+}

+ 18 - 0
src/main/java/org/ajnb/service/SuppliersServiceImpl.java

@@ -0,0 +1,18 @@
+package org.ajnb.service;
+
+import org.ajnb.mapper.SuppliersMapper;
+import org.ajnb.vo.SuppliersVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SuppliersServiceImpl implements SuppliersService {
+
+    @Autowired
+    SuppliersMapper suppliersMapper;
+
+    @Override
+    public void addSuppliers(SuppliersVO suppliersVO) {
+        suppliersMapper.addSuppliers(suppliersVO);
+    }
+}

+ 21 - 0
src/main/java/org/ajnb/vo/SuppliersVO.java

@@ -0,0 +1,21 @@
+package org.ajnb.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class SuppliersVO {
+
+    int id;
+    String name;
+    String phone;
+    boolean department_status;
+    String account;
+    String password;
+    BigDecimal longitude;
+    BigDecimal latitude;
+    String address;
+}

+ 14 - 0
src/main/resources/mapper/Admin.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.ajnb.mapper.AdminMapper">
+
+    <parameterMap id="pm" type="org.ajnb.vo.AdminVO"></parameterMap>
+    <resultMap id="rm" type="org.ajnb.vo.AdminVO"></resultMap>
+    
+    <select id="queryAdmin" resultMap="rm">
+        select * from Admin
+    </select>
+</mapper>

+ 14 - 0
src/main/resources/mapper/Suppliers.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.ajnb.mapper.SuppliersMapper">
+
+    <parameterMap id="pm" type="org.ajnb.vo.SuppliersVO"></parameterMap>
+    <resultMap id="rm" type="org.ajnb.vo.SuppliersVO"></resultMap>
+
+    <insert id="addSuppliers" parameterMap="pm">
+        INSERT INTO Suppliers(name,phone,department_status) VALUES (#{name},#{phone},#{department_status})
+    </insert>
+</mapper>