分销
This commit is contained in:
@@ -52,4 +52,7 @@ public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void updateByUserId(@Param("param") User param);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
int updateBalanceByUserId(@Param("param") UserParam param);
|
||||
}
|
||||
|
||||
@@ -234,4 +234,8 @@
|
||||
UPDATE sys_user SET grade_id = #{param.gradeId} WHERE user_id = #{param.userId}
|
||||
</update>
|
||||
|
||||
<!-- 更新用户余额 -->
|
||||
<update id="updateBalanceByUserId">
|
||||
UPDATE sys_user SET balance = balance + #{param.balance} WHERE user_id = #{param.userId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.UserParam;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -109,4 +111,6 @@ public interface UserService extends IService<User>, UserDetailsService {
|
||||
* @param user 用户信息
|
||||
*/
|
||||
void updateByUserId(User user);
|
||||
|
||||
boolean updateBalanceByUserId(Integer userId, BigDecimal balance);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -302,6 +303,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
baseMapper.updateByUserId(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateBalanceByUserId(Integer userId, BigDecimal balance) {
|
||||
UserParam userParam = new UserParam();
|
||||
userParam.setUserId(userId);
|
||||
userParam.setBalance(balance);
|
||||
int updated = baseMapper.updateBalanceByUserId(userParam);
|
||||
return updated > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询用户的角色
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user