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} +