From a921f6e5f51a10ac54a09b4c8b6cebb6b65a3352 Mon Sep 17 00:00:00 2001 From: lqy <3139512106@qq.com> Date: Sat, 4 May 2024 15:27:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 4 -- .../controller/RoleUserMapper.java | 41 +++++++++++++++++ .../controller/UserController.java | 24 ++++++++++ .../examination/mapper/RoleMapper.java | 6 ++- .../examination/service/RoleService.java | 18 ++++++++ .../examination/service/UserService.java | 9 ++++ .../service/impl/RoleServiceImpl.java | 42 ++++++++++++++++++ .../service/impl/UserServiceImpl.java | 28 ++++++++++++ src/main/resources/application.properties | 2 +- src/main/resources/mapper/RoleMapper.xml | 32 +++++++++++++ src/main/resources/mapper/UserMapper.xml | 26 +++++++++++ target/bbyb-examination-0.0.1-SNAPSHOT.jar | Bin 35753 -> 35752 bytes target/classes/application.properties | 2 +- 13 files changed, 226 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/bbyb/operating/examination/controller/RoleUserMapper.java create mode 100644 src/main/java/com/bbyb/operating/examination/service/RoleService.java create mode 100644 src/main/java/com/bbyb/operating/examination/service/impl/RoleServiceImpl.java create mode 100644 src/main/resources/mapper/RoleMapper.xml create mode 100644 src/main/resources/mapper/UserMapper.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 8bb4a3e..67e1e61 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,9 +8,5 @@ - - \ No newline at end of file diff --git a/src/main/java/com/bbyb/operating/examination/controller/RoleUserMapper.java b/src/main/java/com/bbyb/operating/examination/controller/RoleUserMapper.java new file mode 100644 index 0000000..9a7c6ab --- /dev/null +++ b/src/main/java/com/bbyb/operating/examination/controller/RoleUserMapper.java @@ -0,0 +1,41 @@ +package com.bbyb.operating.examination.controller; + +import com.bbyb.operating.examination.model.po.Role; +import com.bbyb.operating.examination.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController() +public class RoleUserMapper { + @Autowired + RoleService roleService; + + @PostMapping("/selectAll") + public List selectAll() { + return roleService.selectAll(); + } + + @PostMapping("/selectByPrimaryKey") + public Role selectByPrimaryKey(@RequestParam("id") Integer id) { + return roleService.selectByPrimaryKey(id); + } + + @PostMapping("/insert") + public Integer insert(@RequestParam("row") Role row) { + return roleService.insert(row); + } + + @PostMapping("/deleteByPrimaryKey") + public Integer deleteByPrimaryKey(@RequestParam("id") Integer id) { + return roleService.deleteByPrimaryKey(id); + } + + @PostMapping("/updateByPrimaryKey") + public Integer updateByPrimaryKey(@RequestParam("row") Role row) { + return roleService.updateByPrimaryKey(row); + } +} diff --git a/src/main/java/com/bbyb/operating/examination/controller/UserController.java b/src/main/java/com/bbyb/operating/examination/controller/UserController.java index 701042d..5bcad52 100644 --- a/src/main/java/com/bbyb/operating/examination/controller/UserController.java +++ b/src/main/java/com/bbyb/operating/examination/controller/UserController.java @@ -8,6 +8,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.xml.transform.Result; import java.util.List; /** @@ -58,6 +59,29 @@ public class UserController { return userService.getAllUser(); } + @PostMapping("/selectByPrimaryKey") + public User selectByPrimaryKey(@RequestParam("id") Integer id){ + return userService.selectByPrimaryKey(id); + } + + @PostMapping("/insert") + public Integer insert(@RequestBody User row){ + return userService.insert(row); + } + + @PostMapping("/deleteByPrimaryKey") + public Integer deleteByPrimaryKey(@RequestParam("id") Integer id){ + return userService.deleteByPrimaryKey(id); + } + + @PostMapping("/selectAll") + public List selectAll(){ + return userService.selectAll(); + } + @PostMapping("/updateByPrimaryKey") + public Integer updateByPrimaryKey(@RequestBody User row){ + return userService.updateByPrimaryKey(row); + } diff --git a/src/main/java/com/bbyb/operating/examination/mapper/RoleMapper.java b/src/main/java/com/bbyb/operating/examination/mapper/RoleMapper.java index fc558b2..d5c531f 100644 --- a/src/main/java/com/bbyb/operating/examination/mapper/RoleMapper.java +++ b/src/main/java/com/bbyb/operating/examination/mapper/RoleMapper.java @@ -1,8 +1,10 @@ package com.bbyb.operating.examination.mapper; import com.bbyb.operating.examination.model.po.Role; -import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import java.util.List; +@Mapper public interface RoleMapper { int deleteByPrimaryKey(Integer id); @@ -13,4 +15,4 @@ public interface RoleMapper { List selectAll(); int updateByPrimaryKey(Role row); -} \ No newline at end of file +} diff --git a/src/main/java/com/bbyb/operating/examination/service/RoleService.java b/src/main/java/com/bbyb/operating/examination/service/RoleService.java new file mode 100644 index 0000000..4c20659 --- /dev/null +++ b/src/main/java/com/bbyb/operating/examination/service/RoleService.java @@ -0,0 +1,18 @@ +package com.bbyb.operating.examination.service; + +import com.bbyb.operating.examination.model.po.Role; + +import java.util.List; + +public interface RoleService { + List selectAll(); + + + Role selectByPrimaryKey(Integer id); + + Integer insert(Role row); + + Integer deleteByPrimaryKey(Integer id); + + Integer updateByPrimaryKey(Role row); +} diff --git a/src/main/java/com/bbyb/operating/examination/service/UserService.java b/src/main/java/com/bbyb/operating/examination/service/UserService.java index aa87ded..b44e5a7 100644 --- a/src/main/java/com/bbyb/operating/examination/service/UserService.java +++ b/src/main/java/com/bbyb/operating/examination/service/UserService.java @@ -10,5 +10,14 @@ public interface UserService { List getAllUser(); + User selectByPrimaryKey(Integer id); + Integer insert(User row); + + Integer deleteByPrimaryKey(Integer id); + + List selectAll(); + + + Integer updateByPrimaryKey(User row); } diff --git a/src/main/java/com/bbyb/operating/examination/service/impl/RoleServiceImpl.java b/src/main/java/com/bbyb/operating/examination/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..963dcd5 --- /dev/null +++ b/src/main/java/com/bbyb/operating/examination/service/impl/RoleServiceImpl.java @@ -0,0 +1,42 @@ +package com.bbyb.operating.examination.service.impl; + +import com.bbyb.operating.examination.mapper.RoleMapper; +import com.bbyb.operating.examination.model.po.Role; +import com.bbyb.operating.examination.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class RoleServiceImpl implements RoleService { + @Autowired + RoleMapper roleMapper; + + + @Override + public List selectAll() { + return roleMapper.selectAll(); + } + + @Override + public Role selectByPrimaryKey(Integer id) { + + return roleMapper.selectByPrimaryKey(id); + } + + @Override + public Integer insert(Role row) { + return roleMapper.insert(row); + } + + @Override + public Integer deleteByPrimaryKey(Integer id) { + return roleMapper.deleteByPrimaryKey(id); + } + + @Override + public Integer updateByPrimaryKey(Role row) { + return roleMapper.updateByPrimaryKey(row); + } +} diff --git a/src/main/java/com/bbyb/operating/examination/service/impl/UserServiceImpl.java b/src/main/java/com/bbyb/operating/examination/service/impl/UserServiceImpl.java index 7278c60..9e265fe 100644 --- a/src/main/java/com/bbyb/operating/examination/service/impl/UserServiceImpl.java +++ b/src/main/java/com/bbyb/operating/examination/service/impl/UserServiceImpl.java @@ -30,11 +30,39 @@ public class UserServiceImpl implements UserService { @Override public List getAllUser() { + return userMapper.selectAll(); } + @Override + public User selectByPrimaryKey(Integer id) { + return userMapper.selectByPrimaryKey(id); + } + @Override + public Integer insert(User row) { + + return userMapper.insert(row); + } + + @Override + public Integer deleteByPrimaryKey(Integer id) { + + return userMapper.deleteByPrimaryKey(id); + } + + @Override + public List selectAll() { + + return userMapper.selectAll(); + } + + @Override + public Integer updateByPrimaryKey(User row) { + + return userMapper.updateByPrimaryKey(row); + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ef89a16..911cd5d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -4,7 +4,7 @@ spring.datasource.url=jdbc:mysql://127.0.0.1:3306/bbyb_examination spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username =root spring.datasource.password =123456A -logging.level.root=debug +logging.level.root=info logging.level.org.springframework.boot.autoconfigure=error mybatis.mapper-locations=classpath*:/mapper/**/*.xml diff --git a/src/main/resources/mapper/RoleMapper.xml b/src/main/resources/mapper/RoleMapper.xml new file mode 100644 index 0000000..30a82b8 --- /dev/null +++ b/src/main/resources/mapper/RoleMapper.xml @@ -0,0 +1,32 @@ + + + + + INSERT INTO roles (roleCode, roleName, createBy, createTime, updateBy, updateTime, invalid) + VALUES (#{roleCode}, #{roleName}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{invalid}); + + + UPDATE roles + SET roleCode = #{roleCode}, + roleName = #{roleName}, + createBy = #{createBy}, + createTime = #{createTime}, + updateBy = #{updateBy}, + updateTime = #{updateTime}, + invalid = #{invalid} + WHERE id = #{id}; + + + DELETE FROM user WHERE id = #{id}; + + + + + diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml new file mode 100644 index 0000000..1f0e33c --- /dev/null +++ b/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,26 @@ + + + + + INSERT INTO user_table (userCode, userName, phone, password, email, idCard, gender, isAdmin, isEnable, createBy, createTime, updateBy, updateTime, invalid) + VALUES (#{userCode}, #{userName}, #{phone}, #{password}, #{email}, #{idCard}, #{gender}, #{isAdmin}, #{isEnable}, #{createBy}, CURRENT_TIMESTAMP, #{updateTime}, CURRENT_TIMESTAMP, #{invalid}); + + + UPDATE user + SET userName = #{userName} + WHERE id = #{id} + + + + DELETE FROM user WHERE id = #{id}; + + + + diff --git a/target/bbyb-examination-0.0.1-SNAPSHOT.jar b/target/bbyb-examination-0.0.1-SNAPSHOT.jar index 535488a744df4f89b2a5d49fe39a700cc46f6956..152a97d4900ac1f4f264635b94c200d6c774d360 100644 GIT binary patch delta 2324 zcmZuz2~bm46#e-D8kRsn!ji8*0ND|Qu!zX2C`cR@Q$azYR;j|^$`&>gHVILLTgu>I zM>`BfrAkC?r7}38tu3O|S{*GSo!UAr*t)hOp!WUunCeF}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v=P;*{*u EKdK$vxc~qF diff --git a/target/classes/application.properties b/target/classes/application.properties index ef89a16..911cd5d 100644 --- a/target/classes/application.properties +++ b/target/classes/application.properties @@ -4,7 +4,7 @@ spring.datasource.url=jdbc:mysql://127.0.0.1:3306/bbyb_examination spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username =root spring.datasource.password =123456A -logging.level.root=debug +logging.level.root=info logging.level.org.springframework.boot.autoconfigure=error mybatis.mapper-locations=classpath*:/mapper/**/*.xml