From e2366a91a14f658f527effed20c005c09c153da7 Mon Sep 17 00:00:00 2001 From: x ronger Date: Thu, 5 Dec 2019 20:02:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2/=E6=9D=83=E9=99=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/rymcu/vertical/mapper/RoleMapper.java | 2 ++ .../java/com/rymcu/vertical/service/impl/RoleServiceImpl.java | 3 +-- src/main/java/mapper/RoleMapper.xml | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/mapper/RoleMapper.java b/src/main/java/com/rymcu/vertical/mapper/RoleMapper.java index d0ac733..6d498c8 100644 --- a/src/main/java/com/rymcu/vertical/mapper/RoleMapper.java +++ b/src/main/java/com/rymcu/vertical/mapper/RoleMapper.java @@ -14,4 +14,6 @@ public interface RoleMapper extends Mapper { Role selectRoleByInputCode(@Param("inputCode") String inputCode); Integer updateStatus(@Param("idRole") Integer idRole, @Param("status") String status); + + Integer update(@Param("idRole") Integer idRole, @Param("name") String name, @Param("inputCode") String inputCode, @Param("weights") Integer weights); } \ No newline at end of file diff --git a/src/main/java/com/rymcu/vertical/service/impl/RoleServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/RoleServiceImpl.java index 57501c8..785f154 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/RoleServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/RoleServiceImpl.java @@ -51,13 +51,12 @@ public class RoleServiceImpl extends AbstractService implements RoleServic public Map saveRole(Role role) { Integer result = 0; if (role.getIdRole() == null) { - role.setStatus("0"); role.setCreatedTime(new Date()); role.setUpdatedTime(role.getCreatedTime()); result = roleMapper.insertSelective(role); } else { role.setCreatedTime(new Date()); - result = roleMapper.updateByPrimaryKeySelective(role); + result = roleMapper.update(role.getIdRole(),role.getName(),role.getInputCode(),role.getWeights()); } Map map = new HashMap(1); if (result == 0) { diff --git a/src/main/java/mapper/RoleMapper.xml b/src/main/java/mapper/RoleMapper.xml index 41720e4..7967a39 100644 --- a/src/main/java/mapper/RoleMapper.xml +++ b/src/main/java/mapper/RoleMapper.xml @@ -16,6 +16,9 @@ update vertical_role set status = #{status},updated_time = sysdate() where id = #{idRole} + + update vertical_role set name = #{name}, input_code = ${inputCode}, weights = #{weights}, updated_time = sysdate() where id = #{idRole} +